akhauriyash/Code-Regression huggingface dataset:
#!/usr/bin/env python3

from math import gcd


t = int(input())
ans = 0
for i in range(1, t + 1):
    for j in range(1, t + 1):
        r = gcd(i, j)

        for k in range(1, t + 1):
            ans += gcd(r, k)

print(ans)

Measured memory_bytes: 9184
#include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <list>
#include <iterator>
#include <assert.h>
#pragma warning(disable:4996) 
 
typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF 9223300000000000000
#define INF 2140000000
const long long MOD = 1000000007;
using namespace std;

char str[105][105];

int main(int argc, char* argv[])
{
    int h,w;
    scanf("%d%d", &h, &w);

    int cnt[26]={0};
    int i,j;
    for(i=0; i<h; i++) {
        scanf("%s", str[i]);
        for(j=0; j<w; j++) {
            cnt[str[i][j]-'a']++;
        }
    }
    int cnt4=0,cnt2=0;
    for(i=0; i<26; i++) {
        cnt4+=cnt[i]/4*4;
        cnt2+=cnt[i]/2*2;
    }

    int need4=(h/2)*(w/2)*4;
    int need2=h*w-(h%2)*(w%2);

    if(cnt4>=need4 && cnt2>=need2) {
        printf("Yes\n");
    }
    else {
        printf("No\n");
    }


    return 0;
}


Measured memory_bytes: 128
#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() {
    int m, n;
    cin >> m >> n;
    vector<vector<pair<int, int>>> upper(n), lower(n);
    for (int i = 0; i < m; ++i) {
        int k;
        cin >> k;
        for (int j = 0; j < k; ++j) {
            int a, b; string s;
            cin >> a >> s >> b;
            a--;
            if(s == ">=") lower[a].emplace_back(b, i);
            else upper[a].emplace_back(b, i);
        }
    }
    vector<vector<int>> G(m);
    vector<int> in(m);
    for (int i = 0; i < n; ++i) {
        for (auto &&j : upper[i]) {
            for (auto &&k : lower[i]) {
                if(j.first < k.first){
                    G[j.second].emplace_back(k.second);
                    in[k.second]++;
                }
            }
        }
    }
    queue<int> q;
    for (int i = 0; i < m; ++i) {
        if(!in[i]) q.emplace(i);
    }
    while(!q.empty()){
        int i = q.front(); q.pop();
        for (auto &&j : G[i]) {
            in[j]--;
            if(!in[j]) q.emplace(j);
        }
        G[i].clear();
    }
    for (int i = 0; i < m; ++i) {
        if(in[i]) {
            puts("No");
            return 0;
        }
    }
    puts("Yes");
    return 0;
}


Measured memory_bytes: 4052
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
const int INF = (1<<30)-1;
const long long LINF = (1LL<<62)-1;
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, 1, 0, -1};
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; }

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  double l;
  cin >> l;
  double a = l/3;
  cout << fixed << setprecision(9) << pow(a, 3) << endl;
  return 0;
}

Measured memory_bytes: 384
import java.util.Scanner;

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

        char[] s = sc.nextLine().toCharArray();

        int count = 0;
        for(char c: s) {
            if(c == 'o') {
                count++;
            }
        }
        System.out.println(700+(count*100));
        sc.close();
    }
}


Measured memory_bytes: 23252
N = int(input())
edges = [list(map(lambda x: int(x)-1, input().split())) for _ in range(N-1)]
connected = [list() for _ in range(N)]
for e in edges:
  connected[e[0]].append(e[1])
  connected[e[1]].append(e[0])
for c in connected:
  c.sort()

ans = 0
current = 0
for i in range(N):
  # calculate any subgraph using upto i
  # i-1
  # i-1, i-2
  # i-1, i-2, ..., 0
  current += 1 + i # 1 for single vertex case, i for adding vertices to each i-1 case.
  for j in connected[i]:
    if j > i:
      break
    current -= j + 1  # subtract 1 for each edges
  #print(i, current)
  ans += current
  
print(ans)
  




Measured memory_bytes: 68252
y,x=map(int,input().split())
lst=[]
for i in range(y):
    lst.append(input())
    
del_line=[]
del_row=[]
for i in range(y):
    cnt=0
    for j in range(x):
        if lst[i][j]==".":
            cnt+=1
    if cnt==x:
        del_line.append(i)
for i in range(x):
    cnt=0
    for j in range(y):
        if lst[j][i]==".":
            cnt+=1
    if cnt==y:
        del_row.append(i)

for i in range(y):
    if not i in del_line:
        pr=[]
        for j in range(x):
            if not j in del_row:
                pr.append(lst[i][j])
        print("".join(pr))

Measured memory_bytes: 9048
#include <bits/stdc++.h>
using namespace std;
#define modulo 998244353
#define mod(mod_x) ((((long long)mod_x+modulo))%modulo)
#define Inf 100000000000000000

bool check(vector<int> &V,int goal){
	
	vector<vector<bool>> dp(V.size()+1,vector<bool>(16001,false));
	dp[0][8000]=true;
	for(int i=0;i<V.size();i++){
		for(int j=0;j<=16000;j++){
			if(!dp[i][j])continue;
			int n = j+V[i];
			if(n<=16000){
				dp[i+1][n]=true;
			}
			n = j-V[i];
			if(n>=0){
				dp[i+1][n]=true;
			}
		}
	}
	if(8000+goal<0||8000+goal>16000)return false;
	return dp[V.size()][8000+goal];
	
}

int main(){
	
	string s;
	cin>>s;
	
	int x,y;
	cin>>x>>y;
	
	int dir = 0;
	vector<int> xx,yy;
	int cnt = 0;
	bool f = false;
	for(int i=0;i<=s.size();i++){
		if(i!=s.size()&&s[i]=='F'){
			if(!f){
				x--;
			}
			else{
				cnt++;
			}
		}
		else{
			f=true;
			if(cnt!=0){
				if(dir==0){
					xx.push_back(cnt);
				}
				else{
					yy.push_back(cnt);
				}
			}
			cnt=0;
			dir^=1;
		}
	}
	
	if(check(xx,x)&&check(yy,y)){
		cout<<"Yes"<<endl;
	}
	else{
		cout<<"No"<<endl;
	}
	
	
	
    return 0;
}


Measured memory_bytes: 5632
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define fill fill_n
#define pb push_back
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
    int n;cin>>n;
    ll a[n],b[n],c[n],dp[n][3];
    for(int i=0;i<n;i++){
        cin>>a[i]>>b[i]>>c[i];
    }
    for(int i=0;i<n;i++){
        if(i==0){
            dp[0][0]=a[0];
            dp[0][1]=b[0];
            dp[0][2]=c[0];
        }
        else{
            dp[i][0]=a[i]+max(dp[i-1][1],dp[i-1][2]);
            dp[i][1]=b[i]+max(dp[i-1][2],dp[i-1][0]);
            dp[i][2]=c[i]+max(dp[i-1][1],dp[i-1][0]);
        }
    }
    cout<<max({dp[n-1][0],dp[n-1][2],dp[n-1][1]})<<"\n";
    
    
	
	return 0;
}


