akhauriyash/Code-Regression huggingface dataset:
import java.util.*;
import java.lang.*;

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

        int[][] candy = new int[2][N];
        for(int h=0; h<2; h++) for(int w=0; w<N; w++) candy[h][w]=sc.nextInt();

        int[][] sum = new int[2][N];
        sum[0][0] = candy[0][0];
        sum[1][0] = sum[0][0] + candy[1][0];
        for(int w=1; w<N; w++){
            sum[0][w] = sum[0][w-1] + candy[0][w];
            sum[1][w] = Math.max(sum[0][w], sum[1][w-1]) + candy[1][w];
        }

        System.out.println(sum[1][N-1]);

    }
}


Measured memory_bytes: 21716
num = gets.to_i
num -= 1
a = gets.split(" ").map{|item| item.to_i}
num.times do |i|
	print "#{a[i]} "
end
print a[num]
print "\n"
num.times do |i|
	v = a[i+1]
	j = i
	if a[j] > v
		while j >= 0 && a[j] > v do
			a[j+1] = a[j]
			j -= 1
			a[j+1] = v
		end
		num.times do |i|
			print "#{a[i]} "
		end
		print a[num]
		print "\n"
	elsif
		num.times do |i|
			print "#{a[i]} "
		end
		print a[num]
		print "\n"
	end
end



Measured memory_bytes: 6876
#include <iostream>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <map>
#include <set>
#include <cmath>
using namespace std;
void solve(){
  string s; cin >> s;
  for(int i = 0; i < 19; i++){
    if(i == 5 || i == 13) cout << ' ';
    else cout << s[i];
  }
  cout << endl;
  return;
}

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


Measured memory_bytes: 256
import std.stdio, std.algorithm, std.conv, std.array, std.string, std.math, std.typecons, std.numeric, std.container, std.range;

void main()
{
    auto M = readln.chomp.to!int;
    long r, x = -1;
    while (M--) {
        auto dc = readln.split.to!(long[]);
        auto d = dc[0];
        auto c = dc[1];
        if (x == -1) {
            --c;
            x = d;
        }
        while (c) {
            if (c%2 == 1) {
                ++r;
                x += d;
                if (x > 9) {
                    ++r;
                    x = x/10 + x%10;
                }
            }
            r += c/2;
            d *= 2;
            if (d > 9) {
                r += c/2;
                d = d/10 + d%10;
            }
            c /= 2;
        }
    }
    writeln(r);
}

Measured memory_bytes: 3724
from collections import deque

n, k = map(int, input().split()) 

p_l = list(map(int, input().split())) 
p_sum_k_l = []

q = deque([])
first_sum = 0
for i in range(k):
    ex = (p_l[i]+1)/2
    q.append(ex)
    first_sum += ex

p_sum_k_l.append(first_sum)
# print(q)

for i in range(k, len(p_l)):
    # print('---')
    poped = q.popleft()
    added = (p_l[i]+1)/2
    # print(poped, added)
    diff = added-poped
    # print(diff)
    next_sum = p_sum_k_l[-1] + diff
    p_sum_k_l.append(next_sum)
    q.append(added)

print(max(p_sum_k_l))

Measured memory_bytes: 25572
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
using namespace std;
const int maxn=1000;
long long shuzi[maxn],mi2[20]={1,2,4,8,16,32,64,128,256,512,1024,2048,4096},ans; 
long long mi10[20]={1,10,100,1000,10000,100000,1000000,10000000,100000000,1000000000,10000000000};
int main()
{
	char a[maxn];
	cin>>a;
	int len=strlen(a);
	for(int i=0;i<len;i++)
		shuzi[i+1]=a[i]-'0';
	ans=shuzi[len]*mi2[len-1];
	for(int i=len-1;i>=1;i--)
	{
		 for(int j=len-2;j>=i-1;j--)
		{
			int ai=shuzi[i];
			int mi2lenj=mi2[len-j];
			int mi10j2=mi10[j-2];
			ans+=shuzi[i]*mi2[j]*mi10[len-j-2];
		}
		ans+=shuzi[i]*mi2[i-1]*mi10[len-i];
	}
	printf("%lld",ans);
	return 0;
}


Measured memory_bytes: 256
from bisect import bisect_left as lower_bound
from bisect import bisect_right as upper_bound
import math
n,d,a=map(int,input().split())
X, H=[], []; ans=0; L=[]
for i in range(n):
  x,h=map(int,input().split())
  L.append((x,h))
L.sort()
for x,h in L:
  X.append(x); H.append(h)
X.append(10**9); H.append(10**9)
imos=[0]*(n+5)
de=0 # decrease count
for i in range(n):
  de+=imos[i]
  HP=H[i]-de*a
  # 右から貪欲にダメージを減らす
  # 敵の体力が残ってるとき
  # print("HP is",HP)
  if HP>0:
    atk_cnt=math.ceil(HP/a) # 何回殴る必要があるか
    de+=atk_cnt
    ans+=atk_cnt
    index=upper_bound(X,X[i]+2*d)
    # print(X,X[i]+2*d)
    # print(index, atk_cnt)
    imos[index]-=atk_cnt
print(ans)

Measured memory_bytes: 41152
#pragma GCC optimize("Ofast,fast-math,unroll-loops")

#include <bits/stdc++.h>

//#define ll ll
//#define double long double
#define endl '\n'
#define all(C) (C).begin(), (C).end()
#define rall(C) (C).rbegin(), (C).rend()
#define mp make_pair 
#define pb emplace_back
#define dbg(x) cerr << #x << " : " << x << endl
//#define PI 3.141592653589

using namespace std;
       
using ll = long long;
using ull = unsigned long long;
using ld = long double;
       
/* 
const ll MAX_MEM = 25e7;
char MEM[MAX_MEM];
ll MEM_POS = 0;
void* operator new(size_t x)
{
    auto ret = MEM + MEM_POS;
    MEM_POS += x;
    assert(MEM_POS < MAX_MEM);
    return ret;
}
void operator delete(void*)
{}
*/
       
template <class T>
istream& operator>> (istream &in, vector <T> &a)
{
    for (auto &i : a)
        in >> i;
    return in;
}
       
template <class T> 
ostream& operator<< (ostream &out, vector <T> a)
{
    for (auto &i : a)
        out << i << ' ';
    return out;
}
       
template <class T, class U>
istream& operator>> (istream &in, pair <T, U> &p)
{
    in >> p.first >> p.second;
    return in;
}
       
