akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define ll long long
#define mod 1000000007
#define pb push_back
#define fi first
#define se second
#define fr(i,s,e) for(i=s;i<e;i++)
#define ms(arr,val) memset(arr,val,sizeof(arr))
using namespace std;

const int mxn=2e5+1;

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

  int t=1;
//  cin>>t;
  int tt=1;
  while(t--){
    int n,d,i,j;
    cin>>n>>d;
    int arr[n][d];
    fr(i,0,n)
    {
      fr(j,0,d)
      cin>>arr[i][j];
      
   // cout<<"Case #"<<tt<<": ";
   // tt++;
    }
    int ans=0;
    fr(i,0,n)
    {
      fr(j,i+1,n)
      {
        int k;
        long double temp=0;
        fr(k,0,d)
        temp+=pow((arr[i][k]-arr[j][k]),2);
        temp=sqrt(temp);
        if(temp==(ll)(temp))
          ans++;
      }
    }
    cout<<ans;
    }
  return 0;
}



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

int main(){
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    
	ll n{0};
	cin>>n;

	string str;
	cin>>str;

	ll red{0};
	ll white{0};
	for(ll i=0;i<n;i++){
		if(str[i]=='R')
			red++;
		else
			white++;
	}

/*As we want all the reds at the starting of the string,So counting how many whites we have to replace so that given numbers of red 
in the original string can come at the starting of the string.*/ 
	ll ans1{0};
	for(ll i=0;i<red;i++){
		if(str[i]=='W')
			ans1++;
	}

/*As we want all the whites at ending of the string,So counting how many reds we have to replace so that given numbers of white in 
the original string can come at the ending of the string*/
	ll ans2{0};
	for(ll i=red;i<n;i++){
		if(str[i]=='R')
			ans2++;
	}

	ll answer=max(ans1,ans2);

	cout<<answer<<endl;

	return 0;
}



Measured memory_bytes: 3772
#define _CRT_SECURE_NO_WARNINGS
#pragma target("avx")
#pragma optimize("O3")
#pragma optimize("unroll-loops")
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define REP(i,n) for(int i=1;i<=(int)(n);i++)
#define all(V) V.begin(),V.end()
typedef long long lint;
typedef std::pair<lint, lint> P;
constexpr int INF = INT_MAX / 2;
constexpr lint LINF = LLONG_MAX / 2;
constexpr double eps = 1e-9;
template<class T>
class prique :public std::priority_queue<T, std::vector<T>, std::greater<T>> {};
template <class T, class U>
inline bool chmax(T& lhs, const U& rhs) {
	if (lhs < rhs) {
		lhs = rhs;
		return 1;
	}
	return 0;
}
template <class T, class U>
inline bool chmin(T& lhs, const U& rhs) {
	if (lhs > rhs) {
		lhs = rhs;
		return 1;
	}
	return 0;
}
inline lint gcd(lint a, lint b) {
	while (b) {
		lint c = a;
		a = b; b = c % b;
	}
	return a;
}
inline lint lcm(lint a, lint b) {
	return a / gcd(a, b) * b;
}
bool isprime(lint n) {
	if (n == 1)return false;
	for (int i = 2; i * i <= n; i++) {
		if (n % i == 0)return false;
	}
	return true;
}
lint mypow(lint a, lint b) {
	if (!b)return 1;
	if (b & 1)return mypow(a, b - 1) * a;
	lint memo = mypow(a, b >> 1);
	return memo * memo;
}
lint modpow(lint a, lint b, lint m) {
	if (!b)return 1;
	if (b & 1)return modpow(a, b - 1, m) * a % m;
	lint memo = modpow(a, b >> 1, m);
	return memo * memo % m;
}
template<typename T>
void printArray(std::vector<T>& vec) {
	rep(i, vec.size() - 1)std::cout << vec[i] << " ";
	std::cout << vec.back() << std::endl;
}
template<typename T>
void printArray(T l, T r) {
	T rprev = r;
	rprev--;
	for (T i = l; i != rprev; i++) {
		std::cout << *i << " ";
	}
	std::cout << *rprev << std::endl;
}
std::string to_string(std::vector<int>& vec) {
	std::string res = "[";
	rep(i, vec.size() - 1)res += std::to_string(vec[i]) + ", ";
	res += std::to_string(vec.back()) + "]";
	return res;
}
int n,h[110],a[110];
int main() {
	std::cin>>n;
	rep(i,n)std::cin>>h[i];
	int ans=0;
	while(true){
		int l=-1,r=n-1;
		rep(i,n){
			if(l==-1&&a[i]<h[i]){
				l=i;
			}
			if(l!=-1&&a[i]>=h[i]){
				r=i-1;
				break;
			}
		}
		if(l==-1)break;
		for(int i=l;i<=r;i++)a[i]++;
		ans++;
	}
	std::cout<<ans<<std::endl;
	return 0;
}

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

typedef long long ll;

int n;
int a[405];
ll pre[405];
ll dp[405][405];

inline ll sum(int l,int r){
    return pre[r]-pre[l-1];
}

int main(){

    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    cin>>n;
    memset(dp,0x3f,sizeof(dp));
    for(int i=1;i<=n;i++){
        cin>>a[i];
        pre[i]=pre[i-1]+a[i];
        dp[i][i]=0;
    }
    for(int i=n;i>=1;i--){
        for(int j=i+1;j<=n;j++){
            for(int k=i;k<j;k++){
                dp[i][j]=min(dp[i][j],dp[i][k]+dp[k+1][j]+sum(i,j));
            }
        }
    }
    cout<<dp[1][n]<<endl;

    return 0;
}

Measured memory_bytes: 1536
#include <bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
template<typename key>
using ordered_set = tree<key, null_type, less<key>, rb_tree_tag, tree_order_statistics_node_update>;
#define F first
#define S second
#define T second.first
#define C second.second
#define FIO ios_base::sync_with_stdio(0);cin.tie(0);
#define all(v) v.begin(),v.end()
#define OO 0x3f3f3f3fLL
#define INF 0x3f3f3f3f3f3f3f3fLL
#define sz(s) (int)(s.size())
#define RT(s) return cout<<s,0
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pii;
typedef pair<ll,pair<ll,ll>> piii;
const int N = 4e5+5, M= 20, mod = 998244353;
const double EPS = 1e-10;



int main(){
    FIO
//    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);
    double n, d;
    cin>>n>>d;
    long double x,y;
    int ans = 0;
    for(int i=0; i<n; i++){
        cin>>x>>y;

        long double dis = sqrt(x*x + y*y);
        if(dis<=d){
            ans++;
        }
    }
    cout<<ans;
}


Measured memory_bytes: 3860
#include<iostream>
#include<cstdio>
#include<cmath>
#include<algorithm>
using namespace std;