Measured memory_bytes: 4992
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define FOR(i,start,end) for(int i=start;i<=end;i++)
const int INF = 1001001001;
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define Rort(a) sort(a.rbegin(), a.rend())
typedef long long ll;
const ll MOD=1000000007;
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T>auto MAX(const T& a) { return *max_element(a.begin(),a.end()); }
template<class T>auto MIN(const T& a) { return *min_element(a.begin(),a.end()); }
template<class T, class U>U SUM(const T& a, const U& v) { return accumulate(a.begin(),a.end(), v); }
template<class T, class U>U COUNT(const T& a, const U& v) { return count(a.begin(),a.end(), v); }
template<class T, class U>int LOWER(const T& a, const U& v) { return lower_bound(a.begin(),a.end(), v) - a.begin(); }
template<class T, class U>int UPPER(const T& a, const U& v) { return upper_bound(a.begin(),a.end(), v) - a.begin(); }
int GCD(int a, int b) { return b ? GCD(b, a%b) : a; }
int LCM(int a, int b) { int g = GCD(a, b); return a / g * b; }
//---------------------------------------------------------------------------------------------------
typedef pair<int,int> P;

int main(void){
    // Your code here!
    ll a,b,c; cin >> a >> b >> c;
    ll c_poi = min(a+b+1,c);
    cout << c_poi + b << endl;
}


Measured memory_bytes: 3580
#include<iostream>
#include<sstream>
#include<ios>
#include<iomanip>
#include<algorithm>
#include<vector>
#include<list>
#include<queue>
#include<cstdlib>
#include<cmath>
#include<queue>
#include<deque>
#include<map>
#include<string>
#include<numeric>
#include<set>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep2(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define rep_inv(i, n, m) for(int i = (int)(n); i > (int)(m); i--)
using namespace std;
using vi = vector<int>;
using vc = vector<char>;
using vvi = vector<vector<int>>;
using vvc = vector<vector<char>>;
using pii = pair<int, int>;
using vpii = vector<pii>;

int main(){
  int N;
  cin >> N;
  bool able = false;

  rep2(i, 1, 10){
    rep2(j, 1, 10){
      if(i*j == N) able = true;
    }
  }

  if(able) cout << "Yes" << endl;
  else cout << "No" << endl;
  
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
  int N;
  cin >> N;
  
  int A[110];
  for (int i=0; i<N; i++) cin >> A[i];
  
  sort (A,A+N,greater<int>());
 
  cout << A[0] -A[N-1] << endl;
}
  
  

Measured memory_bytes: 256
import copy
import itertools
from collections import deque
INF = float('inf')
ROAD = '.'
WALL = '#'
STEPS = [(1, 0), (-1, 0), (0, 1), (0, -1)]

def main():
    H, W = map(int, input().split())
    
    # 迷路の初期化
    initial_maze = [None] * H

    # 迷路の読み込み
    for i in range(H):
        initial_maze[i] = list(input())
        for j in range(W):
            if initial_maze[i][j] == ROAD:
                initial_maze[i][j] = INF
    
    ans = 0
    for sy, sx in itertools.product(range(H), range(W)):
        if initial_maze[sy][sx] == WALL:
            continue

        maze = copy.deepcopy(initial_maze)
        maze[sy][sx] = 0
        que = deque([[sy, sx]])

        while que:
            y,x = que.popleft()

            for (i, j) in STEPS:
                ny, nx = y+i, x+j
                if ny < 0 or ny >= H or nx < 0 or nx >= W:
                    continue

                target = maze[ny][nx]
                if target != WALL:
                    if target > maze[y][x]+1:
                        maze[ny][nx] = maze[y][x] + 1
                        if maze[ny][nx] > ans:
                            ans = maze[ny][nx]
                        que.append([ny,nx])
    print(ans)

if __name__ == "__main__":
    main()


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

typedef long long ll;

#define rep(i, a, n) for (ll i = a; i < (ll)n; ++i)
#define INF 10e9
#define MOD 1000000000 + 7
#define MAX 51000
#define all(x) (x).begin(), (x).end()
#define MX(x) *max_element(all(x))
#define MN(x) *min_element(all(x))

using namespace std;

int main(void)
{
    ll n, k;
    cin >> n >> k;
    vector<ll> v(n);
    rep(i, 0, n) cin >> v[i];
    ll res = INF;
    rep(i, 0, n - k + 1) res = min(res, min(abs(v[i]), abs(v[i + k - 1])) + abs(v[i] - v[i + k - 1]));
    cout << res << endl;
}

Measured memory_bytes: 4024
import numpy as np
import copy
N, C = map(int, input().split())

x = np.zeros(N)
v = np.zeros(N)
for i in range(N):
    xi, vi = map(int, input().split())
    x[i] = xi
    v[i] = vi

cum_right = np.cumsum(v)
cum_left = np.cumsum(v[::-1])

max_right = np.zeros(N)
max_left = np.zeros(N)
max_right[0] = cum_right[0] - x[0]
max_left[0] = cum_left[0] - (C - x[N - 1])
for i in range(1, N):
    max_right[i] = max(max_right[i - 1], cum_right[i] - x[i])
    max_left[i] = max(max_left[i - 1], cum_left[i] - (C - x[N - 1 - i]))

ans = max(0, max_left[N - 1], max_right[N - 1])

for i in range(N - 1):
    ans = max(ans, cum_left[i] + max_right[N - 2 - i] - (C - x[N - 1 - i]) * 2)
    ans = max(ans, cum_right[i] + max_left[N - 2 - i] - x[i] * 2)
print(int(ans))

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

using namespace std;

int main(){
    int n,k;
    cin >> n >> k;
    int mid = (n%2==0)? n/2 : (n+1)/2;
    int offset = (n%2==0)? 2*mid+1 : 2*mid;
    while(k--){
        int i,j;
        cin >> i >> j;
        if( i >= mid ) i = offset-i;
        if( j >= mid ) j = offset-j;
        int e = min(i,j);
        switch(e%3) {
            case 1: cout << "1" << endl; break;
            case 2: cout << "2" << endl; break;
            case 0: cout << "3" << endl; break;
        }
    }
    return 0;
}

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

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

	vector<int> vecn(N);
	for (int i = 0; i < N; i++) {
		cin >> vecn.at(i);
	}
	int ans = 0;
	int tmp = 1;
	while (tmp != 2 && ans <= N) {
		tmp = vecn.at(tmp - 1);
		ans++;
	}
	if (ans <= N) {
		cout << ans << endl;
	}
	else {
		cout << -1 << endl;
	}
}