template <class T, class U>
ostream& operator<< (ostream &out, pair <T, U> p)
{
    out << p.first << " " << p.second << " ";
    return out;
}
       
inline void Start()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0), cout.tie(0);
    //freopen("circlecover.in", "r", stdin);
    //freopen("circlecover.out", "w", stdout);
}

signed main()
{
    Start();
    char c;
    cin >> c;
    cout << char(c + 1);
    return 0;
}



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

namespace null_null {

using i32 = std::int_fast32_t;
using i64 = std::int_fast64_t;
using u32 = std::uint_fast32_t;
using u64 = std::uint_fast64_t;
using usize = std::size_t;

} // namespace null_null

#include <vector>

namespace null_null {

void main_() {
  usize N;
  i64 K,Q;
  std::cin>>N>>K>>Q;
  std::vector<i64>a(N,K-Q);

  while(Q--){
    i32 A;
    std::cin>>A;
    A--;
    a[A]++;
  }

  for(usize i=0;i<N;i++){
    if(a[i]>0){
      std::cout<<"Yes"<<std::endl;
    }else{
      std::cout<<"No"<<std::endl;
    }
  }
}

} // namespace null_null

int main() {
  std::cin.tie(nullptr);
  std::ios::sync_with_stdio(false);
  null_null::main_();
  return 0;
}

Measured memory_bytes: 1408
#dp[i]:足場iにたどり着くまでに支払うコストの最小値
#dp[i]=min(dp[i-1]+|h[i-1]-h[i]|,dp[i-2]...)

N = int(input())
h = list(map(int,input().split()))
dp = [0]*(N)
dp[1] = abs(h[0]-h[1])

for i in range(2,N,1):
    dp[i] = min(dp[i-1]+abs(h[i-1]-h[i]),dp[i-2]+abs(h[i-2]-h[i]))
print(dp[N-1])


Measured memory_bytes: 83632
# -*- coding: utf-8 -*-

N = int(input())

ans = 1
tmp_i = 0
counter = 0
max_counter = 0

for i in range(1, N + 1):
    counter = 0
    tmp_i = i
    # 2で割れる回数の判定
    while tmp_i % 2 == 0:
        tmp_i = tmp_i / 2
        counter += 1
    if counter > max_counter:
        ans = i
        max_counter = counter

print(ans)  

Measured memory_bytes: 9252
N,T=map(int,input().split())
c=[]
t=[]
min=10000
for i in range(N):
    c_n,t_n=map(int,input().split())
    c.append(c_n)
    t.append(t_n)
for i in range(N):
    if (t[i]<T or t[i]==T) and c[i]<min:
        min=c[i]
if min != 10000:
    print(min)
else:
    print("TLE")


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
///////////////////////////////////////////
const long long int INF = 1LL<<60;
const long long int Mod = 1000000007;
using ll = long long int; using ci = const int;
using vi = vector<int>;  using Vi = vector<long long int>;
using P = pair<int, int>;  using PLL = pair<ll, ll>;
using matrix = vector<vector<ll>>;
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define all(x) (x).begin(),(x).end()
#define rp(i,N) for(ll i = 0; i < (ll)N; i++)
#define repi(i,a,b) for(ll i = ll(a); i < ll(b); ++i)
template<class T>bool chmax(T &former, const T &b) { if (former<b) { former=b; return true; } return false; }
template<class T>bool chmin(T &former, const T &b) { if (b<former) { former=b; return true; } return false; }
template<class T>T sqar(T x){ return x*x; }//sqrt(x)は平方根;
#define Sort(v) std::sort(v.begin(), v.end(), std::greater<decltype(v[0])>()) //降順でVをソート
#define p_queue(v) priority_queue<v, vector<v>, greater<v> >
template<class T> inline void princ(T x){cout<<x<<" ";}; 
template<class T> inline void print(T x){cout<<x<<"\n";};
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
///////////////////////////////////////////////////////////////////////////////////
ll zeroh[1050];
ll zerov[1050];
void solve(){
    ll h,w,a,b;
    cin >> h >> w >> a >> b;
    ll tate=-1,yoko=-1;
    rp(i,w+1){
        rp(j,h+1){
            if((h-b-b)*i-(w-a-a)*j==a*h-b*w){
                tate=j,yoko=i;
                break;
            }
        }
    }
    if(tate<0){
        print("No");
        return;
    }
    repi(i,1,w-yoko+1) zerov[i]=b;
    repi(i,w-yoko+1,w+1) zerov[i]=h-b;
    repi(i,1,h-tate+1) zeroh[i]=a;
    repi(i,h-tate+1,h+1) zeroh[i]=w-a;
    rp(i,h){
        string str="";
        rp(j,w){
            if(zeroh[i+1]>0&&zerov[j+1]>0){
                str=str+"0";
                zeroh[i+1]--; zerov[j+1]--;
            }
            else str=str+"1";
        }
        print(str);
    }
    return;
}
int main(){
    cin.tie(0);ios::sync_with_stdio(false);
    std::cout<<std::fixed<<std::setprecision(30);
    solve();
    return 0;
}

Measured memory_bytes: 1280
#include<iostream>

using namespace std;
long long int faktorial(long long int n){
	if (n==0)return 1;
	return n*faktorial(n-1);
}
long long int n,z;
int main (){



while(cin>>n){

	  if(n>=0&&n<21){
		z = faktorial(n);
	
	
cout<<z<<endl;}}

return 0;
	
}

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

using namespace std;

int main() {
	long long w, h, x, y;
	scanf("%lld%lld%lld%lld", &w, &h, &x, &y);
	
	double area = (w * h) / 2.0;
	int res = 0;
	
	if ((2LL * x == w) && (2LL * y == h)) res++;
	
	printf("%.12lf %d\n", area, res);
}


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

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

using ll = long long;

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

int main (void) {
  std::cin.tie(0);  std::ios::sync_with_stdio(false);
  int N; ll D; std::cin >> N >> D;
  std::vector<ll> X(N), Y(N);
  rep(i,N) std::cin >> X[i] >> Y[i];

  int ans = 0;
  rep(i,N) {
    if ( X[i]*X[i] + Y[i]*Y[i] <= D*D ) ans++;
  }
  std::cout << ans << std::endl;
  return 0;
}



Measured memory_bytes: 6364
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
#include<bits/stdc++.h>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define pll pair<ll,ll>
#define pint pll
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