int n;
long long sum;
struct sdt
{
	long long a,b;
}a[100005];

int main()
{
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		cin>>a[i].a>>a[i].b;
	}
	
	for(int i=n;i>=1;i--)
	{
		a[i].a+=sum;
		if(a[i].a%a[i].b==0)continue;
		else sum+=(a[i].a/a[i].b+1)*a[i].b-a[i].a;
	}
	
	cout<<sum<<endl;
	return 0;
}

Measured memory_bytes: 1792
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using System.Text;
using System.IO;
using static System.Math;
namespace AtCoder
{
    class Program
    {
        static public long[] Sarray() { return ReadLine().Split().Select(long.Parse).ToArray(); }
        static public List<long> Slist() { return ReadLine().Split().Select(long.Parse).ToList(); }
        static long Mod = (long)1e9 + 7;
        static void Main(string[] args)
        {
            //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
            var N = Sarray()[0];
            var S = new string[2];
            S[0] = ReadLine();
            S[1] = ReadLine();
            var ans = 1L;
            var pre = -1;
            var tate = 1;
            var yoko = 2;
            for (var i = 0; i < N; ++i)
            {
                //縦
                if (S[0][i] == S[1][i])
                {
                    if (i == 0)
                    {
                        ans = 3;
                        pre = tate;
                        continue;
                    }
                    if (pre == tate)//前が縦なら2色
                        ans = (ans * 2) % Mod;
                    else//前が横なら1色に決まる
                    { }
                    pre = tate;
                }//横
                else
                {
                    if (i == 0)
                    {
                        ans = 3 * 2;
                        pre = yoko;
                        ++i;
                        continue;
                    }
                    if (pre == tate)//前が縦なら2色
                        ans = (ans * 2) % Mod;
                    else//前が横なら3通り
                        ans = (ans * 3) % Mod;
                    pre = yoko;
                    ++i;
                }
            }
            WriteLine(ans);
            //Out.Flush();
        }
    }
}

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

#define vec                vector<int>
#define vecll              vector<ll>
#define vecd               vector<double>
#define vecst              vector<string>
#define vecb               vector<bool>
#define vec2(var, n, m)    vector<vector<int>> var(n, vector<int>(m, 0))
#define vecll2(var, n, m)  vector<vector<ll>> var(n, vector<ll>(m, 0))

#define rep(i,n)         for(ll i=(ll)0; i<(ll)n; i++)
#define REP(i,m,n)       for(ll i=(ll)m; i<(ll)n; i++)
#define arr(var, n)      vec var(n); rep(i,n){cin >> var[i];}
#define arrll(var, n)    vecll var(n); rep(i,n){cin >> var[i];}
#define arrst(var, n)    vecst var(n); rep(i,n){cin >> var[i];}
#define all(var)         (var).begin(), (var).end()
#define sortall(var)     sort(all(var))
#define uniqueall(v)     v.erase(unique(v.begin(), v.end()), v.end());
#define f_sum(var)       accumulate(all(var), 0)
#define f_sumll(var)     accumulate(all(var), 0LL)
#define chmin(v1, v2)    v1 = min(v1, v2)
#define chmax(v1, v2)    v1 = max(v1, v2)
#define pb(var)          push_back(var)
#define prt(var)         cout << (var) << "\n"
#define prtd(n, var)     cout << fixed << setprecision(n) << (var) << "\n"
#define prtfill(n, var)  cout << setw(n) << setfill('0') << (var);
#define prt2(v1, v2)     cout << (v1) << " " << (v2) << "\n"
#define prt3(v1, v2, v3) cout << (v1) << " " << (v2) << " " << (v3) << "\n"
#define prtall(v)        rep(i,v.size()){cout<<v[i]<<(i!=v.size()-1?" ":"\n");}
void prtok(bool ok){prt(ok ? "Yes" : "No");}
//----------------------------------------------------------------

int main(void) {
  int n;
  cin >> n;
  arrst(s,n);

  map<string, int> mp;
  rep(i,n){
    mp[s[i]]++;
  }
  int mx=0;
  for(auto tmp : mp){
    chmax(mx, tmp.second);
  }
  for(auto tmp : mp){
    if(tmp.second==mx) prt(tmp.first);
  }

}


Measured memory_bytes: 25068
use proconio::{input, fastout};
use proconio::marker::Chars;

#[fastout]
fn main() {
    input! {
        s: Chars,
        t: Chars,
    }

    let mut ans: u32 = 0;
    for i in 0..s.len() {
        if s[i] != t[i] {
            ans += 1;
        }
    }
    println!("{}", ans);
}


Measured memory_bytes: 4032
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
int main(void){
    long int a,b,n,i,owari;
    long int ans=0;
    scanf("%ld %ld %ld",&a,&b,&n);
    if(b>n)owari=n;
    else owari=b-1;
    ans = floor(a*owari/b) - a*floor(owari/b);
    printf("%ld",ans);
    return 0;
}

Measured memory_bytes: 1732
N = 10**5
p = [0]*(N+1)
p[2] = 1
primes = [2]

for i in range(3,N+1):
  f = 1
  for t in primes:
    if t*t > i:
      break
    if i%t == 0:
      f = 0
      break
  if f == 1:
    primes.append(i)
    p[i] = 1
    if p[(i+1)//2] >= 1:
      p[i] = 2

m = 0
s = [0]*(N+1)
for i in range(1,N+1):
  m += (p[i]==2)
  s[i] = m
  
for i in range(int(input())):
  l,r = map(int,input().split())
  print(s[r]-s[l-1])

Measured memory_bytes: 9276
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int K = sc.nextInt();

        int max = (int) java.lang.Math.ceil(N / 2.0);
        if (K <= max) {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }
    }

}

Measured memory_bytes: 22996
#include <iostream>
#include <algorithm>
#include <vector>
#include <stack>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <string>
#include <cstdio>
#include <queue>
using namespace std;

class point_t{
public:
  //?????????????????§public???
  double x, y, rad;


  point_t(double x, double y, double rad): x(x), y(y), rad(rad)
  {
    //x = cos(rad / 360.0 * 2 * M_PI);
    //y = sin(rad / 360.0 * 2 * M_PI);
  }
  void print(){cout << fixed << setprecision(10) << x << " " << y << endl;}
};

void rec(point_t t1, point_t t2, int n){
  if(n==0)  return;
  double lx = t1.x, ly = t1.y;
  double rx = t2.x, ry = t2.y;
  double th = M_PI * 60 / 180.0;

    //s
  point_t p1((2*lx+rx)/3.0, (2*ly+ry)/3.0, t1.rad + 60);
    //t
  point_t p2((lx+rx*2)/3.0, (ly+ry*2)/3.0, t1.rad);
    //u
  point_t p3((p2.x - p1.x) * cos(th) - (p2.y - p1.y) * sin(th) + p1.x, 
    (p2.x - p1.x) * sin(th) + (p2.y - p1.y) * cos(th) + p1.y, t1.rad - 60);

  rec(t1, p1, n-1);
  p1.print();
  rec(p1, p3, n-1);
  p3.print();
  rec(p3, p2, n-1);
  p2.print();
  rec(p2, t2, n-1);
}