Measured memory_bytes: 640
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <stack>
#include <numeric>
#include <algorithm>
#include <tuple>
#include <stdio.h>
#include <bitset>
#include <limits.h>
#include <complex>
#include <deque>
#include <iomanip>
#include <list>
#include <time.h>
using namespace std;
#define pi pair<int,int>
#define pl pair<long long,long long>
#define chmax(a,b) (a<b ? a=b:0)
#define chmin(a,b) (a>b ? a=b:0)
#define en cout << endl //セミコロンつけろ
//#define MM 1000000000
//#define MOD MM+7
const int MM = 1e9;
const int MOD = MM+7;
const long double PI = acos(-1);
const long long INF = 1e15;
int dx[8] = {-1,0,1,0,-1,-1,1,1};
int dy[8] = {0,-1,0,1,-1,1,1,-1};
// 'A' = 65, 'Z' = 90, 'a' = 97, 'z' = 122
template<typename T>
T GCD(T u,T v){
    return v ? GCD(v,u%v) : u;
}
template<typename T>
T LCM(T x,T y){
    T gc = GCD(x,y);
    return x*y/gc;
}

long long func(long long a,long long b){
    return a/b;
}

int main(){
    int N,M; cin >> N >> M;
    int a[100010],st[100010];
    fill(st,st+100010,1);
    long long dp[100010];
    fill(dp,dp+100010,0);
    dp[0] = 1;
    for (int i = 0; i < M; i++){
        cin >> a[i];
        st[a[i]] = 0;
    }
    for (int i = 0; i < N+10; i++){
        if (st[i] == 0) continue;
        if (st[i+2] == 1){
            dp[i+2] += dp[i];
            dp[i+2] %= MOD;
        }
        if (st[i+1] == 1){
            dp[i+1] += dp[i];
            dp[i+1] %= MOD;
        }
    }
    cout << dp[N] << endl;
}





Measured memory_bytes: 1792
while true
  n = gets.to_i
  exit if n == 0
  table = {}
  for i in 1..n do
    key, value = gets.split
    table[key] = value
  end
  m = gets.to_i
  for i in 1..m do
    key = gets.strip
    print (table[key] or key)
  end
  puts
end

Measured memory_bytes: 8728
import sys
import math

def readnums():
    for line in sys.stdin:
        yield map(int,line.split(','))

[x,y] = [0.0,0.0]
degree = 90
for [steps,delta_d] in readnums():
    if steps == 0 and degree == 0:
        break
    phi = math.radians(degree)
    x += steps*math.cos(phi)
    y += steps*math.sin(phi)
    degree -= delta_d
print int(x)
print int(y)

Measured memory_bytes: 4424
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#include <iomanip>
#include <numeric>
#include <unordered_map>
#include <sstream>   
#include<limits.h>
#include<float.h>
#include<list>
#include <array>
#include <complex>
using namespace std;
#define i64  long long
#define int  long long
 
#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807LL
#define I64_MAX2 1223372036854775807LL
#define INF I64_MAX2
#define MOD 1000000007
#define MEM_SIZE 10000
#define DEBUG_OUT true

// int DP[MEM_SIZE][MEM_SIZE] = {0};
// int GMEM[MEM_SIZE][MEM_SIZE] = {0};
template<typename T> void DEBUG(T e){if(DEBUG_OUT == false)return;std::cout << e << std::endl;}
template<class T> void DEBUG(string str, T e){if(DEBUG_OUT == false)return;std::cout <<str << ">>" << e << std::endl;}
template<typename T> void DEBUG(const std::vector<T>& v){if(DEBUG_OUT == false)return;for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void DEBUG(const std::vector<std::vector<T> >& vv){if(DEBUG_OUT == 1)return;for(const auto& v : vv){ DEBUG(v); } }
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; exit(0);}}
template< typename T1, typename T2 > inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template< typename T1, typename T2 > inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }
template<typename T> void SORT_(std::vector<T>& v,bool GREATER = 0){if(GREATER == 0)sort(v.begin(),v.end());else{sort(v.begin(),v.end(),std::greater<T>());}}

//CODE
void solve(void)
{
  int N;
  cin>>N;
  vector<int> data(N);
  for (int i = 0; i < N; i++)
  {
    cin>>data[i];
  }

  int ANS = 0;
  ANS += data[0]/2;
  data[0] = data[0]%2;

  for (int i = 1; i < N; i++)
  {
    if(data[i-1] > 0 && data[i] > 0)
    {
      ANS++;
      data[i-1] --;
      data[i] --;
    }
    ANS += data[i]/2;
    data[i] %= 2;
  }
  cout<<ANS<<endl;
  

  
  
  return;
}


int32_t main(int32_t argc, const char *argv[])
{
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);

  std::cout << std::fixed;
  std::cout << std::setprecision(9);
  solve();

 
  return 0;
}

Measured memory_bytes: 1152
def solve(n, m):
    if n == m:
        return "Yes"
    else:
        return "No"


def main():
    n, m = map(int, input().split())
    res = solve(n, m)
    print(res)


def test():
    assert solve(3, 3) == "Yes"
    assert solve(3, 2) == "No"
    assert solve(1, 1) == "Yes"


if __name__ == "__main__":
    test()
    main()


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
using vb = vector<bool>;
using vc = vector<char>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvc = vector<vector<char>>;
using pii = pair<int, int>;
#define rep(i,n) for(int i=0; i<(int)(n);i++)

long gcd(long a,long b){
  if(a < b) swap(a,b);
  long r = a % b;
  while(r > 0){
    a = b;
    b = r;
    r = a % b;
  }
  return b;
}

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

Measured memory_bytes: 1024
#include <stdio.h>
#define N 100005
  
int A[N];
 
int Partition(int *,int,int);
 
int main(){
    int n,i,x;
      
    scanf("%d",&n);
      
    for(i=0;i<n;i++){
        scanf("%d",&A[i]);
    }
      
      
    x=Partition(A,0,n-1);
      
    for(i=0;i<x;i++){
        printf("%d ",A[i]);
    }
    printf("[%d] ",A[x]);
      
    for(i=x+1;i<n-1;i++){
        printf("%d ",A[i]);
    }
    printf("%d\n",A[n-1]);
      
    return 0;
}
 
int Partition(int A[],int p,int r){
    int x,i,j,tmp;
      
    x=A[r];
    i = p-1;
      
    for(j=p;j<r;j++){
        if (A[j] <= x){
            i=i+1;
            tmp=A[j];
            A[j]=A[i];
            A[i]=tmp;
        }
    }
  
        tmp=A[i+1];
        A[i+1]=A[r];
        A[r]=tmp;
      
    return i+1;
}

