akhauriyash/Code-Regression huggingface dataset:
//#include <bits/stdc++.h>
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;


#include "boost/multiprecision/cpp_int.hpp"
#include "boost/multiprecision/cpp_dec_float.hpp"
namespace mp = boost::multiprecision;
typedef mp::cpp_int LL;
typedef mp::number<mp::cpp_dec_float<1024>> DD;// 仮数部が1024ビットの浮動小数点数型(TLEしたら小さくする)

 
typedef long double dd;
#define i_7 (ll)(1E9+7)
//#define i_7 998244353
#define i_5 i_7-2
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
typedef pair<dd,dd> d_d;
ll inf=(ll)1E16;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define rrep(i,r,l) for(ll i=r;i>=l;i--)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-9;
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define fi first
#define se second
#define endl "\n"  //インタラクティブで消す！！！！！！！！！！！！！！！！！！！！！
#define SORT(v) sort(v.begin(),v.end())
#define ERASE(v) v.erase(unique(v.begin(),v.end()),v.end())
#define POSL(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin())
#define POSU(v,x) (upper_bound(v.begin(),v.end(),x)-v.begin())
template<class T,class S>
inline bool chmax(T &a, S b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}
template<class T,class S>
inline bool chmin(T &a, S b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}

void mod_print(ll k){
    ll P=50000;
    rep(y,1,P){
        ll x=mod(y*k);
        
        if(abs(x)<=P||x+P>=i_7){
            if(x+P>=i_7){
                x-=i_7;
            }
            cout<<x<<"/"<<y<<endl;
            //cout<<setprecision(5)<<(dd)x/(dd)y;
            return;
        }
    }
    cout<<"nun"<<endl;
}
#define all(c) c.begin(),c.end()
typedef vector<ll> vl;
//////////////////////////


int main(){fastio
    ll n;cin>>n;
    ll a[n];rep(i,0,n-1)cin>>a[i];
    ll sum=0;rep(i,0,n-1)sum+=a[i];
    ll N=sum/2;
   // vector<bool>ap(N+1),bp(N+1);
    const ll MAX=2000005;
    bitset<MAX>ap(1);
    bitset<MAX>bp(0);
    rep(i,0,n-1){
        bp=ap;
        bp|=ap<<a[i];
        
        ap=bp;
        bp=0;
        //rep(j,0,N)cout<<ap[j]<<" ";cout<<endl;
    }
    rrep(j,N,0){
        if(ap[j]){
            cout<<sum-j<<endl;return 0;
        }
    }
    
    return 0;
}


Measured memory_bytes: 4656
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <bitset>
#include <string>
#include <cmath>
#include <complex>
#include <numeric>
#include <cassert>

#include <vector>
#include <array>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <utility>

#define PI 3.14159265358979323846
#define int64 long long
#define uint64 unsigned long long
using namespace std;