int main(void){
  int n;
  cin >> n;
  point_t t1(0, 0, 0);
  point_t t2(100, 0, 0);

  t1.print();
  rec(t1, t2, n);
  t2.print();
  
  return 0;
}

Measured memory_bytes: 1248
#include<cstdio>
#include<iostream>

using namespace std;
const int INF=0x7fffffff;

int main(){
	int wa,wb,sc,sd,e,f;
	cin>>wa>>wb>>sc>>sd>>e>>f; 
	double mx=-INF,tot,s; 
	for(int i=0;i<=f/100;i++){
		for(int j=0;j<=f/100-i;j++){
			int x=wa*100*i+wb*100*j;
			int sugar=x*1.0/100*e;
			sugar=min(sugar,f-x);//最多可以放多少糖 
			if(sugar<0){
				continue;
			}
			for(int k=0;k<=sugar/sc;k++){
				for(int m=0;m<=(sugar-k*sc)/sd;m++){
					int s1=sc*k+sd*m;
					if(x+s1>f)	continue;
					if( (s1*1.0/(s1+x)) >mx){
						tot=s1+x;
						s=s1;
						mx=s1*1.0/(s1+x);
					}
				}
			}
		}
	}
	cout<<tot<<" "<<s<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int l,r,k,p;
int main(){
	cin>>l>>r;
	k=l%2019;
	p=k;
	k=l+2019-k;
	if(k<=r)puts("0");
	else {
		l=l%2019,r=r%2019;
		int ans=2020;
		for(int i=l;i<=r;i++)
			for(int j=i+1;j<=r;j++)ans=min(ans,i*j%2019);
		printf("%d",ans);
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define ll              long long
#define pb              push_back
#define ppb             pop_back
#define endl            '\n'
#define mii             map<ll,ll>
#define pii             pair<ll,ll>
#define vi              vector<ll>
#define vs              vector<string>
#define all(a)          (a).begin(),(a).end()
#define F               first
#define S               second
#define sz(x)           ((ll)x.size())
#define hell            (1000000007)
#define inf             ((ll)5e18 + 5)
#define PI              ((double)3.14159265358979323844)
#define DECIMAL(n)      cout << fixed << setprecision(n);
#define rep(i,a,b)      for (ll i=a;i<b;i++)
#define repr(i,a,b)     for (ll i=a-1;i>=b;i--)
#define bitcount(a)     (ll)__builtin_popcount(a)
#define lbnd            lower_bound
#define ubnd            upper_bound
#define mp              make_pair
#define ios             ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define ordered_set     tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update>
#define trace(...)      __f(#__VA_ARGS__, __VA_ARGS__)

template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    std::cerr << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');std::cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}

using namespace std;
using namespace __gnu_pbds;

/*----------------------Graph Moves----------------*/
//const int fx[]={+1,-1,+0,+0};
//const int fy[]={+0,+0,+1,-1};
//const int fx[]={+0,+0,+1,-1,-1,+1,-1,+1};   // Kings Move
//const int fy[]={-1,+1,+0,+0,+1,+1,-1,-1};  // Kings Move
//const int fx[]={-2, -2, -1, -1,  1,  1,  2,  2};  // Knights Move
//const int fy[]={-1,  1, -2,  2, -2,  2, -1,  1}; // Knights Move
/*------------------------------------------------*/

//primes for hashing 937,991,1013,1409,1741

void solve() {
    ll n;
    cin>>n;
    ll temp=360;
    ll meow=(temp*n)/__gcd(n,temp);
    cout<<meow/n<<endl;
}

signed main() {
    ios
    ll test=1;
    //cin>>test;
    while (test--) solve();
    return 0;
}

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

int main() {
    int a, b, k;
    cin >> a >> b >> k;
    set<int> n;
    for (int i=0; i<k && a+i <= b; ++i) n.insert(a+i);
    for (int i=0; i<k && b-i >= a; ++i) n.insert(b-i);
    for (int i: n) cout << i << endl;
}

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

const long long INF = 5e18;

void solve() {
    int N;
    cin >> N;
    vector<int> t(N);
    vector<double> v(N);
    for (int i = 0; i < N; i++) cin >> t.at(i);
    for (int i = 0; i < N; i++) cin >> v.at(i);
    int t_sum = 0;
    for (int i = 0; i < N; i++) t_sum += t.at(i);
    vector<double> max_speed(0);
    for (int i = 0; i < N; i++) {
        for (int j = 0; j < t.at(i); j++) {
            max_speed.push_back(v.at(i));
        }
    }
    max_speed.push_back(0);
    for (int i = max_speed.size() - 2; i >= 0; i--) {
        max_speed.at(i) = min(max_speed.at(i), max_speed.at(i + 1) + 1);
    }
    /*
    for (int i = 0; i < max_speed.size(); i++) cout << max_speed.at(i) << " ";
    cout << endl;
    */
    double ans = 0, speed = 0, x, y;
    for (int i = 0; i < max_speed.size() - 1; i++) {
        x = max_speed.at(i);
        y = max_speed.at(i + 1);
        if (x == speed) {
            if (y < speed) {
                ans += speed - 0.5;
                speed--;
            } else {
                ans += speed;
            }
        } else {
            if (y < speed) {
                ans += speed - 0.5;
                speed--;
            } else if (y > speed) {
                ans += speed + 0.5;
                speed++;
            } else {
                ans += speed + 0.25;
            }
        }
        //cout << ans << " ";
    }
    //cout << endl;
    cout << fixed << ans << endl;
    return;
}

int main() {
    solve();
}


Measured memory_bytes: 640
from collections import deque,defaultdict,Counter
from itertools import accumulate
import bisect
from heapq import heappop,heappush
from fractions import gcd
from copy import deepcopy
import math
import queue
#import numpy as np
#import sympy as syp(素因数分解とか)
Mod = 1000000007
 
  
def sieve_of_eratosthenes(n):
    if not isinstance(n,int):
        raise TypeError("n is not int")
    if n<2:
        raise ValueError("n is not effective")
    prime = [1]*(n+1)
    for i in range(2,int(math.sqrt(n))+1):
        if prime[i] == 1:
            for j in range(2*i,n+1):
                if j%i == 0:
                    prime[j] = 0
    res = []
    for i in range(2,n+1):
        if prime[i] == 1:
            res.append(i)
    return res

def factorial(i):
    if i == 1:
        return 1
    else:
        return i*factorial(i-1)
 
class UnionFind:
    def __init__(self,n):
        self.parent = [i for i in range(n+1)]
        self.rank = [0 for i in range(n+1)]
    
    def findroot(self,x):
        if x == self.parent[x]:
            return x
        else:
            y = self.parent[x]
            y = self.findroot(self.parent[x])
            return y
    
    def union(self,x,y):
        px = self.findroot(x)
        py = self.findroot(y)
        if px < py:
            self.parent[py] = px
        else:
            self.parent[px] = py
 
    def same_group_or_no(self,x,y):
        return self.findroot(x) == self.findroot(y)




def main(): #startline-------------------------------------------
    a,b = map(int,input().split())
    d = gcd(a,b)
    p = int(math.sqrt(d))+1
    div = []
    for i in range(1,p):
        if d%i==0:
            if d//i != i:
                div.append(i)
                div.append(d//i)
            else:
                div.append(i)
    div.sort()
    n = len(div)
    sgn = [1]*(n)
    if len(sgn) != 1:
        for i in range(1,len(sgn)):
            if sgn[i] == 1:
                for j in range(i+1,n):
                    if div[j]%div[i] == 0:
                        sgn[j] = 0
        res = []
        for i in range(n):
            if sgn[i] == 1:
                res.append(div[i])
        print(len(res))
    else:
        print(1)
if __name__ == "__main__":
    main() #endline===============================================

Measured memory_bytes: 5420
#import<bits/stdc++.h>
using namespace std;long L,R,D,M=998244353,l,r,d,z,A['   '];map<long,int>m;main(){cin>>l>>r;for(m[l]=1;l--;A[l]=++z%=M)z*=10;for(;cin>>L>>R>>D;cout<<z<<" "){z=(z+D*(A[--L]-A[R]))%M;auto t=m.lower_bound(l=L);for(d=t->second;z=(z-t->second*(A[l]-A[r=min(R,t->first)])%M+M)%M,r<R;t=m.erase(t))l=t->first;m[L]=d;m[R]=D;}}

Measured memory_bytes: 17644
h,w = map(int,input().split())
hw = []

for _ in range(h):
    t = input()
    if t=='.'*w: continue
    hw.append(t)
h=len(hw)
check=[0]*w
for i in range(h):
    for j in range(w):
        if hw[i][j]=='#' and check[j]==0:
            check[j]=1
p=0
for j in range(w):
    if check[j]==0:
        for i in range(h):
            hw[i]=hw[i][:j+p]+hw[i][j+1+p:]
        p-=1
for i in range(h):
    print(hw[i])

Measured memory_bytes: 3064
#include <iostream>

using namespace std;

int main()
{
  int n;
  int B[110];
  int ans = 0;
  cin >> n;
  for (int i = 0; i < n - 1; ++i) {
    cin >> B[i];
    if (i > 0) {
      ans += min(B[i], B[i - 1]);
    } else
      ans += B[i];
  }
  ans += B[n - 2];
  cout << ans << endl;
}

Measured memory_bytes: 256
import bisect
n = int(input())
a,b,c = [sorted(list(map(int,input().split()))) for i in range(3)]
ans = 0
cnt = [0]
[cnt.append(cnt[i]+bisect.bisect_left(a,b[i])) for i in range(n)]
for i in range(n):
    index = bisect.bisect_left(b,c[i])
    ans += cnt[index] 
print(ans)

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

n = int(input())
d, x = map(int, input().split())
a = ["" for i in range(n)]
for i in range(n):
    a[i] = int(input())

def eat(d, ai):
    res = 0
    for j in range(d):
        if j % ai == 0:
            res += 1
    return res

res = x
for i in range(n):
    res += eat(d, a[i])
    
print(res)
            
    


Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define MOD 1000000007
using namespace std;
int main()
{
    string s;
    cin >> s;
    int count = 0;
    for(int i = 0;i < s.size();i++)
    {
        if(s[i] == 'p')
        {
            count++;
        }
    }
    cout << s.size() / 2 - count;

    return 0;
}

Measured memory_bytes: 512
#include<stdio.h>

#define MAX 100
#define INFTY 2000000
#define White 0
#define Gray 1
#define Black 2


int G[MAX][MAX],n;

int prim();

int main(){
  
  int i,j;
  
  scanf("%d",&n);
  
  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      
      scanf("%d",&G[i][j]);
      if(G[i][j] == -1) G[i][j] = INFTY;
    }
  }
  
  printf("%d\n",prim());
  
  return 0;
}

int prim(){

  int color[MAX],d[MAX],p[MAX];
  int min,u,v,sum=0;
  int i;
 
  for(i = 0; i < n; i++){
    color[i] = White;
    d[i] = INFTY;
    p[i] = -1;
  }
 
  d[0] = 0;
  p[0] = -1;
   
  while(1){
    min = INFTY;
    for(i = 0; i < n; i++){
      if(color[i] != Black && d[i] < min){
    min = d[i];
    u = i;
      }
    }
    if(min == INFTY) break;
      color[u] = Black;
       
      for(v = 0; v < n; v++){
    if(color[v] != Black && G[u][v] != INFTY){
      if(G[u][v] < d[v]){
        d[v] = G[u][v];
        p[v] = u;
        color[v] = Gray;
      }
    }
      }
  }
  for(i = 0; i < n; i++){
    if(p[i] != -1) sum += G[i][p[i]];
  }
  return sum;


}

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

int main(){
  int H,W,i,j;
  
  while(1){
    cin >> H >> W;

    if(H==0 && W==0) break;
    
    for (i=0;i<W;i++){
      cout << "#";
    }
    cout << endl;
    
    for(i=0;i<H-2;i++){
      for(j=1;j<=W;j++){
	if(j==1 || j==W){
	  cout << "#";
	}else{
	  cout << ".";
	}
      }
      cout << endl;
    }
    
    for (i=0;i<W;i++){
      cout << "#";
    }
    cout << endl;
    cout << endl;
      
    
  }
  
}


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

int main(void){
    int N,M;
    cin>>N>>M;
    int cnt[N];
    for(int i=0;i<N;i++)
        cnt[i]=0;

    for(int i=0;i<M;i++){
        int a,b;
        cin>>a>>b;
        cnt[a-1]++;
        cnt[b-1]++;
    }

    for(int i=0;i<N;i++)
        cout<<cnt[i]<<endl;

    return 0;
}


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

#define ll long long

using namespace std;
int main()
{


    ll i,j,k,x,y,z,m,n,t,number1,number2 ,l,r;
    cin>>n;
    ll foo=0;
    ll counter=0;
    for(i=0; i<n; i++)
    {
        cin>>number1>>number2;
        if(number1==number2)
        {
            counter++;
            if(counter>=3)
                foo=1;
        }
        else
            counter=0;
    }
    if(foo)
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;
}


Measured memory_bytes: 3592
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define sz(a) (int)(a.size())
#define len(a) (int)(a.length())
using namespace std;
typedef long long ll;
priority_queue<ll,vector<ll>,greater<ll> >q;
ll a[300030],f[300030],g[300030],ans=-1e18;
int main()
{
    int n;
    cin >>n;
    for(int i=0;i<3*n;i++)
    cin >>a[i];
    for(int i=0;i<3*n;i++)
	{
		q.push(a[i]);
		f[i]=f[i-1]+a[i];
		if(q.size()>n)
		{
			f[i]-=(q.top());
			q.pop();
		}
	  }
	while(!q.empty())
	q.pop();
	for(int i=3*n-1;i>=0;i--)
	{
		q.push(-a[i]);
		g[i]=g[i+1]+a[i];
		if(q.size()>n)
		{
			g[i]+=(q.top());
			q.pop();
		}
	  }
	for(int i=n-1;i<2*n;i++)
	ans=max(ans,f[i]-g[i+1]);
	cout <<ans<<endl;
  return 0;
}

Measured memory_bytes: 8180
#include <cstdio>
#include <vector>
#include <algorithm>

using namespace std;

int main(void)
{
    vector<int> a(2);
    while(1)
    {
        scanf("%d %d", &a[0], &a[1]);
        if((a[0]==0) && (a[1]==0)) break;
        sort(a.begin(), a.end());
        printf("%d %d\n", a[0], a[1]);
    }

    return 0;
}


Measured memory_bytes: 2636
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define mp make_pair
#define pb push_back
#define pll pair<ll,ll>
ll INF = 1000000007;
ll vis[102]={0};

int main()
{
	ll i,j,k;
	ll n;
	cin>>n>>k;
	for(i=0;i<k;i++)
	{
		ll d;
		cin>>d;
		for(j=0;j<d;j++)
		{
			ll t;
			cin>>t;
			vis[t]=1;
		}
	}
	ll cnt = 0;
	for(i=1;i<=n;i++)
	{
		if(vis[i]==0)
			cnt++;
	}
	cout<<cnt<<endl;
	return 0;
}

Measured memory_bytes: 3616
#include <iostream>
#include <stdio.h>
#define MAX 101

int A[MAX];


int main() {
    int n, x;
    int sum = 0;

    while (1) {
        scanf("%d %d", &n, &x);
        if ( n == 0 && x == 0 ) break;
        for (int i = 1; i <= n; i++) A[i] = i;

        for (int i = 1; i <= n-2; i++) {
            for (int j = i+1; j <= n-1; j++) {
                for (int k = j+1; k <= n; k++) {
                    if (A[i] + A[j] + A[k] == x) sum ++;
                }
            }
        }
        printf("%d\n", sum);
        sum = 0;
    }
    
    return 0;

}

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

using namespace std;
#define REP(i,n) for(int i = 0; i < (int)(n); i++)
#define IREP(i, n) for(int i = (int)(n) - 1; i >= 0; i--)
#define MOD (1000 * 1000 * 1000 + 7)

typedef long long ll;

typedef pair<int, int> pint;

int main() {
    int n;
    cin >> n;
    int sum = 0;
    int v[n];
    REP(i, n) cin >> v[i];
    int c[n];
    REP(i, n) cin >> c[i];
    REP(i, n) if(v[i] > c[i]) sum += v[i] - c[i];
    cout << sum;
    return 0;
}

Measured memory_bytes: 256
import java.util.*;

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

    String s = sc.next();
    char[] a = s.toCharArray();
    int n = a.length;

    int m = 0;
    for (int i = 0; i < n-1; i++) {
      if (a[i] != a[i+1]) m++;
    }

    System.out.println(m);
  }
}


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

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