Measured memory_bytes: 2996
#include <iostream>
#include <queue>
#include <memory.h>

using namespace std;

const int LIM = 120;
char m[LIM][LIM];
bool vis[LIM][LIM];
int R, C;

struct node {
    int r, c;
} DIR[] = {{1, 0}, {-1, 0}, {0, 1}, {0, -1}};

void bfs(const int & r, const int & c, char ch) {
    queue<node> q;
    node crt = {r, c};
    vis[r][c] = true;
    q.push(crt);
    while (!q.empty()) {
        crt = q.front();
        q.pop();

        m[crt.r][crt.c] = '!';

        node next;
        for (int i = 0; i < 4; i++) {
            next.r = crt.r + DIR[i].r;
            next.c = crt.c + DIR[i].c;
            if (!vis[next.r][next.c] && m[next.r][next.c] == ch && next.r >= 0 && next.r < R && next.c >= 0 && next.c < C) {
                vis[next.r][next.c] = true;
                q.push(next);
            }
        }
    }
}

int main(void) {
    while (~scanf("%d%d", &R, &C) && R && C) {
        int cnt = 0;
        getchar();
        memset(vis, false, sizeof vis);
        for (int i = 0; i < R; i++)
            fgets(m[i], LIM, stdin);

        for (int i = 0; i < R; i++)
            for (int j = 0; j < C; j++)
                if (m[i][j] != '!') {
                    cnt++;
                    bfs(i, j, m[i][j]);
                }
        printf("%d\n", cnt);
    }
    return 0;
}


Measured memory_bytes: 3212
N, M = map(int, input().split())
list=[int(i) for i in input().split()]

vote = 0


for v in list :
    vote = vote + v

judge = vote / (4 * M)

pop = 0
for x in range(0, N) :
    if list[x] >= judge :
        pop = pop + 1

if pop >= M :
    print("Yes")
else :
    print("No")



Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
 
int n, dp[10010] = {1};
 
int main(){
    scanf("%d", &n);
    for(int i = 0, x; i < n; i++){
        scanf("%d", &x);
        for(int j = 9999; j >= x; j--) dp[j] |= dp[j - x];
    }
    for(int i = 9999; i >= 0; i--) if((i + !i) % 10 && dp[i]){ printf("%d\n", i); break; }
}

Measured memory_bytes: 256
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Threading.Tasks;

namespace AtCorder
{
	public class Program
	{
		static void Main(string[] args)
		{
			int k = int.Parse(Console.ReadLine());
			long[] a = Console.ReadLine().Split(' ').Select(long.Parse).ToArray();

			long max = 2;
			long min = 2;
			for (long i = k - 1; i >= 0; --i) {
				long r = min % a[i];
				if (r != 0 && (max - min < a[i] - r)) {
					Console.WriteLine(-1);
					return;
				}

				min = (min + a[i] - 1) / a[i] * a[i];
				max = (max / a[i] * a[i]) + (a[i] - 1);
			}

			Console.WriteLine($"{min} {max}");
		}
	}
}

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

int main()
{
  int N, Sum;
  cin >> N;
  vector<int> A(N), B(N);
  rep(i, N){
    cin >> A.at(i);
    if(i>0) A.at(i)+=A.at(i-1);
  }
  rep(i, N){
    cin >> B.at(i);
    if(i>0) B.at(i)+=B.at(i-1);
  }
  Sum=A.at(0)+B.at(N-1);
  rep(i,N-1) Sum=max(Sum, A.at(i+1)+B.at(N-1)-B.at(i));
  cout << Sum << endl;
}

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

int main() {
	long long int q, h, s, d, n;
	cin >> q >> h >> s >> d >> n;
	long long int m3 = 10000000000;
	long long int m4 = 10000000000;
	long long int t[4];
	long long int nedan;
	t[0] = q*8;
	t[1] = h*4;
	t[2] = s*2;
	t[3] = d;
	for (int i= 0;i<3;i++){
		if(t[i] < m3) m3 = t[i];
	}
	if(t[3]<m3) m4 = t[3];
	else m4 = m3;
	
	if(n%2==0){
		nedan = m4 * n / 2;
	}
	
	else if(m4 == m3){
		nedan = m3 * n / 2;
	}
	else {
		nedan = m4 * (n-1) / 2 + m3 /2;
	}
	
	
	cout << nedan << endl;
	
	return 0;
}

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

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            string T = Console.ReadLine();
            string P = Console.ReadLine();

            StringBuilder sb = new StringBuilder();

            int lenP = P.Length;
            int searchLen = T.Length - lenP;

            for (int i = 0; i <= searchLen; i++)
            {
                if (T.Substring(i, lenP) == P) sb.AppendLine(i.ToString());
            }
            Console.Write(sb);
        }
    }
}

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