int main()
{
	int64 nn, ff, bb, ans = 0;
	cin >> nn;
	map<pair<int64, int64>, int64> memo;
	for(int64 ii = 1;ii <= nn;ii++)
	{
		for(int64 jj = 1;true;jj *= 10)
		{
			if(jj > ii)
			{
				break;
			}
			ff = ii / jj;
		}
		bb = ii % 10;
		memo[make_pair(ff, bb)]++;
	}
	for(int64 ii = 1;ii <= 9;ii++)
	{
		for(int64 jj = 1;jj <= 9;jj++)
		{
			ans += memo[make_pair(ii, jj)] * memo[make_pair(jj, ii)];
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3640
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <cmath>
#include <iomanip>
#include <algorithm>
using namespace std;

int main(){
    int a, b, c;
    cin >> a >> b >> c;
    if(a == b){
        cout << c << endl;
    } else if(a == c){
        cout << b << endl;
    } else {
        cout << a << endl;
    }
    return 0;
}


Measured memory_bytes: 256
def binary_search(n, S, T):
    count = 0
    for t in T:
        left = 0
        right = n
        while left <= right:
            middle = (left + right)//2
            center = S[middle]
            if t == center:
                count += 1
                break
            elif t < center:
                right = middle - 1
            else:
                left = middle + 1
    return count


def main():
    n = int(input())
    S = list(map(int, input().split()))
    q = int(input())
    T = list(map(int, input().split()))

    print(binary_search(n, S, T))


if __name__ == "__main__":
    main()



Measured memory_bytes: 16716
import java.util.*;

public class Main
{
	public static void main(String args[])
	{
		Scanner sc=new Scanner(System.in);
		int a,b,c=0,d=0;
		a=sc.nextInt();
		for(int i=0;i<a;i++)
		{
			b=sc.nextInt();
			if(b%2==0)
			{
				if(b%3==0 || b%5==0)
				{
					
				}
				else
				{
					
					c=1;
				}
			}
			else
			{
				int e=b;
			}
		}
		if(c==0)
		{
			System.out.println("APPROVED");
		}
		else
		{
			System.out.println("DENIED");
		}
	}
}

Measured memory_bytes: 23764
#include <iostream>
#include <vector>
#include <queue>
using namespace std;
typedef vector<int> vi;
typedef pair<int,int> pii;
int INF = 1000000000;
vector<int> dijkstra(int s, int v, vector< vector< pair<int,int> > > G){
  //s: テ・ツァツ凝ァツつケ, v: テゥツ?づァツつケテヲツ閉ー, G: テゥツ堋」テヲツ篠・テ」ツδェテ」ツつケテ」ツδ暗」ツ??」ツつウテ」ツつケテ」ツδ暗」ツ?ッテヲツュツ」テ」ツ?ァテ・ツ?・テ」ツつ古」ツ?ヲテ」ツ?甘」ツ??
  priority_queue< pair<int, int> > wait;
  vector<int> result(v, INF);
  result[s] = 0;
  wait.push(make_pair(0, s));
  while(!wait.empty()){
    int nowpoint = wait.top().second;
    int nowcost = wait.top().first;
    wait.pop();
    if(nowcost <= result[nowpoint]){
      for(int i = 0; i < G[nowpoint].size(); ++i){
	int nextpoint = G[nowpoint][i].second;
	int nextcost = -nowcost + G[nowpoint][i].first;
	if(nextcost < result[nextpoint]){
	  wait.push(make_pair(-nextcost, nextpoint));
	  result[nextpoint] = nextcost;
	}
      }
    }
  }
  return result;
}

long long int count(vector< vector<pii> > &G, int s, int t, int N){
  vector<int> r1 = dijkstra(s,N,G), r2 = dijkstra(t,N,G);
  int l = r1[t], d1[l+1], d2[l+1];
  fill(d1,d1+l+1,0);
  fill(d2,d2+l+1,0);
  for(int i = 0; i < N; ++i){
    if(r1[i] <= l) ++d1[r1[i]];
    if(r2[i] <= l) ++d2[r2[i]];
  }
  long long int ret = 0;
  for(int i = 0; i < l-1; ++i){
    ret += (long long int)d1[i]*d2[l-2-i];
  }
  return ret;
}

int main(){
  int N, M, s, t, x, y;
  cin >> N >> M >> s >> t;
  --s;--t;
  vector< vector<pii> > G(N);
  for(int i = 0; i < M; ++i){
    cin >> x >> y;
    --x;--y;
    G[x].push_back(make_pair(1,y));
    G[y].push_back(make_pair(1,x));
  }
  cout << count(G,s,t,N) << endl;
  return 0;
}

Measured memory_bytes: 18668
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin>>n;
    string s;
    cin>>s;
    int i;
    int c=0;
    int ans=0;
    for(i=0;i<s.size();i++)
    {
        if(s[i]=='I')
            c++;
        else
            c--;
        ans=max(ans,c);
    }
    cout<<ans<<endl;
}


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

using namespace std;
//FILE *fi=freopen("1.txt","r",stdin);
double n;
int main()
{
    cin>>n;
    for(double i=0;i<=n;i++)
    {
        double x=i*(1.08);
        if(x>=n&&x-n<1)
        {
            cout<<i;
            return 0;
        }
    }
    cout<<":(";
    return 0;
}


Measured memory_bytes: 256
import sys

# S = input()
# N, M = map(int, input().split())
# nums = list(map(int, input().split()))
# nums_2d = [list(map(int, input().split())) for _ in range(N)]


def main():
    print(solve())


def solve():
    h, w = map(int, input().split())

    if h == 1 or w == 1:
        return 1

    return ((h * w) + 1) // 2


if __name__ == '__main__':
    main()


Measured memory_bytes: 2940
#include<bits/stdc++.h>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <cstdio>
#include <cstdlib>
#include <climits>
#include <utility>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <iomanip>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp> 

using namespace std;
using namespace __gnu_pbds;
#define sz(a) a.size()
#define inf (1000*1000*1000+5)
#define all(a) a.begin(),a.end()
#define tri pair<int,pii>
#define vii vector<pii>
#define vll vector<pll>
#define viii vector<tri>
#define mod (1000*1000*1000+7)
#define pqueue priority_queue< int >
#define pdqueue priority_queue< int,vi ,greater< int > >
#define flush fflush(stdout) 
#define lli long long int
#define pb push_back
#define pob pop_back
#define rep(i,a,b) for(lli i=a;i<b;i++)
#define repv(a,b) for(int i=a;i>=b;i--)
#define itr vector<lli> :: iterator
#define maximum(a,b,c)  max(a,max(b,c))
#define minimum(a,b,c) min(a,min(b,c))
#define tim clock_t

inline void fast()
{
	std::ios_base::sync_with_stdio(false);
	cin.tie(NULL);
}
bool comp(lli x,lli y)
{
	return(x>y);
}
int main()
{
	fast();
	lli x,prev,m1=INT_MIN,n,m;
	cin>>n>>m;
	lli sum=0;
	lli a[m];
	for(lli i=0;i<m;i++)
	{
		cin>>a[i];
	}
	sort(a,a+m);
	vector<lli> v;
	for(lli i=1;i<m;i++)
	{
		x=a[i]-a[i-1];
		v.push_back(x);		
	}
	sort(v.begin(),v.end(),comp);
	for(lli i=n-1;i<v.size();i++)
	{
		sum+=v[i];
	}
	
	cout<<sum;
	return 0;
}

Measured memory_bytes: 2168
use std::io;
use std::cmp;
use std::collections::BinaryHeap;
use std::collections::HashMap;
use std::collections::HashSet;
use std::f64::consts::PI;

fn read_line() -> String {
    let mut buf = String::new();
    io::stdin().read_line(&mut buf).ok();
    buf
}

fn main() {
    let line: Vec<usize> = read_line().split_whitespace().map(|s| s.parse().unwrap()).collect();
    let D = line[0];
    let cs: Vec<i64> = read_line().split_whitespace().map(|s| s.parse().unwrap()).collect();
    let mut s = Vec::with_capacity(26);
    for i in 0..D {
        let line: Vec<i64> = read_line().split_whitespace().map(|s| s.parse().unwrap()).collect();
        s.push(line);
    }
    let mut ts = vec![0; D];
    for i in 0..D {
        let line: Vec<usize> = read_line().split_whitespace().map(|s| s.parse().unwrap()).collect();
        ts[i] = line[0];
    }

    let mut last = vec![0; 26];
    let mut score = 0;
    for d in 0..D {
        let t = ts[d] - 1;
        let mut tmp = s[d][t];
        for i in 0..26 {
            if i!= t {
                tmp -= cs[i] * ((d as i64) + 1 - last[i]);
            }
        }
        last[t] = d as i64 + 1;
        score += tmp;
        println!("{}", score);
    }
}


Measured memory_bytes: 2268
#include <algorithm>
#include <iostream>
#include <vector>

using namespace std;

typedef long long ll;

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

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

int main(void) {
    int A, B, K;
    cin >> A >> B  >> K;

    int count = 0;
    int ans = 0;
    for (int i = min(A, B); i >= 0; i--) {
        if (A % i == 0 && B % i == 0) {
            count++;
            if (count == K) {
                ans = i;
                break;
            }
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		char[] n = sc.next().toCharArray();
		boolean flag = false;
		for(int i = 1; i < n.length; i++) {
			if(n[i] != '9') {
				flag = true;
				break;
			}
		}
		int ans = (n[0]-'0')+9*(n.length-1);
		if(flag) {
			 ans = (n[0]-'1')+9*(n.length-1);
		}
		System.out.println(ans);
	}
}

Measured memory_bytes: 21844
from itertools import combinations as combi
from math import sqrt
n=int(input())
x=[]
y=[]
sum=0
for i in range(n):
    xx,yy=map(int,input().split())
    x.append(xx)
    y.append(yy)
for a,b in combi(range(n),2):
    dx=x[a]-x[b]
    dy=y[a]-y[b]
    d=sqrt(dx**2+dy**2)
    sum+=d
ans=sum*2/n
print(ans)


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

int main() {
  int H, W;
  while(1){
    cin >> H >> W;
    if(H == 0 && W == 0)break;
    for (int i = 1; i <= H; i++) {
      for (int j = 1; j <= W; j++) {
        if (i == 1 || j == 1 || i == H || j == W) {
          cout << "#";
        } else {
          cout << ".";
        }
      }
      cout << "\n";
    }
    cout << endl;
  }
  return 0;
}

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

int main() {
  int counter = 0, l, r, d;
  cin >> l >> r >> d;
  for(int i = l; i <= r; i++) {
    if(i % d == 0) {
		counter++;
    }
  }
  cout << counter << endl;
}

Measured memory_bytes: 3572
import sys
N=input()
A=map(int, sys.stdin.readline().split())


ans=[ 0 for i in range(N) ]
V=[ 0 for i in range(N) ]

for i in range(N/2, N):
	ans[i]=A[i]
	V[i]=1

for i in range(N/2-1,-1,-1):
	t=A[i]
	k=i+1
	for j in range(i+k,N,k):
		t^=ans[j]
	ans[i]=t


cnt=sum(ans)
if cnt==0:
	print 0
	quit()
else:
	print cnt
	for i,x in enumerate(ans):
		if x==1:
			print i+1

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

public class Main {
    public static void main(String[] args) {
        try (Scanner sc = new Scanner(System.in);) {
            solve(sc);
        }
    }

    static void solve(Scanner sc) {
        int a = sc.nextInt();
        int b = sc.nextInt();
        String[] s = sc.next().split("-");
        if (s.length == 2 && s[0].length() == a && s[1].length() == b) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
}

Measured memory_bytes: 23252
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Washoum
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        inputClass in = new inputClass(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        AX solver = new AX();
        solver.solve(1, in, out);
        out.close();
    }

    static class AX {
        public void solve(int testNumber, inputClass sc, PrintWriter out) {
            int a = sc.nextInt();
            int b = sc.nextInt();
            out.println(Math.max(a + b, Math.max(a - b, a * b)));
        }

    }

    static class inputClass {
        BufferedReader br;
        StringTokenizer st;

        public inputClass(InputStream in) {

            br = new BufferedReader(new InputStreamReader(in));
        }

        public String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}



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

int main()
{
	int n,s=0;
	cin>>n;
	for(int i=0;i<n;i++)
	{
		int t1,t2;
		cin>>t1>>t2;
		s+=abs(t1-t2)+1;
	}
	cout<<s;
	return 0;
}

Measured memory_bytes: 256
import sys
n,y=map(int,input().split())
y//=1000
for i in range(n+1):
    for j in range(n-i+1):
        if i*10+j*5+(n-i-j)==y:
            print(i,j,n-i-j)
            sys.exit()

print(-1,-1,-1)


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

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

#define ull unsigned long long
#define ld long double

template <class T>
using V = vector<T>;
template <class T>
using VV = V<V<T>>;

#define rep2(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) rep2(i, 0, n)
#define rep1(i, n) rep1(i, 1, n + 1)

// #define repr(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
// #define rep1r(i, n) for (int i = ((int)(n)); i >= 1; i--)

#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()  //

#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define RSORT(x) sort(rall(x));
#define pb push_back
#define mp make_pair

#define INF (1e9)
#define PI (acos(-1))
#define EPS (1e-7)

// 総数を1000000007（素数）で割った余り
const long long mod = 1e9 + 7;

ull gcd(ull a, ull b) { return b ? gcd(b, a % b) : a; }
ull lcm(ull a, ull b) { return a / gcd(a, b) * b; }

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << std::fixed << std::setprecision(15);
    //    cout << std::setfill('0') << std::setw(2);

    long long A;
    std::cin >> A;
    long long B;
    std::cin >> B;
    long long C;
    std::cin >> C;

    if (A == B)
        cout << C << endl;
    else if (B == C)
        cout << A << endl;
    else
        cout << B << endl;

    return 0;
}


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

void fnInput(int& rnNumK)
{
  cin >> rnNumK;
}

int fnGcdGet(const vector<int>& cnrvnNun)
{
  int nGcd = cnrvnNun[0];

  for (int i = 1; i < cnrvnNun.size(); i++)
  {
    int nDividend = max(nGcd, cnrvnNun[i]);
    int nDivisor  = min(nGcd, cnrvnNun[i]);

    while ( nDividend % nDivisor )
    {
      int nMod = nDividend % nDivisor;
      nDividend = nDivisor;
      nDivisor  = nMod;
    }
    nGcd = nDivisor;
  }
  return nGcd;
}
  
int fnSumGcdTuples(int nNumK)
{
  int nSumGcd = 0;

  for (int i = 1; i <= nNumK; i++)
    for (int j = 1; j <= nNumK; j++)
      for (int k = 1; k <= nNumK; k++)
      {
        vector<int> vnNum = {i, j, k};
        nSumGcd += fnGcdGet(vnNum);
      }

  return nSumGcd;
}
  
int main()
{
  int nNumK;

  fnInput(nNumK);
  cout << fnSumGcdTuples(nNumK) << endl;

  return 0;
}

Measured memory_bytes: 3628
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <unordered_map>
#include <math.h>
#include <cmath>
#include <limits>
#include <numeric>
#include <iomanip>
#include <stdio.h>
#define INF 1000000000
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
typedef long long int ll;
using namespace std;

int main() {

	/*int a; cin >> a;
	if (a % 2 == 0) { cout << a / 2 << endl; }
	else { cout << a / 2 + 1 << endl; }*/

	int a[3][3];
	for (int i = 0; i < 3; i++){
		for (int j = 0; j < 3; j++) {
			cin >> a[i][j];
		}
	}
	int aa[3][3] = {};
	int n; cin >> n;
	for (int i = 0; i < n; i++) {
		int b; cin >> b;
		for (int k = 0; k < 3; k++) {
			for (int j = 0; j < 3; j++) {
				if (a[k][j] == b) {
					aa[k][j] = 1;
				}
			}
		}
	}

	for (int i = 0; i < 3; i++) {
		if (aa[i][0] == aa[i][1] && aa[i][1] == aa[i][2] && aa[i][0] == 1) {
			cout << "Yes" << endl; return 0;
		}
	}
	for (int i = 0; i < 3; i++) {
		if (aa[0][i] == aa[1][i] && aa[1][i] == aa[2][i] && aa[0][i] == 1) {
			cout << "Yes" << endl; return 0;
		}
	}
	if (aa[0][0] == aa[1][1] && aa[1][1] == aa[2][2] && aa[0][0] == 1) {
		cout << "Yes" << endl; return 0;
	}
	if (aa[0][2] == aa[1][1] && aa[1][1] == aa[2][0] && aa[2][0] == 1) {
		cout << "Yes" << endl; return 0;
	}

	cout << "No" << endl;

	/*int n, m; cin >> n >> m;
	int r[10], c[10]; 
	rep(i, m) { cin >> r[i] >> c[i]; }

	for(int )*/

	return 0;
}

Measured memory_bytes: 256
from itertools import combinations
while(True):
	n,x=map(int,input().split())
	if n==0 and x==0:
		break
	cnt=0
	cmb=list(combinations(range(1,n+1),3))
	for nmb in cmb:
		s=sum(nmb)
		if s==x:
			cnt+=1
	print(cnt)


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

using namespace std;
using ll = long long;

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

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

    vector<ll> A(N+1), B(N+1);
    for(int i=0; i<N+1; ++i) cin >> A[i];
    for(int i=0; i<N; ++i) cin >> B[i];

    ll s = 0;
    for(ll i=0; i<N; ++i){
        if(A[i] >= B[i]){
            s += B[i];
            A[i] -= B[i];
        }
        else{
            ll d = MIN(B[i]-A[i],A[i+1]);
            s += A[i] + d;
            A[i+1] -= d;
            A[i] = 0;
        }
    }

    cout << s << endl;

    return 0;
}

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

int main() {
    int n;
    cin>>n;
    for(int i=0;i<=n/7;i++){
        int tmp = n-7*i;
        if(tmp%4==0){
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

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

        int N = stdin.nextInt();
        int K = stdin.nextInt();
        int h[] = new int[N];
        int cnt = 0;
        
        for(int i= 0;i<N;i++) {
        	h[i] = stdin.nextInt();
        	if(h[i] >= K) {
        		cnt+=1;
        	}
        }
        
        System.out.println(cnt);
    }
}


Measured memory_bytes: 49464
#define _USE_MATH_DEFINES
#include <math.h>
#include <iostream>
#include <iomanip>
#include <cstdlib>
#include <algorithm>
#include <numeric>
#include <stdio.h>
#include <vector>

using namespace std;
typedef long long ll;

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

int main() {

    ll X;
    cin >> X;
    ll out = 0;
    ll sum = 0;
    rep(i,X){
        sum += i+1;
        if(sum>=X){
            out = i+1;
            break;
        }
    }
    cout << out << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define per(i, n) for (int i = (int)(n-1); i >= 0; i--)
#define sz(x) int(x.size())
#define all(x) (x).begin(), (x).end()
#define INF 2e9
#define LINF 1e18
template<class T> inline bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T &a, const T &b) { if (a > b) { a = b; return 1; } return 0; }
typedef long long ll;
typedef pair<int, int> P;

int main() {
    int n, m; cin >> n >> m;
    if (n == 1) {
        cout << m << endl;
        return 0;
    }
    int ans = 1;
    for (int i=1; i<m/n; i++) {
        if (m%(i+1) == 0) {
            int num = m/(i+1);
            if (num >= n) chmax(ans, i+1);
            else break;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
using System.Collections.Generic;
using System.Linq;
using static System.Console;
class K
{
int[]G=>ReadLine().Split().Select(i=>int.Parse(i)-1).ToArray();
int N;
static void Main()=>new K().Z();
void Z()
{
var I=G;
N=I[0]+1;
WriteLine(string.Join(" ",C(G,G,I[1]).Select(i=>i+1)));
}
int[]C(int[]p,int[]q,int K)
{
int[]P=I(p),Q=I(q),x=E(M(q,P,Q,p),K/6),y=I(x);
switch(K%6)
{
case 0:return M(x,p,y);
case 1:return M(x,q,y);
case 2:return M(x,q,P,y);
case 3:return M(x,q,P,Q,y);
case 4:return M(x,q,P,Q,p,Q,y);
default:return M(x,q,P,Q,p,p,Q,y);
}
}
int[]I(int[]a)
{
var c=new int[N];
for(var i=0;i<N;i++)c[a[i]]=i;
return c;
}
int[]M(int[]a,int[]b){var p=new int[N];for(var i=0;i<N;i++)p[i]=a[b[i]];return p;}
int[]M(params int[][]a)=>a.Aggregate(M);
int[]E(int[]a,int b)
{
var p=new int[N];
var f=new bool[N];
for(var i=0;i<N;i++)
if(!f[i])
{
var l=new List<int>();
var x=i;
while(!f[x]){l.Add(x);f[x]=true;x=a[x];}
var C=l.Count;
for(var j=0;j<C;j++)p[l[j]]=l[(j+b)%C];
}
return p;
}
}

Measured memory_bytes: 38376
#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()
using ll = long long;
using P = pair<int, int>;
const int INF = 1e9;
const long long LINF = 1e18;
const long long MOD = 1e9 + 7;

signed main() {
    int h,w;
    cin >> h >> w;
    string s[h];
    rep(i, h) {
        cin >> s[i];
    }
    int dp[h][w];
    fill(dp[0], dp[h], INF);
    dp[0][0] = (s[0][0] == '#' ? 1 : 0);
    for (int i = 0; i < h;i++){
        for (int j = 0; j < w;j++){
            if(i > 0) dp[i][j] = min(dp[i][j], dp[i - 1][j] + (s[i - 1][j] == '.' && s[i][j] == '#' ? 1 : 0));
            if(j > 0) dp[i][j] = min(dp[i][j], dp[i][j - 1] + (s[i][j - 1] == '.' && s[i][j] == '#' ? 1 : 0));
        }
    }
    cout << dp[h - 1][w - 1] << endl;
    return 0;
}

Measured memory_bytes: 256
import sys

input = sys.stdin.readline


def main():
    X, K, D = map(int, input().split())

    X = abs(X)
    q, r = divmod(X, D)
    if K < q:
        ans = X - D * K
    else:
        if (K - q) % 2 == 0:
            ans = r
        else:
            ans = D - r

    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 9168
#include <bits/stdc++.h>
using namespace std;
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define all(x) (x).begin(),(x).end()
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; }
typedef long long ll;
const long long INF = 1LL << 60;
typedef pair<int, int> P;
int main()
{
    int X, Y;
    cin >> X >> Y;

    rep(i, X + 1) {
        int j = X - i;
        if (i * 2 + j * 4 == Y) {
            cout << "Yes" << endl;
            return 0;
        }
    }

    cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 3636
H,W=map(int,input().split())
if H==1 or W==1:
    print(1)
    exit()
if (H*W)%2==0:
    print(int(H*W/2))
else:
    ans=((H//2+1)*(W//2+1))+((H-(H//2+1))*(W//2))
    print(ans)

Measured memory_bytes: 3060
n, x, y = map(int, input().split())

ans = [0] * n

for i in range(1, n+1):
    for j in range(i+1, n+1):
        ans[min(abs(j - i), abs(x - i) + 1 + abs(y - j), abs(x - j) + 1 + abs(y - i))] += 1

for e in ans[1:]:
    print(e)


Measured memory_bytes: 3572
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>

static const int MOD = 1000000007;
using ll = long long;
using u32 = uint32_t;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;

int main() {
    array<array<int, 15>, 15> v{};
    string s;
    while(cin >> s, s != "#"){
        for (auto &&i : v) fill(i.begin(),i.end(), -1);
        int a, b, c, d;
        cin >> a >> b >> c >> d;
        int y = 0, x = 0;
        for (auto &&j : s) {
            if(j == 'b') v[y][x++] = 1;
            else if(j == '/') y++, x = 0;
            else {
                for (int i = 0; i < (j-'0'); ++i) {
                    v[y][x++] = 0;
                }
            }
        }
        v[a-1][b-1] = 0;
        v[c-1][d-1] = 1;
        for (int i = 0; i <= y; ++i) {
            int cnt = 0;
            for (int j = 0; j < 15; ++j) {
                if(v[i][j] == -1){
                    if(cnt) printf("%d", cnt), cnt = 0;
                    if(i != y) printf("/");
                    break;
                }else if(v[i][j] == 0){
                    cnt++;
                }else {
                    if(cnt) printf("%d", cnt), cnt = 0;
                    printf("b");
                }
            }
        }
        puts("");
    }
    return 0;
}


Measured memory_bytes: 3168
Q='?+??+???==???'
q0=Q.size.times.select{|i|Q[i]=='?'}
a=gets.split.map(&:to_i)
a.each_with_index{|e,i|Q[q0[i]]=e.to_s if e!=-1}
q1=Q.size.times.select{|i|Q[i]=='?'}
p ([*1..9]-a).permutation.count{|a|
	s=Q.dup
	a.each_with_index{|e,i|s[q1[i]]=e.to_s}
	eval s
}

Measured memory_bytes: 9904
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
#define rep(i,n) for (ll i=0;i<n;++i)
const ll MOD=1000000007;

int main(){
    int H,W;
    cin >> H >> W;
    vector<int> count(H+W-1);
    rep (i,H){
        rep(j,W){
            char x;
            cin >> x;
            if (x=='#'){
                count[i+j]++;
            }
        }
    }
    bool ans=true;
    rep (i,H+W-1){
        if (count[i]>1){
            ans=false;
        }
    }
    if (ans){
        cout << "Possible" << endl;
    }
    else {
        cout << "Impossible" << endl;
    }
}

Measured memory_bytes: 256
n, k = map(int, input().split())
R, S, P = map(int, input().split())
T = list(input())

ans = 0
commands = ['']*n
for i in range(n):
    if T[i] == 'r':
        command = 'p'
        score = P
    elif T[i] == 's':
        command = 'r'
        score = R
    else:
        command = 's'
        score = S

    if i - k >= 0 and commands[i - k] == command:
        command = ''
        score = 0

    commands[i] = command
    ans += score

print(ans)

Measured memory_bytes: 4772
b = input()
ans = ""
for i in range(1):
  if b[i] == 'A': ans  += 'T'
  elif b[i] == 'T': ans  += 'A'
  elif b[i] == 'C': ans  += 'G'
  elif b[i] == 'G': ans  += 'C'
print(ans)
 

Measured memory_bytes: 2940
#include<iostream>
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<set>
#include<string>
#include<string.h>
#include<complex>
#include<math.h>
using namespace std;
typedef long long int llint;
typedef vector<int> vint;
#define rep(i,n) for(int i=0;i<n;i++)
#define yes(ans) if(ans)cout<<"yes"<<endl;else cout<<"no"<<endl;
#define Yes(ans) if(ans)cout<<"Yes"<<endl;else cout<<"No"<<endl;
#define YES(ans) if(ans)cout<<"YES"<<endl;else cout<<"NO"<<endl;

bool check(int a, int b) {
	return a > b;
}

int main() {
	int n, d, x;
	cin >> n >> d >> x;
	vint a(n);
	rep(i, n) {
		cin >> a[i];
	}
	rep(i, n) {
		x += d / a[i] + 1;
		if (d%a[i] == 0) {
			x--;
		}
	}
	cout << x << endl;
	return 0;
}


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

const int MOD = 998244353;
const int N = 200100;
int n, dp[N], farthest[N];

struct lol{
    int x, d;
    
    bool operator< (const lol &other)const{
        return x < other.x;
    }
} a[N];

int bs1(int st, int val){
    int dr = n;
    while (st <= dr){
        int mid = (st + dr) >> 1;
        if (a[mid].x < val) st = mid + 1;
        else dr = mid - 1;
    }
    return st;
}

#define L (nod << 1)
#define R (L | 1)
#define smax(X, Y) ((X) > (Y) ? (X) : (Y))
#define smin(X, Y) ((X) < (Y) ? (X) : (Y))

int arb[4 * N];

void update(int nod, int st, int dr, int idx, int val){
    if (st == dr){
        arb[nod] = val;
        return;
    }
    int mid = (st + dr) >> 1;
    if (idx <= mid) update(L, st, mid, idx, val);
    else update(R, mid+1, dr, idx, val);
    arb[nod] = smax(arb[L], arb[R]);
}

int query(int nod, int st, int dr, int l, int r){
    if (st >= l && dr <= r) return arb[nod];
    int mid = (st + dr) >> 1;
    int to_left = 0, to_right = 0;
    if (l <= mid) to_left = query(L, st, mid, l, r);
    if (r > mid) to_right = query(R, mid+1, dr, l, r);
    return smax(to_left, to_right);
}

int main(){
    ios_base::sync_with_stdio(0); cin.tie(0);
    // ifstream cin ("test.in");
    // ofstream cout ("test.out");
    cin >> n;
    for (int i=1; i<=n; ++i) cin >> a[i].x >> a[i].d;
    sort(a+1, a+n+1);
    // for (int i=1; i<=n; ++i) cout << a[i].x << ' ' << a[i].d << '\n';
    // cout << '\n';
    dp[n + 1] = 1;
    for (int i=n; i; --i){
        int idx = bs1(i, a[i].x + a[i].d);
        update(1, 1, n, i, idx);
        idx = query(1, 1, n, i, idx - 1);
        update(1, 1, n, i, idx);
        // cout << i << ' ' << idx << '\n';
        // farthest[i] = idx;
        dp[i] = (dp[i+1] + dp[idx]) % MOD;
    }
    // cout << '\n';
    // for (int i=1; i<=n; ++i) cout << a[i].x << ' ' << a[i].d << ' ' << dp[i] << '\n';
    cout << dp[1];
    return 0;
}

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

int main()
{
	int n,i,T=0,H=0,f;
	char t[101],h[101];
	scanf("%d\n",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s%s",t,h);
		f=strcmp(t,h);
		if(f==0){T+=1;H+=1;}
		else if(f>0)T+=3;
		else H+=3;
	}
	printf("%d %d\n",T,H);
	return 0;
}

Measured memory_bytes: 604
use proconio::input;

fn main() {
    input! {
        n: usize,
        a: [u64; n]
    };

    if let Some(_) = a.iter().find(|&&x| x == 0) {
        println!("{}", 0);
    } else {
        let ans = a.iter().try_fold(1u64, |acc, &x| acc.checked_mul(x));
        if ans == None || ans.unwrap() > 10u64.pow(18) {
            println!("{}", -1);
        } else {
            println!("{}", ans.unwrap())
        }
    }
}


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

namespace Atcoder
{

    class Program
    {
        static void Main(string[] args)
        {
            int a = int.Parse(Console.ReadLine());
            List<int> checker = new List<int>();
            checker.Add(a);
            int counter = 1;
            while (true)
            {
                counter++;
                if (a % 2 == 0)
                {
                    a = a / 2;
                }
                else
                {
                    a = 3 * a + 1;
                }
                if (checker.Contains(a))
                {
                    break;
                }
                else
                {
                    checker.Add(a);
                }

            }
            Console.WriteLine(counter);
        }

    }
}

Measured memory_bytes: 13148
#!/usr/bin/env python3

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

n = I()
a = LI()
b = 0
c = 1000
for i in range(n-1):
    if a[i] < a[i+1]:
        d = c // a[i]
        b += d
        c -= d * a[i]
    elif a[i] > a[i+1]:
        c += b * a[i]
        b = 0
if b > 0:
    c += a[-1] * b
print(c)


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

using namespace std;

int arr[100010];
int mxs[100010];

int main()
{
    int n, t, i;
    scanf("%d%d", &n, &t);
    for(i = 1; i <= n; i++)
        scanf("%d", &arr[i]);

    for(i = n; i >= 1; i--)
        mxs[i] = max(mxs[i + 1], arr[i]);

    int mx = 0, cnt = 0;
    for(i = 1; i <= n; i++)
    {
        int d = mxs[i + 1] - arr[i];
        if(d > mx)
        {
            mx = d;
            cnt = 1;
        }
        else if(d == mx)
            cnt++;
    }

    printf("%d\n", cnt);
    return 0;
}

Measured memory_bytes: 1024
import sys
sys.setrecursionlimit(10000000)

n, m = map(int, input().split())
g = [[] for i in range(n)]
dp = [-1] * n
for i in range(m):
    x, y = map(int, input().split())
    x -= 1
    y -= 1
    g[x].append(y)



def rec(v):
    if dp[v] != -1:
        return dp[v]
    
    res = 0
    for i in g[v]:
        res = max(res, rec(i) + 1)
    
    dp[v] = res
    return dp[v]

for i in range(n):
    rec(i)
print(max(dp))


Measured memory_bytes: 134732
#include <iostream>
    #include <vector>
    #include <string>
     
    using namespace std;
     
    int main() {
        int n;
        cin >> n;
        vector<string> blue(n);
        for (int i = 0; i < n; i++) {
            cin >> blue[i];
        }
        int m;
        cin >> m;
        vector<string> red(m);
        for (int i = 0; i < m; i++) {
            cin >> red[i];
        }
     
        int ans = 0;
        auto calc = [&](string s) {
            int buf = 0;
            for (string t: blue) {
                if (t == s) buf++;
            }
            for (string t: red) {
                if (t == s) buf--;
            }
            return buf;
        };
     
        for (string t: blue) {
            ans = max(ans, calc(t));
        }
     
        cout << ans << endl;
        return 0;
    }

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pii;
typedef pair<double,double> pdd;
#define MEM(a, b) memset(a, (b), sizeof(a))
#define SZ(i) ll(i.size())
#define FOR(i, j, k, in) for (ll i=j ; i<k ; i+=in)
#define RFOR(i, j, k, in) for (ll i=j ; i>=k ; i-=in)
#define REP(i, j) FOR(i, 0, j, 1)
#define REP1(i,j) FOR(i, 1, j+1, 1)
#define RREP(i, j) RFOR(i, j, 0, 1)
#define ALL(_a) _a.begin(),_a.end()
#define mp make_pair
#define pb push_back
#define X first
#define Y second
#ifdef tmd
#define debug(...) do{\
    fprintf(stderr,"%s - %d (%s) = ",__PRETTY_FUNCTION__,__LINE__,#__VA_ARGS__);\
    _do(__VA_ARGS__);\
}while(0)
template<typename T>void _do(T &&_x){cerr<<_x<<endl;}
template<typename T,typename ...S> void _do(T &&_x,S &&..._t){cerr<<_x<<" ,";_do(_t...);}
template<typename _a,typename _b> ostream& operator << (ostream &_s,const pair<_a,_b> &_p){return _s<<"("<<_p.X<<","<<_p.Y<<")";}
template<typename It> ostream& _OUTC(ostream &_s,It _ita,It _itb)
{
    _s<<"{";
    for(It _it=_ita;_it!=_itb;_it++)
    {
        _s<<(_it==_ita?"":",")<<*_it;
    }
    _s<<"}";
    return _s;
}
template<typename _a> ostream &operator << (ostream &_s,vector<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a> ostream &operator << (ostream &_s,set<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a,typename _b> ostream &operator << (ostream &_s,map<_a,_b> &_c){return _OUTC(_s,ALL(_c));}
template<typename _t> void pary(_t _a,_t _b){_OUTC(cerr,_a,_b);cerr<<endl;}
#define IOS()
#else
#define debug(...)
#define pary(...)
#define endl '\n'
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0)
#endif

template<class T> inline bool cmax(T &a, const T &b) { return b > a ? a = b, true : false; }
template<class T> inline bool cmin(T &a, const T &b) { return b < a ? a = b, true : false; }
template<class T> using MaxHeap = priority_queue<T>;
template<class T> using MinHeap = priority_queue<T, vector<T>, greater<T>>;

const ll MOD=1000000007;
const ll INF=0x3f3f3f3f3f3f3f3f;
const ll MAXN=1e5+5;
const ll MAXLG=__lg(MAXN)+2;


ll n,k;
ll sum = 0;
ll cnt1;
ll cnt2;
/********** Main()  function **********/

int main()
{
  IOS();
  cin>>n>>k;
  REP1(i,n){
    if(i*2%k==0){
      if(i%k==0){
        cnt1++;
      } else {
        cnt2++;
      }
    }
  }


  cout<<cnt1*cnt1*cnt1+cnt2*cnt2*cnt2<<endl;
	return 0;
}


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

class Program
{
    static void Main(string[] args)
    {
        var S = sc.ReadStr();
        var ans = S.Substring(0, 4) + " " + S.Substring(4);
        Console.WriteLine(ans);
    }
    static Scanner sc = new Scanner();
}

class Scanner
{
    string[] S = new string[0];
    int Index = 0;
    char[] Separators = new char[] { ' ' };

    public string Next()
    {
        if (this.Index < this.S.Length) return this.S[this.Index++];
        var line = "";
        while (line == "") line = Console.ReadLine();
        this.S = line.Split(this.Separators, StringSplitOptions.RemoveEmptyEntries);
        if (this.S.Length == 0) return this.Next();
        this.Index = 0;
        return this.S[this.Index++];
    }
    public string ReadStr()
    {
        return this.Next();
    }
    public char ReadChar()
    {
        return this.Next()[0];
    }
    public int ReadInt()
    {
        return int.Parse(this.Next());
    }
    public uint ReadUInt()
    {
        return uint.Parse(this.Next());
    }
    public long ReadLong()
    {
        return long.Parse(this.Next());
    }
    public double ReadDouble()
    {
        return double.Parse(this.Next());
    }
    public int[] ReadIntArray(int n)
    {
        var array = new int[n];
        for (int i = 0; i < array.Length; i++)
        {
            array[i] = this.ReadInt();
        }
        return array;
    }
    public long[] ReadLongArray(int n)
    {
        var array = new long[n];
        for (int i = 0; i < array.Length; i++)
        {
            array[i] = this.ReadLong();
        }
        return array;
    }
    public double[] ReadDoubleArray(int n)
    {
        var array = new double[n];
        for (int i = 0; i < array.Length; i++)
        {
            array[i] = this.ReadDouble();
        }
        return array;
    }
    public char[] ReadCharArray(int n)
    {
        var array = new char[n];
        for (int i = 0; i < array.Length; i++)
        {
            array[i] = this.ReadChar();
        }
        return array;
    }
    public string[] ReadStrArray(int n)
    {
        var array = new string[n];
        for (int i = 0; i < array.Length; i++)
        {
            array[i] = this.ReadStr();
        }
        return array;
    }
}


Measured memory_bytes: 11092
import java.io.*;

class Main{
    public static void main(String[]args)throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringBuilder sb = new StringBuilder();

        String[] str = br.readLine().split(" ");
        int n = Integer.parseInt(str[0]);
        int m = Integer.parseInt(str[1]);
        int l = Integer.parseInt(str[2]);
        int[][] aMatrix = new int[n][m];
        int[][] bMatrix = new int[m][l];
        long sum = 0;

        //?????????A???????????????????´???????
        for(int i=0; i<n; i++){
            str = br.readLine().split(" ");
            for(int k=0; k<m; k++){
                aMatrix[i][k] = Integer.parseInt(str[k]);
            }
        }

        //  ??????B???????????????????´???????
        for(int i=0; i<m; i++){
            str = br.readLine().split(" ");
            for(int k=0; k<l; k++){
                bMatrix[i][k] = Integer.parseInt(str[k]);
            }
        }

        //?????????????????????C????±???????
        for(int i=0; i<n; i++){
            for(int k=0; k<l; k++){
                for(int w=0; w<m; w++){
                    sum += (long) aMatrix[i][w] * bMatrix[w][k];
                }
                if(k!=0)sb.append(" ");
                sb.append(sum);
                sum = 0;
            }
            sb.append("\n");
        }
        System.out.print(sb);
    }
}

Measured memory_bytes: 32736
#include <stdio.h>

#include <math.h>

int main(void)
{
        double x,h,a;


        while(scanf("%lf %lf",&x,&h)){
                if(x==0&&h==0) break;

                printf("%.6f\n",(x*sqrt((4*h*h)+(x*x)))+(x*x));
        }
        return 0;
}

Measured memory_bytes: 648
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>
#include <fstream>
#include <bitset>
#include <time.h>
#include <tuple>
#include <iomanip>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef complex<double> Point;

#define PI acos(-1.0)
#define EPS 1e-10
const ll INF = 1e16;
const ll MOD = 1e9 + 7;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,N) for(int i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define EQ(a,b) (abs((a)-(b))<EPS)
#define EQV(a,b) ( EQ((a).real(), (b).real()) && EQ((a).imag(), (b).imag()) )
#define fi first
#define se second
#define N_SIZE (1LL << 20)
#define NIL -1

ll sq(ll num) { return num*num; }
ll mod_pow(ll x, ll n) {
	if (n == 0)return 1;
	if (n == 1)return x%MOD;
	ll res = sq(mod_pow(x, n / 2));
	res %= MOD;
	if (n % 2 == 1) {
		res *= x;
		res %= MOD;
	}
	return res;
}
ll mod_add(ll a, ll b) { return (a + b) % MOD; }
ll mod_sub(ll a, ll b) { return (a - b + MOD) % MOD; }
ll mod_mul(ll a, ll b) { return a*b % MOD; }

int n,d;

int main(){
	cin >> n >> d;
	if(d == 100)d++;
	cout << d;
	rep(i,n){
		cout<<"00";
	}
	cout << endl;
}

Measured memory_bytes: 256
#import sys
MOD = 10 ** 9 + 7
#input = sys.stdin.readline
import math

#import bisect

def sosuhante(n):
    for k in range(2, int(math.sqrt(n))+1):
        if n% k ==0:
            return False
    return True
def cmb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2,r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1,r,p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result

def kingaku(a,b,n):
    keta=len(str(n))
    return a*n+b*keta

def main():
#    h,w,a,b = map(int, input().split())
#    c = [[0 for j in range(n)] for i in range(n)]
    n=int(input())
    x=int(n//1.08)
  #  print(x)
    a=":("
    if int(x*1.08)==n:
        a=int(x)
    elif int((x+1)*1.08)==n:
        a=int(x+1)
    elif int((x-1)*1.08)==n:
        a=int(x-1)
    print(a)


#    print(n,kingaku(a,b,x))

if __name__ == "__main__":
    main()

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

int main() {
    int n;cin>>n;
    int si=to_string(n).size();
    if(si==1){
        cout<<n<<endl;
    }else{
        map<P,int> num;
        for(int i=1;i<=n;i++){
            int fst;
            string s=to_string(i);
            fst=s[0]-'0';
            int last=i%10;
            if(num.count(make_pair(fst,last))){
                num.at(make_pair(fst,last))++;
            }else{
                num[make_pair(fst,last)]=1;
            }
        }
        int ans=0;
        for(int i=1;i<=9;i++){
            for(int j=0;j<=9;j++){
                if(num.count(make_pair(i,j))){
                    if(num.count(make_pair(j,i))){
                        ans+=num.at(make_pair(i,j))*num.at(make_pair(j,i));
                    }
                }
            }
        }
        cout<<ans<<endl;
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include<string>
#include<cmath>
#include<stack>
#include <vector>
#include<queue>
#include <random>
#include <cstdint>
#include <bitset>
#include <iomanip>
#include<utility>
using namespace std;
using ll = long long;

int main() {
	ll n, m;
	vector<ll> divi;
	cin >> n >> m;
	for (int i = 1; i <=sqrt(m); i++) {
		if (m%i == 0) {
			divi.push_back(i);
			divi.push_back(m / i);
		}
	}
	sort(divi.begin(), divi.end());
	for (int i = 0;; i++) {
		if (divi[i] >= n) {
			cout << m / divi[i] << endl;
			return 0;
		}
	}

}



Measured memory_bytes: 256
import os, sys, re, math, queue


def run_it():
	H,W = list(map(int,input().split(' ')))
	
	s_ary = []
	l_memo = [[0 for j in range(W)] for i in range(H)]
	r_memo = [[0 for j in range(W)] for i in range(H)]
	u_memo = [[0 for j in range(W)] for i in range(H)]
	b_memo = [[0 for j in range(W)] for i in range(H)]
	
	for _ in range(H):
		s_ary.append(input())
	
	for h in range(H):
		for w in range(W):
			if s_ary[h][w] == '.':
				if w == 0:	
					l_memo[h][w] = 1
				elif w > 0:
					l_memo[h][w] = l_memo[h][w-1] + 1
				if h == 0:
					u_memo[h][w] = 1
				elif h > 0:
					u_memo[h][w] = u_memo[h-1][w] + 1
			
			if s_ary[-h-1][-w-1] == '.':
				if w == 0:
					r_memo[-h-1][-w-1] = 1
				elif w > 0:
					r_memo[-h-1][-w-1] = r_memo[-h-1][-w] + 1	
				if h == 0:
					b_memo[-h-1][-w-1] = 1
				elif h > 0:
					b_memo[-h-1][-w-1] = b_memo[-h][-w-1] + 1
	
	ret = 0
	for h in range(H):
		for w in range(W):
			tmp = l_memo[h][w] + r_memo[h][w] + u_memo[h][w] + b_memo[h][w] - 3
			ret = max(ret, tmp)
	
	print(ret)
				
if sys.platform == 'ios':
	for i in range(2):
		sys.stdin = open('Dtest' + str(i) + '.txt')
		run_it()
else:
	run_it()

Measured memory_bytes: 183172