using namespace std;

int main(){
	int h1,m1,h2,m2,k; cin>>h1>>m1>>h2>>m2>>k;
	int t1=60*h1+m1,t2=60*h2+m2;
	printf("%d\n",t2-t1-k);
	return 0;
}


Measured memory_bytes: 3752
t,*l=open(0)
h,w=map(int,t.split())
grid = [[c=="."for c in C]for C in l]
L,R,U,D = eval("[[0]*(w+2) for _ in range(h+2)],"*4)
for y in range(h):
	for x in range(w):
		L[y+1][x+1] = (L[y+1][x]+1)*grid[y][x]
		R[y+1][w-x] = (R[y+1][w-x+1]+1)*grid[y][w-x-1]
for x in range(w):
	for y in range(h):
		U[y+1][x+1] = (U[y][x+1]+1)*grid[y][x]
		D[h-y][x+1] = (D[h-y+1][x+1]+1)*grid[h-y-1][x]
print(max(L[y][x] + R[y][x] + U[y][x] + D[y][x] -3 for y in range(1,h+1) for x in range(1,w+1)))

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

int N;
#define MAX_N 50
#define MAX_V 50
int D[MAX_V + 1][MAX_V + 1];
bool A[MAX_N][MAX_V + 1];
int B[MAX_N];
long long R;