int main(){
    int n;
    cin >> n;
    vector<int> a(n), b(n), diff(n);
    for(int i = 0; i < n; i++){
        cin >> a[i];
    }
    int minus = 0;
    for(int i = 0; i < n; i++){
        cin >> b[i];
        diff[i] = a[i] - b[i];
        if(diff[i] < 0){
            minus += diff[i];
        }
    }
    sort(diff.begin(), diff.end());
    vector<bool> changed(n, false);
    int i = 0, j = n-1;
    while(diff[i] < 0){
        if(diff[j] < 0){
            cout << -1 << endl;
            return 0;
        }
        if(-diff[i] <= diff[j]){
            diff[j] += diff[i];
            changed[i] = changed[j] = true;
            i++;
        } else {
            diff[i] += diff[j];
            changed[i] = changed[j] = true;
            j--;
        }
    }
    int ans = 0;
    for(int i = 0; i < n; i++){
        ans += changed[i];
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 4468
#include<iostream>
#include<iomanip>
#include<cstdio>
#include<algorithm>
#include<math.h>
#include <string.h>
using namespace std;
int main(){
	int i,j,m,n,a,b;
	string s;
	while(cin>>s){
		n=s.length();
		for(i=0;i<n;i++){
			if(s[i]=='Z'){
				b=i;
			}
		}
		for(i=0;i<n;i++){
			if(s[i]=='A'){
				a=i;
				break;
			}
		}
		cout<<b-a+1<<endl;
	} 
	return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define ll long long
const int INF = 1000 * 1000 * 1000;
const ll LINF = (ll)INF * INF;
int A , B;
int d[11][11];
int f[101][101];
int dist[202];

int main()
{
	//freopen("input.txt" , "r" , stdin);
	//freopen("output.txt" , "w" , stdout);
	cin >> A >> B;
	for(int i = 1; i <= A; i++)
		for(int j = 1; j <= B; j++)
		{
			cin >> d[i][j];
		}
	for(int a = 0; a <= 100; a++)
		for(int b = 0; b <= 100; b++)
		{
			for(int x = 1; x <= A; x++)
				for(int y = 1; y <= B; y++)
				{
					f[a][b] = max(f[a][b] , d[x][y] - x * a - y * b);
				}
		}
	bool good = true;
	for(int x = 1; x <= A; x++)
		for(int y = 1; y <= B; y++)
		{
			for(int i = 0; i < 202; i++)
				dist[i] = INF;
			for(int i = 0; i <= 100; i++)
				dist[i] = x * i;
			for(int i = 100; i >= 0; i--)
			{
				if(i != 100)
					dist[i + 101] = dist[i + 1 + 101] + y;
				for(int j = 0; j <= 100; j++)
					dist[i + 101] = min(dist[i + 101] , f[j][i] + dist[j]);
			}
			if(dist[101] != d[x][y])
				good = false;
		}

	if(good)
	{
		printf("Possible\n");
		int n = 202;
		printf("%d %d\n" , n ,  (n - 2) + n * n / 4);
		for(int i = 1; i <= 100; i++)
		{
			printf("%d %d X\n" , i - 1 + 1 , i + 1);
			printf("%d %d Y\n" , i + 101 + 1 , i + 101 - 1 + 1);
		}
		for(int i = 0; i <= 100; i++)
		{
			for(int j = 0; j <= 100; j++)
			{
				printf("%d %d %d\n" , i + 1 , j + 101 + 1 , f[i][j]);
			}
		}
		printf("1 102\n");
	}
	else
		printf("Impossible\n");
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
 
using namespace std;
 
int main()
{
	int N, A, B; 
	cin >> N >> A >> B; 
	int a = 0, b = 0, c = 0; 
	for(int i = 0; i < N; i++){
		int p; 
		cin >> p; 
		if(p <= A) 
			a++;
		else if(p <= B) 
			b++;
		else 
			c++;
	}
	cout << min({a, b, c}) << endl; 
}

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

using namespace std;

int main(int argc, char *argv[]){
	string s;
	string p;
	getline(cin, s);
	getline(cin, p);
	string s2 = s + s;
	if (s2.find(p) == string::npos){
		cout << "No\n";
	} else {
		cout << "Yes\n";
	}
	return 0;
}

Measured memory_bytes: 3204
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using static System.Console;

class Program
{
    static void Main(string[] args)
    {
        var HW = ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();
        var (H, W) = (HW[0], HW[1]);
        var hw = ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();
        var (h, w) = (hw[0], hw[1]);

        var ans = (H - h) * (W - w);

        WriteLine(ans);
    }
}


Measured memory_bytes: 28280
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define VSORT(v) sort(v.begin(), v.end())
#define VRSORT(v) sort(v.rbegin(), v.rend())
#define ll long long
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;
//typedef vector<unsigned int>vec;
typedef vector<ll>vec;
typedef vector<vec> mat;
typedef vector<vector<int>> Graph;

const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const int INF = 1000000000;
const ll LINF = 1000000000000000000;//1e18
const ll  MOD = 1000000007;
//const ll MOD = 998244353;
const double PI = acos(-1.0);
const double EPS = 1e-10;

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; }
template<class T> inline void add(T &a, T b){a = ((a+b) % MOD + MOD) % MOD;};

ll dist[333][333];
ll hokyu[333][333];
ll A[101010], B[101010], C[101010];

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, M, L, Q;
    cin >> N >> M >> L;
    REP(i,N){
        REP(j,N){
            dist[i][j] = LINF;
            hokyu[i][j] = LINF;
        }
        dist[i][i] = 0;
        hokyu[i][i] = 0;
    }
    REP(i,M){
        cin >> A[i] >> B[i] >> C[i];
        --A[i], --B[i];
        chmin(dist[A[i]][B[i]], C[i]);
        chmin(dist[B[i]][A[i]], C[i]);
    }
    cin >> Q;
    REP(k,N) REP(i,N) REP(j,N) chmin(dist[i][j], dist[i][k] + dist[k][j]);
    REP(i,N) REP(j,N){
        if(i == j) continue;
        if(dist[i][j] <= L) chmin(hokyu[i][j], 1LL);
    }
    REP(k,N) REP(i,N) REP(j,N) chmin(hokyu[i][j], hokyu[i][k] + hokyu[k][j]);

    REP(i,Q){
        ll t, s;
        cin >> t >> s;
        --t, --s;
        if(hokyu[t][s] < LINF) cout << hokyu[t][s] - 1 << endl;
        else cout << -1 << endl;
    }
}


Measured memory_bytes: 3584
# an = list(map(int, input().split()))
# n, m = map(int, input().split())
# n = int(input())

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

def endsub():
  print('No')
  exit()

same = False
for i in range(n-1):
  if not same:
    an[i] -= 1
  if an[i] > an[i+1]:
    endsub()
  elif an[i] == an[i+1]:
    same = True
  else:
    same = False
print('Yes')
  

Measured memory_bytes: 14396
#include <iostream>
#include <string>

int main()
{
    int n;
    std::cin >> n;
    std::string s;
    std::cin >> s;
    int x = 0;
    int maxv = 0;
    for(int i = 0; i < n; i++){
        if(s[i] == 'I') x += 1;
        else x -= 1;
        maxv = std::max(maxv,x);
    }
    std::cout << maxv;
    return 0;
}




Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int MX=200010, inf=2e9;

int n, A[MX], pos[MX], bck[MX];

int main(){
    ios::sync_with_stdio(0); cin.tie(0);
    cin>>n;
    for(int i=1; i<=n; i++) cin>>A[i], pos[A[i]]=i;
    bck[n]=1;
    for(int i=n-1; i>=1; i--){
        if(pos[i+1]>pos[i]) bck[i]=bck[i+1]+1;
        else bck[i]=1;
    }
    int mx=0;
    for(int i=1; i<=n; i++) mx=max(mx, bck[i]);
    cout<<n-mx;
    return 0;
}

Measured memory_bytes: 2560
#pragma GCC optimize(2)
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
	ios::sync_with_stdio(0);
	ll n,cnt[5]={0},ans;
	string s;
	cin>>n;
	while(n--)
	{
		cin>>s;
		switch(s[0]){case 'M':cnt[0]++;break;case 'A':cnt[1]++;break;case 'R':cnt[2]++;break;case 'C':cnt[3]++;break;case 'H':cnt[4]++;break;}
	}
	ans+=cnt[0]*cnt[1]*cnt[2];
	ans+=cnt[0]*cnt[1]*cnt[3];
	ans+=cnt[0]*cnt[1]*cnt[4];
	ans+=cnt[1]*cnt[2]*cnt[3];
	ans+=cnt[1]*cnt[2]*cnt[4];
	ans+=cnt[1]*cnt[3]*cnt[4];
	ans+=cnt[0]*cnt[2]*cnt[3];
	ans+=cnt[0]*cnt[2]*cnt[4];
	ans+=cnt[0]*cnt[3]*cnt[4];
	ans+=cnt[2]*cnt[3]*cnt[4];
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define watch(x) cout << (#x) << " is " << (x) << endl
typedef long long ll;
using namespace std;
int static fast = [](){
  ios::sync_with_stdio(false);
  cin.tie(0); cout.tie(0); return 0;
}();

int main() {
    int a, b, k;
    cin >> a >> b >> k;
    int gcd = __gcd(a, b);
    vector<int> fac;
    for(int i = 1; i <= gcd; i++) {
        if (gcd % i == 0)
            fac.push_back(i);
    }
    cout << fac[fac.size()-k] << endl;
    return 0;

}




Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
    int n,m;
    cin >>n;
    vector<string>s(n);
    for(int i=0;i<n;i++){
        cin>>s[i];
    }
    cin>>m;
    vector<string>t(m);
    for(int i=0;i<m;i++){
        cin>>t[i];
    }

    int count=0;
    int max=0;

    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            if(s[i]==s[j]){
                count++;
            }
        }
        for(int j=0;j<m;j++){
            if(s[i]==t[j]){
                count--;
            }
        }

        if(max<count){
            max=count;
        }
        count=0;
    }
    cout<<max<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#include <math.h>
#include <iomanip>
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int INF=1001001001;
vector<pair<int64_t,int64_t>>prime_factorize(int64_t x){
  vector<pair<int64_t,int64_t>>p;
  for(int64_t i=2;i*i<=x;i++){
    int cnt=0;
    if(x%i==0){
    while(x%i==0){cnt++;x/=i;}
    p.push_back(make_pair(i,cnt));
    }
  }
  if(x!=1){p.push_back(make_pair(x,1));}
  return p; 
}
const int MOD=1000000007;

int main() {
  int N,X;
  cin>>N>>X;
  vector<int>L(N+1);
  for(int i=1;i<=N;i++){
    cin>>L[i];
  }
  vector<int>D(N+2);
  int cnt=0;
  for(int i=1;i<=N+1;i++){
    if(i>=2){D[i]=D[i-1]+L[i-1];}
    if(D[i]<=X){cnt++;}
  }
  cout<<cnt<<endl;
  return 0;
}

Measured memory_bytes: 3572
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <vector>
#include <list>
#include <set>
#include <utility> // pair
#include <map>
#include <iostream>
#include <sstream>
#include <algorithm> // sort
#include <string>
#include <stack>
#include <queue>
#include <fstream>
#include <bitset>
#include <iomanip>
#include <cmath>
#define PI acos(-1)
typedef long long ll;
const long long mod = 998244353;
const long long maxn = 1e7 + 5; 
const int INF = 0x3f3f3f3f;
const ll inf = 0x3f3f3f3f3f3f3f3f;
using namespace std;

int main()
{
	double a, b, h, m;
	cin >> a >> b >> h >> m;
	double t = abs(h * 30 + 0.5 * m - m * 6); //cout << t << endl; 
	double x = 2 * PI * (t / 360);	//cout << cos(x) << endl;
	double c = a * a + b * b - 2 * a * b * cos(x);
	//cout << c << endl;
	printf("%.19f\n",sqrt(c));
	return 0;
}

Measured memory_bytes: 3656
#include "bits/stdc++.h"
using namespace std;

// GNU C Compiler
//template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }

// type
using ll = int_fast64_t;
using ull = uint_fast64_t;
using LL = long long;
using ULL = unsigned long long;
using PII = pair<int, int>;
//using pair<T1, T2> = p12;

//container
#define PB emplace_back
#define MP make_pair 
#define SZ(a) int((a).size())
#define ALL(v) v.begin(),v.end()

//repetition
#define REP(n) for(ll i=0; i<(n); i++)
#define REPj(n) for(ll j=0; j<(n); j++)
#define REPinit(i,a,n) for(int i=(a); i<(n); i++)
#define REPinitj(j,a,n) for(int j=(a); j<(n); j++)

//algorithm
#define SORT(c) sort((c).begin(),(c).end())
#define CONTAINER_ALL(a) a.begin(),a.end()

//constant

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

//Optimizer
// #pragma GCC optimize("Ofast")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

//std out
template<typename T>
void print_container(const vector<T> vals) {
    REPinit(i, 0, vals.size() - 1) cout << vals.at(i) << " ";
    cout << vals.back();
}


bool judge(int a, int b, int c) {
    if ((a > b && b > c) || (a < b && b < c)) return true;
    return false;
}

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

    int a;
    cin >> a;
    string s;
    cin >> s;

    if (a < 3200) cout << "red";
    else cout << s;

    return 0;
}