int main(){
  int n;
  cin >> n;
  int a[n];
  rep(i,n)cin >> a[i];
  if(a[0]!=0){
    cout << -1 << endl;
    return 0;
  }
  ll ans=0;
  for(int i=0;i<n;i++){
    if(i+1<n && a[i]+1<a[i+1]){
    cout << -1 << endl;
      return 0;
    }
    if(i==0)continue;
    ans+=a[i]/(a[i-1]+1)+a[i]%(a[i-1]+1);
  }
  cout << ans << endl;
return 0;}

Measured memory_bytes: 1024
#![allow(non_snake_case)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};
    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };
    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };
    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };
    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };
    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input!(
        r: usize,
    );
    println!("{}", r.pow(2));
}


Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;
const long long maxn = 110;
long long n,L[maxn],ans;
int main(){
    cin >> n;
    for(long long i=0;i<n;i++){
        cin >> L[i];
    }
    for(long long i=0;i<n-2;i++){
        for(long long j=i+1;j<n-1;j++){
            for(long long k = j+1;k<n;k++){
                if(L[i]!=L[j] && L[i]!=L[k] && L[j]!=L[k] && L[i]+L[j]>L[k] && L[i]+L[k]>L[j] && L[j]+L[k]>L[i]){ans++;}
            }
        }
    }
    cout<<ans;
}


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

using namespace std;

int main() {

	long long n;

	cin >> n;

	map<string, long> s;
	string ss;
	long maxx=0;
	for (long i = 0; i < n; i++) {
		cin >> ss;
		s[ss] += 1;
		maxx = max(maxx, s[ss]);
	}
	for (auto it = s.begin(); it != s.end(); it++) {
		if (it->second == maxx) {
			cout << it->first << endl;
		}
	}

	return 0;
}

Measured memory_bytes: 25216
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const long long INF = 1LL << 60;

int main() {
    int N, count = 0;
    cin >> N;
    vector<int> v(N);

    for(int i=0; i<N; i++) {
        cin >> v[i];
    }
    sort(v.begin(), v.end());

    for(int i=0; i<N; i++) {
        if(v[i] == v[i+1] && i <= N-2) {
            i++;
        }
        else {
            count++;
        }
    }
    cout << count << endl;
}

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

#define PI 3.14159265358979323846

int main() {
	int A, B, H, M;
	
	cin >> A >> B >> H >> M;

	int time;

	time = H * 60 + M;
	
	double min, hour;
	
	min = M * 6;
	hour = time * 0.5;
	double rad, ans;
	if(hour > min){
		if(hour - min >= 180){
			rad = (double)(hour - min)*PI/180.0;
			ans = sqrt(A*A+B*B-2*A*B*cos(rad));
		}
		else{
			rad = (double)(360 - hour + min)*PI/180.0;
			ans = sqrt(A*A+B*B-2*A*B*cos(rad));
		}
	}
	else{
		if(min - hour >= 180){
			rad = (double)(min - hour)*PI/180.0;
			ans = sqrt(A*A+B*B-2*A*B*cos(rad));
		}
		else{
			rad = (double)(360 - min + hour)*PI/180.0;
			ans = sqrt(A*A+B*B-2*A*B*cos(rad));
		}
		
	}
	cout << fixed << setprecision(14);
	cout << ans;
	return 0;
}

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

using namespace std;

#define int long long
#define endl "\n"

constexpr long long INF = (long long)1e18;
constexpr long long MOD = 1'000'000'007; 

string yn(bool f){return f?"Yes":"No";}
string YN(bool f){return f?"YES":"NO";}



signed main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(10);
	
	int con = 0;
	int x, y;
	
	cin>>x>>y;
	
	if(x == 3) con += 100000;
	else if(x == 2) con += 200000;
	else if(x == 1)con += 300000;
	
	if(y == 3) con += 100000;
	else if(y == 2) con += 200000;
	else if(y == 1)con += 300000;
	
	if(x == 1 && y == 1) con += 400000;
	
	cout<<con<<endl;
	
	return 0;
}

Measured memory_bytes: 256
#include <iostream>

//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <tuple>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s)
{
    int v;
    istringstream sin(s);
    sin >> v;
    return v;
}
template <class T>
inline string toString(T x)
{
    ostringstream sout;
    sout << x;
    return sout.str();
}

//math
//-------------------------------------------
template <class T>
inline T sqr(T x) { return x * x; }

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<long long> VL;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i, c) for (auto i = (c).begin(); i != (c).end(); ++i)
#define EXIST(s, e) ((s).find(e) != (s).end())
#define SORT(c) sort((c).begin(), (c).end())

//repetition
//------------------------------------------
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);

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

//debug
// #define dump(x) cerr << #x << " = " << (x) << endl;
// #define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" \
//                       << " " << __FILE__ << endl;

int main()
{
    long N, K, Q;
    cin >> N >> K >> Q;

    VL counter(N, 0);

    REP(i, Q)
    {
        long a;
        cin >> a;
        counter[a - 1] += 1;
    }

    EACH(a, counter)
    {
        if (K - (Q - *a) > 0)
        {
            cout << "Yes" << endl;
        }
        else
        {
            cout << "No" << endl;
        }
    }
}

Measured memory_bytes: 1408
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const ll MOD = 1e+9 +7 ;
int main(){
    string s;
    cin >> s;
    ll dp[100003][13] = {};
    ll del = 1;
    for(int i=s.size()-1;i>=0;i--){
        if(s[i] == '?'){
            if(i == s.size()-1){
                for(int j = 0;j<10;j++)
                    dp[i][j] = 1;
            }else{
                for(int k=0;k<10;k++){
                    for(int j = 0;j<13;j++){
                        int rem = (((del*(k))%13) + j)%13;
                        dp[i][rem] = (dp[i][rem] + dp[i+1][j]) %MOD;
                    }
                }
            }
        }else{
            if(i == s.size()-1){
                dp[i][(s[i]-'0')%13]++;
            }else{
                for(int j = 0;j<13;j++){
                    // 前の桁までの余りがjであるときにこの桁ではいくつ余るか
                    int rem = (((del*(s[i]-'0'))%13)+j)%13;
                    dp[i][rem] = (dp[i][rem] + dp[i+1][j]) %MOD;
                }
            }
        }
        del = (del*10)%13;
    }
    cout << dp[0][5] << endl;
}

Measured memory_bytes: 10624
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main(){
    ll sum=0;
    char n[200000];
    scanf("%s", &n);
    for(int i=0;i<strlen(n);++i){
        sum+= n[i]-'0';
    }
    if(sum%9==0){
        cout<<"Yes";
    }
    else{
        cout<<"No";
    }
}

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