int main() {
  cin >> N;
  for(int v = 0; v <= MAX_V; ++v) for(int w = 0; w <= MAX_V; ++w) {
    D[v][w] = INT_MAX;
    for(int k = MAX_V; k >= 1; --k) {
      if(v % k == w) D[v][w] = k;
    }
    if(v == w) D[v][w] = 0;
  }
  for(int u = 0; u <= MAX_V; ++u) {
    for(int v = 0; v <= MAX_V; ++v) for(int w = 0; w <= MAX_V; ++w) {
      D[v][w] = min(D[v][w], max(D[v][u], D[u][w]));
    }
  }
  for(int i = 0; i < N; ++i) { int a; cin >> a; A[i][a] = true; }
  for(int i = 0; i < N; ++i) cin >> B[i];
  while(true) {
    int k = 0;
    for(int i = 0; i < N; ++i) {
      int c = INT_MAX;
      for(int v = 0; v <= MAX_V; ++v) {
        if(A[i][v]) c = min(c, D[v][B[i]]);
      }
      k = max(k, c);
    }
    if(k == INT_MAX) { cout << -1 << endl; return 0; }
    if(k == 0) break;
    R += 1LL << k;
    for(int i = 0; i < N; ++i) {
      for(int v = 0; v <= MAX_V; ++v) {
        if(A[i][v]) A[i][v % k] = true;
      }
    }
  }
  cout << R << endl;
  return 0;
}