Measured memory_bytes: 3616
#include <bits/stdc++.h>
using namespace std;
#define sd(x) scanf("%d", &x)
#define sz(v) (int) v.size()
#define pr(v) For(i, 0, sz(v)) {cout<<v[i]<<" ";} cout<<endl;
#define slld(x) scanf("%lld", &x)
#define all(x) x.begin(), x.end()
#define For(i, st, en) for(ll i=st; i<en; i++)
#define tr(x) for(auto it=x.begin(); it!=x.end(); it++)
#define fast std::ios::sync_with_stdio(false);cin.tie(NULL);
#define pb push_back
#define ll long long
#define int long long
#define mp make_pair
#define F first
#define S second
typedef pair<int, int> pii;
#define MOD 1000000007
#define INF 1000000000000000007
#define MAXN 200005
 
// it's swapnil07 ;)


signed main(){
    fast
    #ifdef SWAPNIL07
        freopen("/home/swapnil/Desktop/c++/input.txt","r",stdin);
        freopen("/home/swapnil/Desktop/c++/output.txt","w",stdout);
    #endif
    int n; cin>>n;
    int h[n];
    For(i, 0, n)
        cin>>h[i];
    int dp[n];
    dp[0]=0;
    dp[1]=abs(h[1]-h[0]);
    For(i, 2, n){
        dp[i]=min(dp[i-1]+abs(h[i]-h[i-1]), dp[i-2]+abs(h[i]-h[i-2]));
    }
    cout<<dp[n-1];
    return 0;
}

Measured memory_bytes: 1920
#include<stdio.h>
#include<stdlib.h>

#define MAX 100001

typedef struct{
  int parent;
  int left;
  int right;
} Node;

Node T[MAX];

int getDepth(int);
int getHeight(int);
int Degree(int);
int Sibling(int,int);
void PrintState(int);