int main() {
  int n, max = 0;
  cin >> n;
  vector<int> a(n), b(n-1);
  for (int i=0; i<n-1; i++) {
    cin >> b.at(i);
  }
  a.at(0) = b.at(0);
  a.at(n-1) = b.at(n-2);
  for (int i=0; i<n-2; i++) {
    a.at(i+1) = min(b.at(i), b.at(i+1));
  }
  for (int i=0; i<n; i++) {
    max += a.at(i);
  }
  cout << max << endl;
}

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

#define ll long long
#define ld long double

#define rep(i,a,b) for(ll i=a;i<b;i++)
#define repb(i,a,b) for(ll i=a;i>=b;i--)
#define repA(i,A)   for(auto i:A)

#define err() cout<<"=================================="<<endl;
#define errA(A) for(auto i:A)   cout<<i<<" ";cout<<endl;
#define err1(a) cout<<#a<<" "<<a<<endl
#define err2(a,b) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<endl
#define err3(a,b,c) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<" "<<#c<<" "<<c<<endl
#define err4(a,b,c,d) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<" "<<#c<<" "<<c<<" "<<#d<<" "<<d<<endl

#define mp make_pair
#define pb push_back
#define all(A)  A.begin(),A.end()
#define allr(A)	A.rbegin(),A.rend()
#define ft first
#define sd second

#define pll pair<ll,ll>
#define V vector<ll>
#define S set<ll>
#define VV vector<V> 
#define Vpll vector<pll>

#define endl "\n"

const ll logN = 20;
const ll M = 1000000007;
const ll INF = 1e12;
#define PI 3.14159265

const ll N = 100005;

const ld to_degrees = 180.0/PI;

ld theta(pll a){
	ld x = a.ft;
	ld y = a.sd;
	ld theta;
	if(x==0){
		if(y>0)	theta = PI/2;
		else theta = -PI/2;
		return theta;
	}
	theta = atan(abs(y/x));
	if(x>0){
		if(y>0)	;
		else	theta = -theta;
	}
	else{
		if(y>0)	theta = PI - theta;
		else theta = -(PI - theta);
	}
	return theta;
}


bool cmp(pll a, pll b){
	ld theta_a = theta(a);
	ld theta_b = theta(b);
	if(theta_a < theta_b)	return 1;
	else return 0;
}

pll A[105];

int main(){
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
 	ll n;
 	cin>>n;
 	rep(i,0,n){
 		ll x,y;
 		cin>>x>>y;
 		A[i] = {x,y};
 	}
 	sort(A,A+n,cmp);
 	ld ans=0;
 	rep(i,0,n){
 		ll j=i;
 		ll x=A[i].ft;
 		ll y=A[i].sd;
 		do{
 			ld cnt = sqrt(x*x+y*y);
 			ans = max(ans,cnt);
 			j = (j+1)%n;
 			x += A[j].ft;
 			y += A[j].sd;
 		}while(i!=j);
 	}
 	cout<<fixed<<setprecision(10)<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n)for(int i=0;i<(n);i++)
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define pb push_back
using ll = long long;
using P = pair<int, int>;

int main(){
    string s;
    cin >> s;
    ll ans = 0;
    rep(i, s.size()){
        ans += (s[i] - '0');
    }
    if(ans % 9 == 0) cout << "Yes" << endl;
    else cout << "No" << endl; 
}

Measured memory_bytes: 3736
#abc173c
h,w,k=map(int,input().split())
l=[list(input()) for i in range(h)]
res=0
for hh in range(2**h):
 for ww in range(2**w):
  cnt=0
  for i in range(h):
   for j in range(w):
    if (hh>>i)&1==0 and (ww>>j)&1==0:
     if l[i][j]=='#':
      cnt+=1
  if cnt==k:
   res+=1
print(res)


Measured memory_bytes: 9136
import java.util.*;

public class Main{
  public static void main(String[]args){
    Scanner sc = new Scanner(System.in);
    int N = Integer.parseInt(sc.nextLine());
    String S = sc.next();
    boolean[] b = new boolean[26];
    
    int ans = 0;
    for(int i = 1; i <= N; i++){
      String s1 = new String(S.substring(0, i));
      String s2 = new String(S.substring(i, N));
      for(int j = 0; j < s1.length(); j++){
        char c = s1.charAt(j);
        b[c-'a'] = true;
      }
      
      int count = 0;
      for(int j = 0; j < s2.length(); j++){
        char c = s2.charAt(j);
        if(b[c-'a']){
          count++;
          b[c-'a'] = false;
        }
      }
      ans = ans < count ? count : ans;
    }    
    System.out.println(ans);
  }
}

Measured memory_bytes: 21844
#include<stdio.h>
#include<stdlib.h>
int main()
{
  float fact=0.0;
  int A[1000],i,x;
  scanf("%d",&x);
  for(i=1;i<=x;i++)
  {
      if(i%2!=0)
      {
      fact++;
      }
  }
  printf("%f",fact/x);
}


Measured memory_bytes: 128
#include<stdio.h>
#include<iostream>
#include<vector>
#include<algorithm>
#include<cstdlib>
using namespace std;

vector<int> v;