Measured memory_bytes: 256
//programking2_b.cpp
    //Sun Dec  8 11:18:32 2019
     
    #include <iostream>
    #include <string>
    #include <queue>
    #include <map>
    #include <unordered_map>
    #include <vector>
    #include <algorithm>
    #include <math.h>
    #include <set>
    #define INTINF 2147483647
    #define LLINF 9223372036854775807
    using namespace std;
    using ll=long long;
    typedef pair<int,int> P;
     
    int main(){
    	int n;
    	cin >> n;
     
    	ll node[n];
    	ll d[n];
    	fill(node,node+n,0);
    	ll maxnode = 0;
    	for (int i=0;i<n;i++){
    		cin >> d[i];
    		node[d[i]]++;
    		maxnode = max(maxnode,d[i]);
    	}
     
    	if (node[0]!=1 || d[0]!=0){
    		cout << 0 << endl;
    		return 0;
    	}
     
    	ll ans = 1;
    	for (int i=1;i<=maxnode;i++){
    		ll temp = node[i];
    		while (temp){
    			ans = ans * node[i-1] % 998244353;
    			temp--;
    		}
    	}
     
    	cout << ans << endl;
    //	printf("%.4f\n",ans);
    }

Measured memory_bytes: 1792
using namespace std;
#include<bits/stdc++.h>
#define BEGIN ios_base::sync_with_stdio(0);cin.tie(0)
#define END return EXIT_SUCCESS
#define FOR(I,A,B) for((I)=(A);(I)<(B);(I)++)
#define REP(I,N) FOR(I,0,N)
#define UP(I,A,B) for((I)=(A);(I)<=(B);(I)++)
#define DW(I,A,B) for((I)=(A);(I)>=(B);(I)--)
#define IN(P) cin>>(P)
#define IN2(P1,P2) cin>>(P1)>>(P2)
#define IN3(P1,P2,P3) cin>>(P1)>>(P2)>>(P3)
#define INS(I,N,V) REP(I,N) cin>>V[I]
#define INS2(I,N,V1,V2) REP(I,N) cin>>V1[I]>>V2[I];
#define INS3(I,N,V1,V2,V3) REP(I,N) cin>>V1[I]>>V2[I]>>V3[I];
#define OUT(P) cout<<P<<endl
#define OUT2(P1,P2) cout<<P1<<" "<<P2<<endl
#define OUT3(P1,P2,P3) cout<<P1<<" "<<P2<<" "<<P3<<endl
#define OUTS(I,N,V) REP(I,N) cout<<V[i]<<endl
#define ALL(C) (C).begin(),(C).end()
#define RALL(C) (C).rbegin(),(C).rend()
#define mp make_pair
#define pb push_back
typedef unsigned long ul;
typedef unsigned int ui;
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 N,i,sum;
vector<int> s;

inline void solve(){
  IN(N);
  s.resize(N);
  REP(i,N){
    IN(s[i]);
    sum+=s[i];
  }
  if(sum%10){
    OUT(sum);
    return;
  }
  sort(ALL(s));
  REP(i,N){
    sum-=s[i];
    if(sum%10){
      OUT(sum);
      return;
    }
    sum+=s[i];
  }
  OUT(0);
}

int main(int argc,char**argv){
  BEGIN;
  solve();
  END;
}


Measured memory_bytes: 256
import java.util.Scanner;
import java.lang.Math;

public class Main {
  public static void main(String[] args)
  {
    Scanner scan = new Scanner(System.in);
    int n = scan.nextInt();
    int a[][][] = new int[4][3][10];
    for (int i = 0; i < n; i++) {
      int b,f,r,v;
      b = scan.nextInt();
      f = scan.nextInt();
      r = scan.nextInt();
      v = scan.nextInt();
      a[b-1][f-1][r-1] += v;
    }

    for(int i=0; i<4; i++)
    {
      for (int j = 0; j < 3; j++)
      {
        for (int j2 = 0; j2 < 10; j2++) {
          System.out.print(" " + a[i][j][j2]);
        }
        System.out.println();
      }
      if (i!=3) System.out.println("####################");
    }
    scan.close();
  }
}



Measured memory_bytes: 29380
import java.util.*;
import java.io.*;

public class Main {
    public static void main(String[] args)throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int N = Integer.parseInt(br.readLine());
        int count = 0;
        for(int i=1;i<=N;i+=2){
            int divisor = 0;
            for(int j=1;j<=i;j++){
                if(i%j==0){
                    divisor++;
                }
            }
            if(divisor==8)
                count++;
        }
        System.out.println(count);
    }
}


Measured memory_bytes: 21076
input = require('fs').readFileSync('/dev/stdin', 'utf8')
lines = input.split('\n')
line = lines.shift().split(' ')
N = line[0] * 1
K = line[1] * 1
h = lines.shift().split(' ')
ans = 0
for (i=0; i <N; i++) {
    if (h[i] * 1 >= K) {
        ans++
    }
}
console.log(ans)

Measured memory_bytes: 21064
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.TreeSet;

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

        try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in));) {
            List<String> inputString = Arrays.asList(br.readLine().split(""));
            Set<String> inputSet = new TreeSet<>();
            for (String str : inputString) {
                inputSet.add(str);
            }
            
            String ans = "None";
            for (int i = 65; i <= 90; i++) {
                String tmpString = String.valueOf((char) i).toLowerCase();
                if (!inputSet.contains(tmpString)) {
                    ans = tmpString;
                    break;
                }
            }

            System.out.println(ans);
        } catch (IOException | NumberFormatException e) {
            e.printStackTrace();
            System.exit(0);
        } catch (final Exception e) {
            e.printStackTrace();
            System.exit(0);
        }
    }
}

Measured memory_bytes: 29396
//大文字->小文字 tolower(),逆はtoupper()
//int a = stoi(c); 文字列をintへ
//途中の出力をそのまま残さない
//数値計算 個数以外はdouble
//map<キー,値> p は辞書。p[キー] = 値
//map 全探索
//auto begin = p.begin(), end = p.end();
//for (auto it = begin; it != end; it++) {}
//mapのキー：it->first mapのバリュー：it->second
//絶対値 abs()
//入力は空白で切れる
//大文字判定 isupper(文字) 小文字判定 islower(文字)
//do{}while(next_permutation(ALL(配列)))
//while(N)で回すとき、Nはコピーを作っておく
#include <bits/stdc++.h>
#define rep(i,N) for(int i = 0; i < N;i++)
#define ALL(a) (a).begin(),(a).end()
#define ll long long int
using namespace std;

// K進数でのNの桁数
ll dig(ll N,ll K) {
	ll dig = 0;
	while (N) {
		dig++;
		N /= K;
	}
	return dig;
}
// x,yの最大公約数
ll gcd(ll x, ll y) {
	ll r;
	while (x%y) {
		r = x % y;
		x = y;
		y = r;
	}
	return y;
}

ll C(ll N) {
	return N * (N - 1) / 2;
}

int main() {
	ll N; cin >> N;
	vector<ll> a(N); rep(i, N)cin >> a[i];

	sort(ALL(a));
	
	ll ans = 0;
	rep(i, N) {
		ans += (a[i] - 1);
	}

	cout << ans << endl;
}

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