int main(){
  int n,i,id,r,l;

  scanf("%d",&n);

  for(i = 0; i < n; i++){
    T[i].parent = -1;
    T[i].left = -1;
    T[i].right = -1;
  }

  for(i = 0; i < n; i++){
    scanf("%d%d%d",&id ,&r ,&l);

    T[r].parent = id;
    T[l].parent = id;
    T[id].left = r;
    T[id].right = l;
  }

  for(i=0; i<n; i++) PrintState(i);

  return 0;
}

int getDepth(int x){
  if(T[x].parent == -1) return 0;
  else return 1+getDepth(T[x].parent);
}

int getHeight(int x){
  int lefth = 0, righth = 0;

  if(x == -1) return 0;

  if(T[x].left != -1) lefth = getHeight(T[x].left)+1;
  if(T[x].right != -1) righth = getHeight(T[x].right)+1;

  if(lefth > righth) return lefth;
  else return righth;

}

int Degree(int x){
  if(T[x].left != -1 && T[x].right != -1) return 2;
  else if(T[x].left != -1 || T[x].right != -1) return 1;
  else return 0;
}

int Sibling(int parent,int x){
  if(parent == -1) return -1;
  else if(T[parent].left == x)return T[parent].right;
  else return T[parent].left;
}

void PrintState(int u){
  printf("node %d: parent = %d, sibling = %d, degree = %d, depth = %d, height = %d, " ,u ,T[u].parent ,Sibling(T[u].parent,u) ,Degree(u) ,getDepth(u) ,getHeight(u));

  if(T[u].parent == -1) printf("root\n");
  else if(T[u].left == -1 && T[u].right == -1) printf("leaf\n");
  else printf("internal node\n");
}

Measured memory_bytes: 612
#include<stdio.h>

 int main(){


    int A,B,C,D,X,Y;
    scanf("%d %d %d %d",&A,&B,&C,&D);
    X=(A+D-1)/D;
     Y=(C+B-1)/B;
   if(X>=Y){
    printf("Yes");
   }
   else{
    printf("No");
   }
    return 0;
 }


Measured memory_bytes: 1704
#include <bits/stdc++.h>
 
using namespace std;
 
int a, H, x;

int main() {
	scanf("%d%d%d", &a,&H,&x);
	
	double h = double(x) / (a * a);
	
	if(h > double(H)/2) {
		printf("%lf", atan(2*(H-h)/a) * 180 / M_PI);
	} else {
		printf("%lf", atan((H*H)/(2*h*a)) * 180 / M_PI);
	}
		
	return 0;
}


Measured memory_bytes: 256
import sys
input = sys.stdin.readline

N, C = map(int, input().split())
xv = [tuple(map(int, input().split())) for _ in range(N)]
left = [0]
av = 0

for x, v in xv:
    av += v
    left.append(av-2*x)

right = [0]
av = 0

for x, v in xv[::-1]:
    av += v
    right.append(av-2*(C-x))

for i in range(1, N+1):
    left[i] = max(left[i], left[i-1])
    right[i] = max(right[i], right[i-1])

ans = 0
av = 0

for i in range(N):
    av += xv[i][1]
    ans = max(ans, av-xv[i][0]+right[N-1-i])

av = 0

for i in range(N):
    av += xv[N-1-i][1]
    ans = max(ans, av-(C-xv[N-1-i][0])+left[N-1-i])

print(ans)

Measured memory_bytes: 98772
// AOJ Volume 5 Problem 0554 Total Time

#include <stdio.h>

int main(void)
{
    int sec;
    int total;
    int i;

    total = 0;
    for (i = 0; i < 4; i++){
        scanf("%d", &sec);
        total += sec;
    }
    
    printf("%d\n%d\n", total / 60, total % 60);
    
    return (0);
}

Measured memory_bytes: 596
// https://atcoder.jp/contests/abc152/tasks/abc152_b

#include <bits/stdc++.h>
using namespace std;
int main() {
    int a, b;
    cin >> a >> b;

    for(int i = 0; i < max(a, b); i++) {
        cout << min(a, b);
    }

    cout << endl;
}

Measured memory_bytes: 256
import java.util.*;
import java.lang.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        String N = sc.nextLine();
        int Nint = Integer.parseInt(N);
        
        int[] ans = new int[100000];
        
        for (int x = 1; x <= 100; x++){
            for(int y = 1; y <= 100; y++){
                for(int z=1; z<=100; z++){
                    double i = Math.pow(x,2)+Math.pow(y,2)+Math.pow(z,2)+x*y+y*z+z*x;
                    int ii = (int)i;
                    ans[ii]++;
                }
            }
        }
        
        for(int i=1; i<Nint+1; i++){
            System.out.println(ans[i]);
        }
    }
}


Measured memory_bytes: 39284
a, b, d = gets.split.map(&:to_f)
d = 2 * Math::PI * d / 360
c = Math.sqrt(a * a + b * b - 2 * a * b * Math.cos(d))
puts "%.4f\n%.4f\n%.4f" % [a * b * Math.sin(d) / 2, a + b + c, b * Math.sin(d)]

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

int main(){
    ll N, K; cin >> N >> K;
    string S; cin >> S;
    ll ans = N-1;
    ll cnt = 0;
    rep(i,N-1){
        cnt += (S[i] == S[i+1]);
    }
    ans = min(ans, cnt+2*K);
    cout << ans << endl;
}

Measured memory_bytes: 512
//#include <bits/stdc++.h>
//#include <stdio.h>
#include<iostream>
#include<cstdio>
#include<bitset>
#include<algorithm>
#include<vector>
#include<list>
#include<queue>
#include<stack>
#include<string>
#include<string.h>
#include<cmath>
#include<utility>
#include<functional>
#include<map>
#include<set>
#include<cctype>
#include<fstream>


#define FOR(i, a, b) for( int i=(a);i<=(b);i++)
#define RFOR(i, a, b) for( int i=(a);i>=(b);i--)
#define LFOR(i, a, b) for( long long int i=(a);i<=(b);i++)
#define LRFOR(i, a, b) for(long long int i=(a);i>=(b);i--)
#define MOD 1000000007
#define INF 1000000000 //2000000000
#define LLINF 1000000000000000000 //9000000000000000000
#define PI 3.14159265358979
#define MAXI 7500000

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

int dy[5] = { 0,0,1,-1,0 };
int dx[5] = { 1,-1,0,0 ,0 };