int N,L;
int main (){
    cin >> N >> L;
    int total = 0;
    bool flag = false;
    for(int i=1;i<=N;i++) {
        total += L + i - 1;
        int d = L + i - 1;
        if(d == 0) flag = true;
        v.push_back(d);
    }
    sort(v.begin(),v.end());
    int x = 0;
    x = ( abs(v[0]) > abs(v[N-1]) ? v[N-1] : v[0] ) ;
    if(flag) cout << total << endl;
    else cout << total - x << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <algorithm>
#include <cmath>

using namespace std;

#define mp make_pair
#define pb push_back
#define ll long long

const ll mod = 998244353;
const ll maxN = 300011;

ll n, A, B, K, i;
ll fact[maxN], inv_fact[maxN];
ll ans, aux;

ll poww(ll a, ll b) {
    ll ans = 1;
    while (b > 0) {
        if (b & 1) ans = (ans * a) % mod;
        b >>= 1;
        a = (a * a) % mod;
    }
    return ans;
}

ll comb(ll n, ll k) {
    ll ans = (fact[n] * inv_fact[n - k]) % mod;
    ans = (ans * inv_fact[k]) % mod;
    return ans;
}

int main()
{
  //  freopen("test.in","r",stdin);

    cin >> n >> A >> B >> K;

    fact[0] = 1;
    for (i = 1; i <= n; i++) fact[i] = (fact[i - 1] * i) % mod;

    inv_fact[n] = poww(fact[n], mod - 2);
    for (i = n - 1; i >= 0; i--)
        inv_fact[i] = (inv_fact[i + 1] * (i + 1)) % mod;

    for (i = 0; i <= n; i++) {
        ll rem = K - A * i;
        if (rem < 0) break;
        if (rem % B) continue;

        ll j = rem / B;
        //cerr << rem << ' ' << comb(n, j) << '\n';
        if (j > n) continue;
        aux = (comb(n, i) * comb(n, j)) % mod;
        ans = (ans + aux) % mod;
    }

    cout << ans;

    return 0;
}


Measured memory_bytes: 4992
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (ll i=0; i<(n); ++i)
typedef long long ll;
bool debug=false;
string yes = "Yes";
string no = "No";
ll mod = 1000000007;

int main(){
  ll n,k; cin >> n >> k;
  vector<ll> v(n+1,0);
  rep(i,n){
    cin >> v[i+1];
  }
  vector<vector<ll>> from_l(n+1, vector<ll>(n+1,0));
  priority_queue<ll,vector<ll>,greater<ll>> pq_l;
  for(ll i=1; i<=n; i++){
    if(v[i]<0){pq_l.push(v[i]);}
    from_l[i][0]+=from_l[i-1][0]+v[i];
    priority_queue<ll,vector<ll>,greater<ll>> cp(pq_l);
    ll cnt=0;
    while(cp.size()>0){
      cnt++;
      ll t = cp.top(); cp.pop();
      from_l[i][cnt]=from_l[i][cnt-1]-t;
    }
    from_l[i].resize(cnt+1);
  }
  if(debug){
    cout << "from_l" << endl;
    for(auto e: from_l){
      for(auto f: e){
        cout << f << " ";
      }
      cout << endl;
    }    
  }
  vector<vector<ll>> from_r(n+1, vector<ll>(n+1,0));
  priority_queue<ll,vector<ll>,greater<ll>> pq_r;
  for(ll i=1; i<=n; i++){
    if(v[n-i+1]<0){pq_r.push(v[n-i+1]);}
    from_r[i][0]+=from_r[i-1][0]+v[n-i+1];
    priority_queue<ll,vector<ll>,greater<ll>> cp(pq_r);
    ll cnt=0;
    while(cp.size()>0){
      cnt++;
      ll t = cp.top(); cp.pop();
      from_r[i][cnt]=from_r[i][cnt-1]-t;
    }
    from_r[i].resize(cnt+1);
  }
  if(debug){
    cout << "from_r" << endl;
    for(auto e: from_r){
      for(auto f: e){
        cout << f << " ";
      }
      cout << endl;
    }
  }
  ll ans=0;
  rep(i_l,n+1)rep(j_l,n+1)rep(i_r,n+1)rep(j_r,n+1){
    if(i_l+i_r+j_l+j_r>k) continue;
    if(i_l+i_r>n) continue;
    if(from_l[i_l].size()-1>=j_l){
      if(from_r[i_r].size()-1>=j_r){
        ans=max(ans, from_l[i_l][j_l]+from_r[i_r][j_r]);
      }
    }
  }
  cout << ans;
  return 0;
}

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

int main(){
  int N;
  cin >> N;
  
  vector<int> A(N);
  int count = 0;
  bool b = true;
 
  
  for(int i=0; i<N; i++){
    cin >> A.at(i);
  }
  
  while(b == true){
  	for(int i=0; i<N; i++){  
  		if(A.at(i)%2 == 0) {
          A.at(i) = A.at(i)/2;
        }
        else{
          b = false;
          break;
        }
    }
    if(b == true){
      count++;
    }
  }
  cout << count << endl;
}


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

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

int main(void)
{
	double w, h, x, y;
	cin >> w >> h >> x >> y;
	cout << w * h / 2 << endl << bool(x * 2 == w && y * 2 == h) << endl;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(){
  char n[3];
  scanf("%s", n);
  int i;
  for(i=0;i<3;i++){
    if(n[i] == '1') n[i] = '9';
    else if(n[i] == '9') n[i] = '1';
  }
  printf("%s\n", n);
  return 0;
}

Measured memory_bytes: 128
n = int(input())
l = [int(i) for i in input().split()]

l_2 = [i for i in l if i % 2 == 0 and i % 4 != 0]
l_4 = [i for i in l if i % 4 == 0]

if len(l_2)//2 + len(l_4) >= n//2:
    print('Yes')
else:
    print('No')


Measured memory_bytes: 14252
N, C, K = map(int, input().split())
Tlist = sorted([int(input()) for _ in range(N)])
ans = 0
now = 1
start = Tlist[0]
for t in Tlist[1:]:
    if now == C:
        ans += 1
        start = t
        now = 1
    else:
        if t - start <= K:
            now += 1
        else:
            ans += 1
            start = t
            now = 1
print(ans+1)


Measured memory_bytes: 8280
#include <iostream>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <vector>
#include <stack>
#include <queue>
#include <list>
using namespace std;

int main(){

    int n, m, c;
    cin >> n >> m >> c;

    int a[n][m], b[m];
    for(int i=0; i<m; i++){
        cin >> b[i];
    }
    for(int i=0; i<n; i++){
        for(int j=0; j<m; j++){
            cin >> a[i][j];
        }
    }

    int ans = 0;
    for(int i=0; i<n; i++){
        int k = 0;
        for(int j=0; j<m; j++){
            k += a[i][j] * b[j];
        }
        k += c;
        if(k > 0){
            ans++;
        }
    }

    cout << ans;

    return 0;
}

Measured memory_bytes: 256
import java.math.BigInteger;
import java.util.Scanner;

public class Main {

	static final boolean debugMode = false;

	static final long DIV_INF = 998244353l;

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

		int n = readInt(sc) % 10;
		
		switch(n) {
			case 2:
			case 4:
			case 5:
			case 7:
			case 9:
				System.out.println("hon");
				break;
			case 0:
			case 1:
			case 6:
			case 8:
				System.out.println("pon");
				break;
			default:
				System.out.println("bon");
				break;
		}
		

	}

	static long div(long x) {
		return x % DIV_INF;
	}

	static int readInt(Scanner sc) {
		return Integer.parseInt(sc.next());
	}

	static Long readLong(Scanner sc) {
		return Long.parseLong(sc.next());
	}

	static void log(String s) {
		if (debugMode) {
			System.out.println(s);
		}
		return;
	}
}

class KrmlUtil {
	// a >= b
	static int gcd(int a, int b) {
		while (true) {
			if (b == 0)
				break;

			int mod = a % b;
			a = b;
			b = mod;
		}
		return a;
	}

	// a >= b
	static int lcm(int a, int b) {
		return a * b / gcd(a, b);
	}

	// a >= b
	static long gcd(long a, long b) {
		while (true) {
			if (b == 0)
				break;

			long mod = a % b;
			a = b;
			b = mod;
		}
		return a;
	}

	// a >= b
	static long lcm(long a, long b) {
		return a * b / gcd(a, b);
	}

	static BigInteger gcd(BigInteger a, BigInteger b) {
		return a.gcd(b);
	}

	static BigInteger lcm(BigInteger a, BigInteger b) {
		return a.divide(a.gcd(b)).multiply(b);
	}
}

class Pair {
	private int x;
	private int y;

	public int getX() {
		return x;
	}

	public void setX(int x) {
		this.x = x;
	}

	public int getY() {
		return y;
	}

	public void setY(int y) {
		this.y = y;
	}

	public Pair() {

	}

	public Pair(int x, int y) {
		this.x = x;
		this.y = y;
	}

}



Measured memory_bytes: 35712
#include<iostream>
#include<algorithm>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)

double n;
double p;

int main() {
	cin >> n;
	if ((int(n) % 2) == 0) {
		cout << 0.5000000000;
	}
	else {
		p = (n + 1) / n;
		cout << (n + 1) / (2 * n);
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <math.h>
using namespace std;
int main(){
  /*int t;
  cin >> t;
  for (int j = 0; j < t; j++){*/
  int n;
  cin >>n;
  int x[n];
  for (int i = 0; i < n; i++){
    cin >> x[i];
  }
  long long int r = 100*100*100;
  for (int i = 0; i <= 100; i++){
    long long int cu = 0;
    for (int j = 0; j < n; j++){
      cu += (x[j]-i)*(x[j]-i);
    }
    r = min(r, cu);
  }
  cout << r << "\n";
  //}
  return 0;
}


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

bool iseven(ull v)
{
    return (v & 1ULL) ? false : true;
}

int main()
{
    ios_base::sync_with_stdio(false);
    ull h, w;
    cin >> h >> w;
    ull g = h * w;
    ull ans;
    if (h == 1 || w == 1) {
        ans = 1ULL;
    } else if (iseven(h) || iseven(w)) {
        ans = g / 2ULL;
    } else {
        ans = g / 2ULL + 1;
    }
    cout << ans << endl;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define r(i,n) for(int i=0;i<n;i++)
using namespace std;
 
int n,E,Q;
int cap[5002][5002];
 
bool used[5550];
vector<int>G[5002];
 
void add_edge(int from,int to,int X){
    G[from].push_back(to);
    G[to].push_back(from);
    cap[from][to]=cap[to][from]+=X;
}
 
int dfs(int v,int t,int f){
    if(v==t)return f;
    used[v]=1;
    for(int i=0;i<G[v].size();i++){
        int e=G[v][i];
        if(!(!used[e]&&cap[v][e]>0))continue;
        int d=dfs(e,t,min(f,cap[v][e]));
        if(d){
            cap[v][e]-=d;
            cap[e][v]+=d;
            return d;
        }
    }
    return 0;
}
 
int flow(int s,int t,int lim){
    int fl=0;
    for(;;){
        memset(used,0,sizeof(used));
        int f=dfs(s,t,lim);
        if(!f)return fl;
        fl+=f;
        lim-=f;
    }
}

int A[10000];
int B[10000];
int C[10000];

int main(){
    cin>>n>>E;
    r(i,E){
        int s,t,z;
        cin>>s>>t>>z;
        A[i]=s;
        B[i]=t;
        C[i]=z;
        add_edge(s,t,z);
    }
    int ANS=flow(0,n-1,1e4+2);

    if(ANS==1e4+2){
        cout<<-1<<endl;
        return 0;
    }

    r(i,E){
        if(C[i]!=1)continue;
        int s=A[i];
        int t=B[i];
            if(cap[t][s]==2)swap(s,t);
            if(cap[s][t]==2){
                int x=flow(t,s,1);
                if(!x){
                    flow(n-1,0,1);
                    flow(t,s,1);
                    ANS--;
                    cout<<ANS<<endl;
                    return 0;
                }
            }
    }
    if(ANS==1e4+1){
        cout<<-1<<endl;
        return 0;
    }
    cout<<ANS<<endl;
}


Measured memory_bytes: 37888
class Node
    attr_accessor :parent, :left, :right
    def initialize(p, l, r)
        @parent = p
        @left = l
        @right = r
    end
end

def make_tree n
    tree = {}
    [*0...n].each do |i|
        tree[i] = Node.new(-1, nil ,nil)
    end

    n.times do
        k, l, r = gets.chomp.split.map(&:to_i)
        tree[k].left = l
        tree[k].right = r
        tree[l].parent = k if tree[l] != nil
        tree[r].parent = k if tree[r] != nil
    end
    tree
end

def preorder(i, tree)
    if i != -1
      print " #{i}"
      preorder(tree[i].left, tree)
      preorder(tree[i].right, tree)
    end
end

def inorder(i, tree)
    if i != -1
        inorder(tree[i].left, tree)
        print " #{i}"
        inorder(tree[i].right, tree)
    end
end

def postorder(i, tree)
    if i != -1
      postorder(tree[i].left, tree)
      postorder(tree[i].right, tree)
      print " #{i}"
    end
end

n = gets.chomp.to_i
tree = make_tree(n)
root = -1

tree.each do |(k, v)|
    root = k if v.parent == -1
end

puts "Preorder"; preorder(root, tree); puts
puts "Inorder"; inorder(root, tree); puts
puts "Postorder"; postorder(root, tree); puts


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

using namespace __gnu_pbds;
using namespace std;

template <class T>
using ordered_set =
       tree <T,null_type,less <T>,rb_tree_tag,tree_order_statistics_node_update> ;
///find_by_order()
///order_of_key()

template <class T,class U>
void maximize(T &x,U y){
    if(x < y)x=y;
}
template <class T,class U>
void minimize(T &x,U y){
    if(x > y)x=y;
}
template <class T>
T Abs(T x){
    return (x < (T)0 ? -x : x);
}
template <class T>
T safe_sqrt(T x){
    return sqrt(max(x,(T)0));
}
template <class T,class U,class V>
T addmod(T x,U k,V MOD){
    return ((x+k)%MOD + MOD)%MOD;
}
template <class T,class U,class V>
T submod(T x,U k,V MOD){
    return ((x-k)%MOD + MOD)%MOD;
}
template <class T,class U,class V>
T mul(T x,U y,V MOD){
    return ( (x % MOD) * (y % MOD) ) % MOD;
}

#define ll long long
#define pll pair <ll,ll>
#define pii pair <int,int>
#define fir first
#define sec second
#define mp make_pair
#define pb push_back
#define emp emplace_back
#define MASK(i) ((1LL)<<(i))
#define BIT(x,i) (((x)>>(i))&1)
#define all(c) (c).begin(),(c).end()
#define sz(c) (int)((c).size())
#define fn "test"    ///FILE_NAME_HERE

/*------------------------------------------END_OF_TEMPLATE------------------------------------------*/

namespace task{

	const int N = 1e5 + 5;
	int n;
	int h[N],f[N];

    void solve(){
    	cin>>n;
    	for(int i = 1;i <= n;++i){
    		cin>>h[i];
    		f[i] = 2e9;
    	}
    	f[1] = 0,f[2] = Abs(h[2] - h[1]);
    	for(int i = 3;i <= n;++i){
    		minimize(f[i],min(f[i - 1] + Abs(h[i] - h[i - 1]),f[i - 2] + Abs(h[i] - h[i - 2])));
    	}
    	cout<<f[n];
    }
}

int main(void){
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    task::solve();
}


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

using namespace std;
 
//#define int long long
using ll = long long;
#define all(v) (v).begin(), (v).end()
#define rep(i,n) for(ll i=0;i<n;i++)
#define reps(i,n) for(ll i=0;i<=n;i++)

ll MOD = 1000000007;
const long long L_INF = 1LL << 60;
const int INF = 2147483647; // 2^31-1
const double PI = acos(-1);
 
const ll dx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll dy[8] = {0, 1, 1, 1, 0, -1, -1, -1};

int main(){
    ios_base::sync_with_stdio(false);
    ll k;
    cin >> k;
    vector<ll> a(k,0);
    a[1]=7;
    for(int i=1;i<=k;i++){
        if(i!=1){
            a[i]=(10*a[i-1]+7);
            a[i]%=k;
        }
        if(a[i]%k==0){
            cout << i << endl;
            return 0;
        }
    }
    cout << -1 << endl;
    return 0;
}


Measured memory_bytes: 11096
#include <stdio.h>

int max(int a, int b) {
    if (a > b) {
        return a;
    } else {
        return b;
    }
}

int main(void) {
    int N;
    scanf("%d", &N);
    char S[N];
    scanf("%s", S);

    int c = 0, m = 0, mi = 0;

    for(int i = 0; i < N; i++) {
        switch(S[i]) {
            case 'E':
                c++;
                break;
            case 'W':
                c--;
                break;
        }
        
        if(c > m) {
            m = c;
            mi = i;
        }
    }

    int ans = 0;

    for(int i = 0; i < mi; i++) {
        if (S[i] == 'W') {
            ans++;
        }
    }

    for(int i = mi + 1; i < N; i++) {
        if (S[i] == 'E') {
            ans++;
        }
    }

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


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define debug(x) cerr << #x << " = " << x << endl;
#define debugv(x,n) {for(int i = 0;i < n;i++) cerr << x[i] << " ";cerr<<endl;}
#define rep(i,a,b) for(int i = a;i <b;i++)
int n,v[90],a[90],c[90];	
bool cmp(){
	rep(i,0,n)
		if(v[i]!=a[i])
			return false;
	return true;	
}
bool cmp2(){
	rep(i,0,n)
		if(c[i] != a[i])
			return false;
		return true;
}
int main(){
	scanf("%d",&n);
	rep(i,0,n) scanf("%d",&v[i]),a[i] = v[i];
	sort(a,a+n);
	bool deu = false;
	if(cmp())
		deu = true;
	rep(i,0,n){
		rep(j,0,n){
			swap(v[i],v[j]);
			deu|=cmp();
			swap(v[i],v[j]);
		}
	}
	if(deu) puts("YES");
	else puts("NO");
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,ini,n) for(int i=ini;i<n;i++)
#define _rep(i,ini,n) for(int i=ini;i>=n;i--)
#define ToEnd(a) a.begin(),a.end()
uint64_t MOD=1000000007;

int main(){
    string A,B; cin>>A>>B;
    
    string ans="EQUAL";
    if(A.size()>B.size()) ans="GREATER";
    else if(A.size()<B.size()) ans="LESS";
    else{
        rep(i,0,A.size()){
            int a=A.at(i),b=B.at(i);
            if(a>b){ans="GREATER";break;}
            else if(a<b){ans="LESS";break;}
        }
    }

    cout<<ans<<endl;
}

Measured memory_bytes: 256
using System;

class Program
{
    static void Main(string[] args)
    {
        string str = Console.ReadLine();
        //string[] str = Console.ReadLine().Split(' ');//2つ以上のスペース区切り入力の取得
        //string str = "<>>><<><<<<<>>><";
        long N = Int64.Parse(str);
        //string[] strA = Console.ReadLine().Split(' ');//2つ以上のスペース区切り入力の取得
        //string[] strB = Console.ReadLine().Split(' ');//2つ以上のスペース区切り入力の取得

        //long[] A = new long[N];
        //long[] B = new long[N];

        long time = N * N;

        Console.WriteLine(time.ToString());
    }
}

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

namespace AtCoderBS
{
    class Program
    {
        static void Main(string[] args)
        {
            // input
            string strOut = null;

            for (int i = 0; i < 3; i++)
            {
                string str = Console.ReadLine();
                strOut += str[i];
            }
            // output
            Console.Write(strOut);
            Console.Read();
        }
    }
}


Measured memory_bytes: 13140
#include <algorithm>
#include <bitset>
#include <cstdio>
#include <functional>
#include <initializer_list>
#include <iostream>
#include <limits.h>
#include <list>
#include <map>
#include <math.h>
#include <queue>
#include <regex>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <utility>
#include <vector>
#define REP(i, a, n) for (int i = (a); i < (int)(n); ++i)
#define REPC(i, a, n) for (int i = (a); i <= (int)(n); ++i)
#define ALL(t) t.begin(), t.end()
#define RALL(t) t.rbegin(), t.rend()
#define Yes(cond) cout << (cond ? "Yes" : "No") << endl;
#define YES(cond) cout << (cond ? "YES" : "NO") << endl;
#define DBG(str) cerr << (str) << endl;
using namespace std;
using LL = long long;
using ULL = unsigned long long;
template <class T>
using VEC = std::vector<T>;
template <class T>
using MAT = std::vector<std::vector<T>>;
void DUMP() { cerr << endl; }
template <class Head, class... Tail>
void DUMP(Head &&head, Tail &&... tail)
{
  cerr << head << ", ";
  DUMP(std::move(tail)...);
}
template <typename T>
ostream &operator<<(ostream &os, vector<T> &vec)
{
  os << "{";
  for (auto v : vec)
    os << v << ",";
  os << "}";
  return os;
}

bool isPrime(int n);
int main()
{
  int n;
  cin >> n;
  VEC<int> f(n + 1, 0);
  VEC<int> prime(n + 1, 0);
  int count = 0;
  REPC(i, 0, n)
  {
    if (isPrime(i))
    {
      prime[count] = i;
      count++;
    }
  }
  DUMP("prime", prime);
  int c = 0;
  while (c < count)
  {
    REPC(i, 1, n)
    {
      int dividen = i;
      while (dividen % prime[c] == 0)
      {
        dividen /= prime[c];
        ++f[c];
      }
    }
    c++;
  }
  DUMP(f);
  LL ans = 1;
  REPC(i, 0, c)
  {
    ans = (ans*(f[i]+1))%((LL)1e9+7);
  }
  cout << ans << endl;

  return 0;
}
bool isPrime(int n)
{
  // returns whether n is prime number or not
  // n should be in range [0, lim].
  // to see detail, search "Sieve of Eratosthenes"
  static int lim = 1e5;
  static bool done = false;
  static vector<bool> isp(lim + 1, 1);
  if (!done)
  {
    isp[0] = isp[1] = false;
    for (int i = 2; i <= lim; i++)
    {
      if (isp[i])
      {
        for (int j = i + i; j <= lim; j += i)
        {
          isp[j] = false;
        }
      }
    }
    done = true;
  }
  return isp[n];
}


Measured memory_bytes: 256
import java.util.*;
class Main
{
    public static void main(String args[]) {
        String s1,s2;
        int count=0;
        Scanner sc=new Scanner(System.in);
        s1=sc.nextLine();
        s2=sc.nextLine();
        for(int i=0;i<s1.length();i++)
        {
            if(s1.charAt(i)!=s2.charAt(i)){
                count++;
            }
        }
        System.out.println(count);
    }
}

Measured memory_bytes: 42324
#include <bits/stdc++.h>
using namespace std;
#define rep(i, j) for(int i=0; i < (int)(j); i++)
template<class T> istream& operator >> (istream &is , vector<T> &v) { for(T &a : v) is >> a; return is; }

class Solver {
  public:
    bool solve() {
        int H; cin >> H;
        if(H == 0) return false;
        vector<vector<int>> G(H, vector<int>(5)); cin >> G;
        int sum = 0;
        bool ok = true;
        auto clear = [&] (int h, int x, int seq) {
            sum += seq * G[h][x];
            rep(i, seq) G[h][x - i] = 0;
            ok = true;
        };
        while(ok) {
            ok = false;
            rep(h, H) {
                int prev = 0, seq = 0;
                rep(x, 5) {
                    if(prev > 0 and G[h][x] == prev) {
                        seq++;
                    } else {
                        if(seq >= 3) clear(h, x - 1, seq);
                        seq = 1;
                        prev = G[h][x];
                    }
                }
                if(seq >= 3) clear(h, 5 - 1, seq);
            }
            rep(x, 5) {
                int pos = H - 1; 
                for(int h = H - 1; h >= 0; h--) {
                    while(pos > h and G[pos][x] != 0) pos--;
                    if(G[pos][x] == 0) swap(G[pos][x], G[h][x]);
                }
            }
        }
        cout << sum << endl;
        return true;
    }
};

int main() {
    while(Solver().solve());
    return 0;
}

Measured memory_bytes: 3056
// B.

#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>

using namespace std;

int main(int argc, char *argv[]) {
	string s;
	cin >> s;
	cout << s.front() << (s.length() - 2) << s.back() << endl;
	return 0;
}


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

ll ppow(ll a,ll b){
	a %= MOD;
	ll res = 1;
	while(b){
		if(b & 1) res = (res * a) % MOD;
		a = (a * a) % MOD;
		b >>= 1;
	}
	return res;
}

vector<ll> prime_enum(ll n){
    vector<ll> res;
    vector<bool> is_prime(n, true);
    is_prime[0] = false; is_prime[1] = false;
    for(ll i = 2; i < n; i++){
        if(!is_prime[i]) continue;
        res.push_back(i);
        for(ll j = 2; i * j < n; j++){
            is_prime[i*j] = false;
        }
    }
    return res;
}

map<ll,int> prime_factor(ll n, vector<ll> primes){
	map<ll, int> res;
	for(ll p: primes){
        if(p * p > n) break;
		while(n % p == 0){
			res[p]++;
			n /= p;
		}
	}
	if(n != 1) res[n]++;
	return res;
}

int main(void){
    int n;
    cin >> n;
    vector<ll> A(n);
    rep(i,n) cin >> A[i];

    vector<ll> primes = prime_enum(1e3);
    
    map<ll, int> lcm;
    rep(i,n){
        auto fac = prime_factor(A[i], primes);
        for(auto p: fac){
            lcm[p.first] = max(lcm[p.first], p.second);
        }
    }
    ll L = 1;
    for(auto p:lcm){
        L = (L * ppow(p.first, p.second)) % MOD;
    }
    ll ans = 0;
    for(ll a:A){
        ans = (ans + L * ppow(a, MOD-2)) % MOD;
    }
    cout << ans << endl;
    return 0;
}

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

int main(){
    map<long long,long long> a;
    rep(i,100001){
        a[i]=0;
    }
    long long n;
    cin >> n;
    rep(i,n){
        long long temp;
        cin >> temp;
        a[temp]++;
    }
    long long q;
    cin >> q;
    vector<long long> s;
    long long ans=0;
    rep(i,q){
        long long b,c;
        cin >> b >> c;
        ans -= b*a[b];
        ans += c*a[b];
        a[c] = a[b] + a[c];
        a[b] = 0;
        if(i==0){
            ans = 0;
            rep(j,100001){
                long long t;
                t = a[j]*j;
                ans += t;
            }
        }
        s.push_back(ans);
    }
    rep(i,q){
        cout << s.at(i) << endl;
    }

}

Measured memory_bytes: 10564