int main() 
{
    long long A, B;
    cin >> A >> B;
    
    if (A % 2 != B % 2) {
        cout << "IMPOSSIBLE" << endl;
        return 0;
    }
    long long sum = (A + B) / 2;
    cout << sum << endl;
}

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

const int N_MAX = 1000;

int l[N_MAX+10], r[N_MAX+10];

int main()
{
  int n;
  cin >> n;
  for(int i=0;i<n;i++){
    cin >> l[i] >> r[i];
  }
  int count = 0;
  for(int i=0;i<n;i++){
    count += (r[i] - l[i] + 1);
  }
  cout << count << endl;
}

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

using namespace std;

int main () {
  int a, b;
  cin >> a >> b;
  if(a == b) cout << a+b;
  else if (a > b) cout << a+a-1;
  else cout << 2*b-1;
}


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

namespace ConsoleApp
{
    class Program
    {
        static void Main(string[] args)
        {
            var strs = Console.ReadLine().Split();
            var A = int.Parse(strs[0]);
            var B = int.Parse(strs[1]);

            if (A % 2 == 1 && B % 2 == 1)
                Console.WriteLine("Yes");
            else
                Console.WriteLine("No");
        }
    }
}


Measured memory_bytes: 11092
buffer = []
while True:
    x,y = map(int, input().split())
    if x == 0 and y == 0:
        break
    if x <= y:
        buffer.append([x,y])
    else:
        buffer.append([y,x])
for num in range(len(buffer)):
    print(buffer[num][0],buffer[num][1])



Measured memory_bytes: 6128
#include <bits/stdc++.h>
using namespace std;
#define min(a,b) ((a)<(b)?(a):(b))
#define max(a,b) ((a)>(b)?(a):(b))
#define REP(i,n) for(ll i=0;i<n;i++)
#define FOR(i,n1,n2) for(ll i=n1;i<n2;i++)
#define bFOR(i,n1,n2) for(ll i=n1;i>=n2;i--)
#define speed_up    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

typedef long long int ll;
typedef pair<ll,ll> Pi;
typedef tuple<ll,ll,ll> Tu;
const int INF=(ll)(1LL<<30)-1;
const double INFd=100000000000.0;
const double PI=3.14151926535;
const ll INFl=(ll)9223372036854775807/2;
const int MAX=10000;
const ll MOD=(ll)1e9+7;
const ll tMOD=(ll)998244353;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a, b)*b;}
//int dx[4]={0,-1,0,1},dy[4]={-1,0,1,0};
int mdx[8]={0,1,0,-1,1,1,-1,-1},mdy[8]={-1,0,1,0,1,-1,1,-1};


template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}
const int MAX_N=100100;

int par[MAX_N];
int ran[MAX_N];
int size[MAX_N];

void init(int n){
	for(int i=0;i<n;i++){
		par[i]=i;
		ran[i]=0;
		size[i]=1;
	}
}

int find(int x){
	if(par[x]==x){
		return x;
	}else{
		return par[x]=find(par[x]);
	}
}

void unite(int x,int y){
	x=find(x);
	y=find(y);
	if(x==y)return;
	
	if(ran[x]<ran[y]){
		par[x]=y;
	}else{
		par[y]=x;
		if(ran[x]==ran[y])ran[x]++;
	}
	size[x]=size[y]+size[x];
	size[y]=size[x];
}

bool same(int x,int y){
	return find(x)==find(y);
}