int main(void) {
	
	int a, b, k;
	int count = 0;

	cin >> a >> b >> k;

	RFOR(i, min(a,b), 1) {
		if (a%i == 0 && b%i == 0) {
			//cout << i << endl;
			count++;
		}
		if (count == k) {
			cout << i << endl;
			break;
		}
	}




	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp> // Common file
//#include <ext/pb_ds/tree_policy.hpp> // Including seg_tree_order_statistics_node_update
#include <stdio.h>
#include <cassert>
using namespace std;
//using namespace __gnu_pbds;
typedef long long lo;
typedef pair<lo,lo> ll;//pair
typedef vector<lo> vl;  //vector of long
typedef vector<ll > vll;   //vector of pair
typedef priority_queue<lo>p_q;
typedef vector< vl > vvl;  //vector of vectors
#define X first
#define Y second
#define mp(a,b) make_pair((a),(b))
#define REP(a,b) for(lo i=(a);i<(lo)b;i++)//no need to declare variable i
#define REPE(a,b,c,d) REP(a,b)for(lo j=(c);j<(lo)d;j++)//no need to declare vaiables i,j
#define REPV(a,b,c) for(lo(a)=b;(a)<(c);(a)++)//a is the variable
#define IREP(a,b) for(lo i=(a);i>=(b);i--)
#define IREPV(a,b,c) for(lo(a)=b;(a)>=(c);(a)--)
#define all(v) (v).begin(),(v).end()
#define TRV(a) for(auto it : a)
#define INF 100001
#define MOD lo(1e17)
#define M 1000000007
#define CHECK_BIT(var,pos) ((var) & (1<<(pos)))
#define pb(a) push_back((a))
#define endl "\n"
#define eps 1e-9
#define PI 3.141592653589793
template<typename T> ostream& operator<< ( ostream &o,vector<T> v ) {
    if ( v.size() >0 )o<<v[0];
    for ( unsigned   i=1; i<v.size(); i++ )o<<" "<<v[i];
    return o<<endl;
}
template<typename U,typename V> ostream& operator<< ( ostream &o,pair<U,V> p ) {
    return o<<"("<<p.first<<", "<<p.second<<") ";
}
template<typename T> istream& operator>> ( istream &in,vector<T> &v ) {
    for ( unsigned   i=0; i<v.size(); i++ )in>>v[i];
    return in;
}
template<typename T> istream& operator>> ( istream &in,pair <T,T> &p ) {
    in>>p.X;
    in>>p.Y;
    return in;
}
int main(){
    std::ios::sync_with_stdio(false);
	cin.tie(0);cout.tie(0);cout.precision(20);
    string a;
    cin>>a;
    if(a.length()<4)cout<<"No";
    else if(a[0]=='Y' and a[1]=='A' and a[2]=='K' and a[3]=='I')cout<<"Yes";
    else cout<<"No";
    return 0;
}


Measured memory_bytes: 256
package main

import (
	"fmt"
)

func main() {

	var N int

	fmt.Scan(&N)

	A:= SliceInt(N)

	for i:=0;i<N;i++{

		fmt.Scan(&A[i])
	}


	res := make(map[int]int)

	for i:=1;i<=N;i++{

		res[A[i-1]] = i
	
	}

	for i:=1;i<=N;i++{

		val,_:= res[i]

		fmt.Println(val)

	}

}

//SliceInt 引数サイズのSliceを返す
func SliceInt(a int) []int {

	IntSample := make([]int, a)

	return IntSample

}


Measured memory_bytes: 9600
#include "bits/stdc++.h"
// Begin Header {{{
#define all(x)          (x).begin(), (x).end()
#define rep(i, n)       for (i64 i = 0, i##_limit = (n); i < i##_limit; ++i)
#define reps(i, s, t)   for (i64 i = (s), i##_limit = (t); i <= i##_limit; ++i)
#define repr(i, s, t)   for (i64 i = (s), i##_limit = (t); i >= i##_limit; --i)
#define var(Type, ...)  Type __VA_ARGS__; input(__VA_ARGS__)
#ifndef DBG
#define trace(...)
#endif
using namespace std;
using i64 = int_fast64_t;
using pii = pair<i64, i64>;
template <class T, class U> inline bool chmax(T &a, const U &b) { return b > a && (a = b, true); }
template <class T, class U> inline bool chmin(T &a, const U &b) { return b < a && (a = b, true); }
inline i64  sigma(i64 n)            { return (n * (n + 1) >> 1); }
inline i64  updiv(i64 a, i64 b)     { return (a + b - 1) / b; }
inline i64  sqr(i64 n)              { return n * n; }
inline string to_string(char c)     { return string(1, c); }
constexpr int INF  = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;

template <class T>
inline vector<T> make_v(const T &initValue, size_t sz) {
    return vector<T>(sz, initValue);
}
template <class T, class... Args>
inline auto make_v(const T &initValue, size_t sz, Args... args) {
    return vector<decltype(make_v<T>(initValue, args...))>(sz, make_v<T>(initValue, args...));
}

inline void input() {}
template <class Head, class... Tail>
inline void input(Head &head, Tail&... tail) { cin >> head; input(tail...); }

inline void print() { cout << "\n"; }
template <class Head, class... Tail>
inline void print(Head &&head, Tail&&... tail) {
    cout << head;
    if (sizeof...(tail)) cout << ' ';
    print(forward<Tail>(tail)...);
}

template <class T>
inline ostream& operator<< (ostream &out, const vector<T> &vec) {
    static constexpr const char *delim[] = { " ", "" };
    for (const auto &e : vec) out << e << delim[&e == &vec.back()];
    return out;
}

template <typename Func>
struct FixPoint : Func {
    inline constexpr FixPoint(Func &&f) noexcept : Func(forward<Func>(f)) {}

    template <typename... Args>
    inline decltype(auto) operator()(Args &&... args) const {
        return Func::operator()(*this, forward<Args>(args)...);
    }
};

template< typename Func >
inline decltype(auto) makeFixPoint(Func &&f) {
    return FixPoint< Func >{forward< Func >(f)};
}
// }}} End Header

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

    var(i64, A, B, K);
    auto a = min(A, K);
    A -= a;
    K -= a;

    auto b = min(B, K);
    B -= b;
    K -= b;
    print(A, B);

    return 0;
}


Measured memory_bytes: 256
local h, w = io.read("*n", "*n")
local n = io.read("*n")
local m = {}
for i = 1, h * w do m[i] = 0 end
local cur = 1
local mfl = math.floor
for i = 1, n do
  local cnt = io.read("*n")
  for j = cur, cur + cnt - 1 do
    local iw = (j - 1) % w
    local ih = mfl((j - 1) / w)
    if ih % 2 == 0 then
      m[ih * w + iw + 1] = i
    else
      m[ih * w + w - iw] = i
    end
  end
  cur = cur + cnt
end
for ih = 0, h - 1 do
  for iw = 1, w do
    io.write(m[ih * w + iw])
    io.write(iw == w and "\n" or " ")
  end
end


Measured memory_bytes: 640