int n,m;
ll a[100100];
vector<int> b[100100];
int main(){
	cin>>n>>m;
	REP(i,n)cin>>a[i];
	if(n/2<(n-m-1)){
		cout<<"Impossible"<<endl;
		return 0;
	}
	if(n==m+1){
		cout<<0<<endl;
		return 0;
	}
	init(n);
	REP(i,m){
		int x,y;
		cin>>x>>y;
		unite(x,y);
	}
	int t=0;
	REP(i,n){
		if(i==find(i))t++;
		b[find(i)].push_back(a[i]);
	}
	ll ans=0;
	vector<ll> la;
	REP(i,n){
		if(i!=find(i))continue;
		sort(b[i].begin(),b[i].end());
		ans+=b[i][0];
		for(int j=1;j<b[i].size();j++){
			la.push_back(b[i][j]);
		}
	}
	sort(la.begin(),la.end());
	REP(i,t-2){
		ans+=la[i];
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 7032
#include <bits/stdc++.h>
#include <numeric>
using namespace std;
#define ll long long
#define mod 100000007
#define rep(i, n) for (int i = 0; i < n; ++i)
using Graph = vector<vector<int>>;
#define grepq priority_queue<double, std::vector<double>, std::greater<double>>

ll lcm(ll a, ll b)
{
    return a * b / __gcd(a, b);
}
ll INF = 10010001010;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

int main(){
    int A, B;
    cin >> A >> B;
    int ans = ceil((double)(A + B) / 2);
    cout<< ans << endl;
}


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

int main(){
  int a,b,c,d,e;
  
  cin >> a >> b >> c >> d >> e;
  
  if(a == 0){
    cout << 1 << endl;
  }
  else if (b == 0){
    cout << 2 << endl;
  }
  else if (c == 0){
    cout << 3 << endl;
  }
  else if (d == 0){
    cout << 4 << endl;
  }
  else if (e == 0){
    cout << 5 << endl;
  }
  

}


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

namespace AtCoder
{
	class Program
	{
		static void Main(string[] args)
		{
            string[] str = Console.ReadLine().Split(' ');
            int N = int.Parse(str[0]);
            int A = int.Parse(str[1]);
            int B = int.Parse(str[2]);

            int ans = Math.Min(N * A, B);
            Console.WriteLine(ans);
            Console.ReadLine();

		}
	}
}


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

const long long MOD = 1e9 + 7;
const int MAXN = 2e5;

int N;
int C[MAXN + 10];

long long dp[MAXN + 10], ss[MAXN + 10];

int main() {
  scanf("%d", &N);
  for(int i = 0; i < N; i++) {
    scanf("%d", &C[i]);
  }
  dp[N] = 1;
  for(int i = N-1; i >= 0; i--) {
    int c = C[i];
    if(c != C[i+1]) {
      ss[c] = (ss[c] + dp[i+1]) % MOD;
    }
    dp[i] = ss[c];
  }
  printf("%lld\n", dp[0]);
}



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

const int N = 2e6;

int main() {
	clog << "Ready\n";
	
	int n, x;
	cin >> n >> x;
	int d = 0;
	int ans = 1;
	
	for (int i = 0; i < n; ++ i) {
		int l;
		cin >> l;
		d += l;
		if (d > x)
			break;
		ans = i + 2;
	}
	
	cout << ans;
	
	return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <vector>
#include <queue>
#include <set>
#include <string>
#include <map>
#include <cmath>
#include <cstring>

#define fi first
#define se second
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rrep(i,n) for (int i = 1; i < (n); ++i)
#define drep(i,n) for (int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define all(x) (x).begin(), (x).end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define pb push_back
#define sz(x) (int)(x).size()
#define PQ(T) priority_queue<T, v(T), greater<T> >

using namespace std;
using ll = long long;
using uint = unsigned;
using ull = unsigned long long;
using P = pair<int,int>;

const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;

const int mod = 1000000007;

int main() {
    vector<int> a{1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
    int k; cin >> k;
    cout << a[k-1] << endl;
    return 0;
}























Measured memory_bytes: 256
//おまじない
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <utility>
#define INF 1e9+7
#define rep(i,m,n) for(int i=m;i<n;i++)
#define mrep(i,m,n) for(int i=m;i>n;i--)
#define NO cout<<"NO"<<endl;
#define YES cout << "YES"<<endl;
#define No cout << "No"<<endl;
#define Yes cout << "Yes"<<endl;
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;


//(int)'a'は97 (int)'A'は65
//おまじない

int N, M;
bool jud[8]= { 0 };
int path[8][8]= { 0 };
int ans = 0;
int c = 1;


void cal(int s = 0) {
	if (c == N) {
		ans++;
		return;
	}
	else {
		if (s == 0) {
			c = 1;
			rep(i, 0, N) { jud[i] = false; }
		}
		rep(i, 1, N) {
			if (path[s][i] == 1 && !jud[i]) {
				c++;
				jud[i] = true;
				cal(i);
				c--;
				jud[i] = false;
			}
		}


	}
	return;
}

int main() {

	cin >> N >> M;
	rep(i, 0, M) {
		int a, b;
		cin >> a >> b;
		a--; b--;
		path[a][b] = 1; path[b][a] = 1;
	}

	cal();

	cout << ans << endl;


	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i=0;i<(n);++i)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define all(x) (x).begin(), (x).end()
#define PI 3.14159265358979323846264338327950L
using namespace std;
typedef long long ll;
typedef long double ld;
int main() {
    map<string,int> mp;
    string s;
    int n;
    cin>>n;
    rep(i,n){
        cin>>s;
        sort(all(s));
        mp[s]++;
    }
    ll ans=0;
    for(auto &a:mp){
        ll num=a.second;
        ans+=num*(num-1)/2;
    }
    cout<<ans;
}

Measured memory_bytes: 11348
#include<iostream>
#include<iomanip>
#include<math.h>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<stack>
#include<string>
#include<string.h>
#define INF 1000000000ll
#define MOD 1000000007ll
#define EPS 1e-10
#define REP(i,m) for(long long i=0; i<m; i++)
#define FOR(i,n,m) for(long long i=n; i<m; i++)
#define DUMP(a) for(long long dump=0; dump<(ll)a.size(); dump++) { cout<<a[dump]; if(dump!=(ll)a.size()-1) cout<<" "; else cout<<endl; }
#define ALL(v) v.begin(),v.end()
#define pb push_back
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef long double ld;

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	string n;
	cin>>n;
	ll sum=0;
	REP(i,(ll)n.size()) {
		sum+=(ll)(n[i]-'0');
	}
	if(stoi(n)%sum==0) cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <set>
#include <map>
#include <utility>
#define ll long long
using namespace std;
set<ll> box[100001];
map<pair<ll, ll>, ll> size;
ll length[100001];

void dfs (ll i, ll pa = -1) {
  for (auto j : box[i]) {
    if (j != pa) {
      length[j] = length[i] + size[make_pair(i, j)];
      dfs(j, i);
    }
  }
}

int main () {
  ll n;
  cin >> n;
  for (ll i = 0; i < n - 1; i++) {
    ll s, ss, sss;
    cin >> s >> ss >> sss;
    box[s].insert(ss);  
    box[ss].insert(s);
    size[make_pair(s, ss)] = sss;  
    size[make_pair(ss, s)] = sss;  
  }
  ll q, k;
  cin >> q >> k;
  length[k] = 0;
  length[0] = 0;
  dfs(k, -1);
  ll ans[q];
  for (int i = 0; i < q; i++) {
    int s, ss;
    cin >> s >> ss;
    ans[i] = length[s] + length[ss];   
  }
  for (int i = 0; i < q; i++) {
    cout << ans[i] << endl;  
  }
    
}

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

int main(){
    char s[200010],t[200010];
    int cmd=0;
    scanf("%s",s);
    scanf("%s",t);

    for(int i=0;i<strlen(s);i++){
        if (s[i]!=t[i]){
            cmd++;
        }
    }
    printf("%d",cmd);

    return 0;
}

Measured memory_bytes: 2496
def divisor(n):
    ass = []
    for i in range(1,int(n**0.5)+1):
        if n%i == 0:
            ass.append(i)
            if i**2 == n:
                continue
            ass.append(n//i)
    return ass 

def is_prime(n):
    if n == 1:
        return False
    for i in range(2,int(n**0.5)+1):
        if n % i == 0:
            return False
    return True

def main():
    A, B = map(int, input().split())
    div_A = set(divisor(A))
    div_B = set(divisor(B))
    div_list = list(div_A & div_B)
    cnt = 1
    for n in div_list:
        if is_prime(n):
            cnt += 1

    print(cnt)



if __name__ == "__main__":
    main()

Measured memory_bytes: 42216
#include <cstdio>
#include <vector>
using namespace std;

int main() {
	int n,u,k,v;
	int i,j;
	vector<vector<int> > V;
	scanf("%d",&n);
	V.resize(n);
	for(i=0; i<n; ++i) {
		V[i].resize(n);
		for(j=0; j<n; ++j) {
			V[i][j]=0;
		}
	}
	for(i=0; i<n; ++i) {
		scanf("%d%d",&u,&k);
		for(j=0; j<k; ++j) {
			scanf("%d",&v);
			V[u-1][v-1]=1;
		}
	}
	for(i=0; i<n; ++i) {
		for(j=0; j<n-1; ++j) {
			printf("%d ",V[i][j]);
		}
		printf("%d\n",V[i][n-1]);
	}
	return 0;
}

Measured memory_bytes: 2776
### main

n = gets.to_i

n.times do
  x = y = 0
  max_d2 = 0
  max_x = max_y = 0

  loop do
    dx, dy = gets.split.map(&:to_i)
    break if (dx | dy) == 0

    x += dx
    y += dy
    d2 = x * x + y * y

    if max_d2 < d2
      max_d2 = d2
      max_x = x
      max_y = y
    elsif max_d2 == d2 && max_x < x
      max_x = x
      max_y = y
    end
  end

  puts [max_x, max_y].join(' ')
end

Measured memory_bytes: 6108