akhauriyash/Code-Regression huggingface dataset:
import java.util.*;
 
public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
      	int a = sc.nextInt();
      	int b = sc.nextInt();
      	int c = sc.nextInt();
      	int d = sc.nextInt();
      
      	if(a + b > c + d) {
        	System.out.println("Left");  
        } else if(a + b < c + d) {
          	System.out.println("Right");
        } else {
         	System.out.println("Balanced"); 
        }
	}
}

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

int N;
vector<int> A;
int all;
int ans;

void solve() {
  for (int i = 0; i <= N; ++i) {
    all += abs(A[i] - A[i + 1]);
  }
  for (int i = 1; i <= N; ++i) {
    ans = all - (abs(A[i - 1] - A[i]) + abs(A[i] - A[i + 1])) + abs(A[i - 1] - A[i + 1]);
    cout << ans << "\n";
  }
}

int main() {
  cin >> N;
  A.resize(N + 2);
  A[0] = 0;
  A[N + 1] = 0;
  for (int i = 1; i <= N; ++i) {
    cin >> A[i];
  }
  solve();
}

Measured memory_bytes: 1664
A = gets.to_i 
b = gets.chomp.split(" ").map(&:to_i)
sorted_list = []
sort_count = 0
b.each_with_index do |num,i|
    min_index = 0 
    min_num = -1
    (i).upto(A-1) do |j|
        if min_num >= 0
            num_index = (min_num > b[j]) ? [b[j], j] : [min_num, min_index]
            min_num, min_index = num_index[0],num_index[1]
        else
            min_num = b[j]
            min_index = j
        end
    end
    if b[i] != b[min_index]
        b[i],b[min_index] = b[min_index],b[i]
        sort_count += 1
    end
end
output_string = ""
b.each_with_index do |num,i|
    if i == 0
        output_string = "#{num}"
    else
        output_string = output_string + " #{num}"    
    end
end
puts output_string
p sort_count



Measured memory_bytes: 6868
k = gets.to_i

@memo = Array.new(201).map{Array.new(201, 1)}
def gcdmemo(i, j)
  return @memo[i][j] if @memo[i][j] > 1
  return 1 if i == 1 || j == 1
  u, v = i, j
  while (j > 0) do
    r =  i % j
    i = j
    j = r
  end
  @memo[u][v] = i
end
1.upto(200) do |i|
  1.upto(200) do |j|
    gcdmemo(i, j)
  end
end
ans = 0
1.upto(k) do |i|
  1.upto(k) do |j|
    c = @memo[i][j]
    1.upto(k) do |l|
      ans += @memo[c][l]
    end
  end
end
puts ans

Measured memory_bytes: 14508
import numpy as np
import itertools
n, m, x = map(int, input().split())
c = []
a = []
p = [0] * m
for i in range(n):
  l = list(map(int, input().split()))
  c.append(l[0])
  a.append(l[1:])
  for j in range(m):
    p[j] += l[j + 1]

if min(p) < x:
  ans = -1
else:
  l = [0, 1]
  buy = list(itertools.product(l, repeat=n))
  point = []
  price = []
  for  i in range(len(buy)):
    result = [0] * m
    k = 0
    for j in range(n):
      result += np.array(a[j]) * buy[i][j]
      k += c[j] * buy[i][j]
    if min(result) >= x:
      point.append(result)
      price.append(k)
  ans = min(price)
print(ans)

Measured memory_bytes: 28248
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define rrep(i,n) for(int i=1;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int inf = 1001001001;
const int mod = 1000000007;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n;
	cin >> n;
	set<string> st;
	rep(i, n) {
		string s;
		cin >> s;
		st.insert(s);
	}
	cout << st.size() << endl;
	return 0;
}


Measured memory_bytes: 19184
#include <stdio.h>

int main(void){
    int A, B, a, b, c;
    scanf("%d %d", &A, &B);
    a = A+B; b = A-B; c = A*B;
    if(a>=b && a>=c)printf("%d\n", a);
    else if(b>=c) printf("%d\n", b);
    else printf("%d\n", c);
    return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <functional>
#include <unordered_set>
using namespace std;

int main(void) {
    char S[200001] = {};
    char T[200001] = {};
    cin >> S >> T;
    long count = 0;
    for(int i = 0; S[i]!='\0'; i++)
    {
        if(S[i]!=T[i])
            count++;
    }
    cout << count << endl;
}



Measured memory_bytes: 4028
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int main() {
  int n;
  long long k;
  scanf("%d %lld", &n, &k);
  vector<int> a(n), f(n);
  for (int i = 0; i < n; i++)
    scanf("%d", &a[i]);
  for (int i = 0; i < n; i++)
    scanf("%d", &f[i]);

  sort(a.begin(), a.end());

  long long left = 0, right = 1e12;
  while (left < right) {
    long long mid = (left + right) / 2;
    
    vector<long long> t(n);
    for (int i = 0; i < n; i++) {
      t[i] = mid / f[i];
    }

    sort(t.begin(), t.end());
    long long s = 0;
    for (int i = 0; i < n; i++) 
      if (a[i] > t[i])
        s += a[i] - t[i];
    
    if (s <= k)
      right = mid;
    else
      left = mid + 1;
  }
  printf("%lld\n", left);

  return 0;
}


Measured memory_bytes: 3428
#include <bits/stdc++.h>
#define int long long
#define pii pair<int,int>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(c) (c).begin(),(c).end()
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
#define MINF(a) memset(a,0x3f,sizeof(a))
#define POW(n) (1LL<<(n))
#define IN(i,a,b) (a <= i && i <= b)
using namespace std;
template <typename T> inline bool CHMIN(T& a,T b) { if(a>b) { a=b; return 1; } return 0; }
template <typename T> inline bool CHMAX(T& a,T b) { if(a<b) { a=b; return 1; } return 0; }
template <typename T> inline void SORT(T& a) { sort(ALL(a)); }
template <typename T> inline void REV(T& a) { reverse(ALL(a)); }
template <typename T> inline void UNI(T& a) { sort(ALL(a)); a.erase(unique(ALL(a)),a.end()); }
const int MOD = 1000000007;
const int INF = 0x3f3f3f3f3f3f3f3f;
const double EPS = 1e-10;
/* ---------------------------------------------------------------------------------------------------- */

int M,K;

signed main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(10);

  cin >> M >> K;
  if (M == 0) {
    if (K == 0) cout << "0 0" << endl;
    else cout << -1 << endl;
    return 0;
  }
  if (M == 1) {
    if (K == 0) cout << "0 0 1 1" << endl;
    else cout << -1 << endl;
    return 0;
  }
  int N = POW(M);
  if (K >= N) {
    cout << -1 << endl;
    return 0;
  }
  vector<int> v,w;
  for (int i = 0; i < N; i++) {
    if (K != i) v.push_back(i);
  }
  w = v;
  REV(w);
  v.push_back(K);
  for (int ww : w) v.push_back(ww);
  v.push_back(K);
  for (int i = 0; i < v.size(); i++) {
    cout << v[i] << " \n"[i+1==v.size()];
  }

  return 0;
}

Measured memory_bytes: 5104
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;

// template {{{  0 
// using {{{ 1
using ll = long long int;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vii = vector<pii>;
using vll = vector<pll>;
// }}} 1
// definition {{{ 1
// scaning {{{ 2
#define Scd(x) scanf("%d", &x)
#define Scd2(x,y) scanf("%d%d", &x, &y)
#define Scd3(x,y,z) scanf("%d%d%d", &x, &y, &z)
#define Scll(x) scanf("%lld", &x)
#define Scll2(x,y) scanf("%lld%lld", &x, &y)
#define Scll3(x,y,z) scanf("%lld%lld%lld", &x, &y, &z)
#define Scc(c) scanf("%c", &c);
#define Scs(s) scanf("%s", s);
#define Scstr(s) scanf("%s", &s);
// }}} 2
// constants {{{ 2
#define EPS (1e-7)
#define INF (2e9)
#define PI (acos(-1))
// }}} 2
// systems {{{ 2
#define Repe(x,y,z) for(ll x = z; x < y; x++)
#define Rep(x,y) Repe(x,y,0)
#define RRepe(x,y,z) for(ll x = y-z-1; x >= 0; x--)
#define RRep(x,y) RRepe(x,y,0)
// }}} 2
// output {{{ 2
#define YesNo(a) (a)?printf("Yes\n"):printf("No\n")
#define YESNO(a) (a)?printf("YES\n"):printf("NO\n")
// }}} 2
// }}} 1
// input {{{ 1
// }}} 1
// }}} 0

int main() {

    int A,B,M;
    Scd3(A,B,M);
    vi a(A);
    vi b(B);

    int x,y,c;
    Rep(i,A) Scd(a[i]);
    Rep(i,B) Scd(b[i]);
    int ans = INF;
    Rep(i,M){
        Scd3(x,y,c);
        x--,y--;
        ans = min( ans, a[x]+b[y]-c );
    }

    sort(a.begin(),a.end());
    sort(b.begin(),b.end());


    ans = min( ans, a[0]+b[0] );
    printf ("%d\n", ans );


    return 0;
}



Measured memory_bytes: 1024
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
int main(void)
{
	int i;
	vector<int> c;
	for(i=0;i<12;i++){
		int temp;
		cin>>temp;
		c.push_back(temp);
    }
	sort(c.begin(),c.end());
	if(c[0]==c[1] && c[1]==c[2] && c[2]==c[3]&&c[4]==c[5] && c[5]==c[6] && c[6]==c[7]&&c[8]==c[9] && c[10]==c[9] && c[10]==c[11])
    cout<<"yes"<<endl;

	else
	cout<<"no"<<endl;
	return 0;
}



Measured memory_bytes: 3164
/*
@Author
   Sujeet Kushwaha
*/
 
#include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
 
#define ll long long int
#define fast ios_base::sync_with_stdio(false)
#define fast_input cin.tie(NULL)
#define fast_output cout.tie(NULL)
#define vi vector<long long int> 
#define vp vector<pair<long long int ,long long int>>
#define pb push_back
#define mp make_pair
#define pp pop_back
#define iter vector<int>::iterator
#define pa pair<long long int ,long long int> 
#define f(a,b) for(int a=0;a<b;a++)
#define mod 1000000007
#define F first
#define S second
#define sett set<long long int>
#define um unordered_map<ll,ll>
#define ordered_set tree<pa, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
// ll powmod(ll a, ll b)
// {
//     ll res = 1;
//     while (b) {
//         if (b&1) {
//             res *= a;
//             res %= mod;
//         }
//         b >>= 1;
//         a = (a * a) % mod;
//     }
 
//     return res;
// }
 
// ll modInv(ll a)
// {
//     return powmod(a, mod - 2);
// }
// int fastread(){
//     int x=0;
//     int c = getchar_unlocked();
//     while(c<48)
//         c = getchar_unlocked();
//     while(c>=48){
//         x = x*10 + (c - 48);
//         c = getchar_unlocked();
//     }
//     return x;
// }
bool comp(pa a,pa b)
{
   if(a.F==b.F)
      return a.S<b.S;
   return a.F<b.F;
}
void solve()
{
  ll n;
  cin>>n;
  vector<pa>v;
  for(int i=0;i<n;i++)
  {
     ll a;
    cin>>a;
    v.pb(mp(a,i));
  }
  sort(v.begin(),v.end(),comp);
  ll tot=0;
  if(v[0].F==1)
  {
  tot=1;
  ll co=2;
  ll prev=1;
  ll mi=v[0].S;
  for(int i=1;i<v.size();i++)
  {
    if(v[i].F==prev)
       continue;
    else
    {
      if(v[i].F==co&&v[i].S>mi)
      {
        tot++;
        mi=v[i].S;
        prev=co;
        co++;
      }
    }
  }
  }
  if(tot==0)
     cout<<-1;
  else
  cout<<n-tot;
}
int main() {
	fast;
	fast_input;
	fast_output;
	
	  solve();
	
	return 0;
}

Measured memory_bytes: 6384
D = int(input())
C = list(map(int, input().split()))
S = [list(map(int, input().split())) for _ in range(D)]
ans = [i%26 for i in range(1,D+1)]
manzoku_down = [0]*26
for i in range(D):
    tmp = -float('inf')
    for j in range(26):
        last = 0
        for l in range(0,i+1):
            if ans[l] == j+1:
                last = j+1
        manzoku_down[j] = C[j]*((i+1)-last)
    for k in range(26):
        if S[i][k]-sum(manzoku_down)+manzoku_down[k] >= tmp:
            tmp = S[i][k]-sum(manzoku_down)+manzoku_down[k]
            ans[i] = k+1
for i in ans:
    print(i)

Measured memory_bytes: 68752
N = int(input())
A = list(map(int, input().split()))
A_abs = [0]*N
for i in range(N):
    A_abs[i] = abs(A[i])

minus_count = 0
for i in range(N):
    if A[i] < 0:
        minus_count += 1
if 0 in A:
    minus_count = 0

if minus_count == 0 or minus_count % 2 == 0:
    print(sum(A_abs))
else:
    print(sum(A_abs)-2*min(A_abs))

Measured memory_bytes: 14412
import core.bitop, std.algorithm, std.ascii, std.bigint, std.conv, std.math,
    std.functional, std.numeric, std.range, std.stdio, std.string, std.random,
    std.typecons, std.container, std.format;

// dfmt off
T lread(T = long)(){return readln.chomp.to!T();}
T[] aryread(T = long)(){return readln.split.to!(T[])();}
void scan(TList...)(ref TList Args){auto line = readln.split();
foreach (i, T; TList){T val = line[i].to!(T);Args[i] = val;}}
alias sread = () => readln.chomp();enum MOD = 10 ^^ 9 + 7;
// dfmt on

void main()
{
    long N, P;
    scan(N, P);
    auto A = aryread();
    auto dp = new long[][](N + 1, 2);
    dp[0][0] = 1;
    foreach (i; 0 .. N)
    {
        dp[i + 1][0] = dp[i][0];
        dp[i + 1][1] = dp[i][1];
        if (A[i] & 1)
        {
            dp[i + 1][0] += dp[i][1];
            dp[i + 1][1] += dp[i][0];
        }
        else
        {
            dp[i + 1][0] += dp[i][0];
            dp[i + 1][1] += dp[i][1];
        }
    }
    writeln(dp[N][P]);
}


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

# @date Time-stamp: <2019-04-20 21:58:06 tagashira>
# @file a.cpp
# @brief https://tenka1-2019-beginner.contest.atcoder.jp/tasks/tenka1_2019_b

N = int(input())
S = str(input())
K = int(input())

replace_char = S[K-1]
# print(replace_char)

output= ""
for char in S:
  if char != replace_char:
    output +="*"
  else:
    output +=char

print(output)


Measured memory_bytes: 2940
#include <iostream>
#include <cmath>
#include <vector>
#include <queue>
#include <string>
#include <map>
#include <algorithm>
#include <limits>
#include <ios>
#include <iomanip>
using namespace std;

#define rep(i,N) for(int i=0; i<N; i++)
#define revrep(i,N) for(int i=N-1; i>=0; i--)

typedef long long ll;
typedef unsigned int uint;

int main(void)
{
    vector<uint> a(5);
    rep(i,5){
        cin >> a.at(i);
    }


    uint ret = 0;

    uint min = 10;
    uint min_idx = 0;
    rep(i,5){
        if(a.at(i)%10 < min && a.at(i)%10 != 0) {
            min = a.at(i)%10;
            min_idx = i;
        }
    }
    
    rep(i,5){
        if (i == min_idx) {
            ret += a.at(i);
        } else {
            if (a.at(i)%10 != 0) {
                ret += (a.at(i) - a.at(i)%10 + 10);
            } else {
                ret += a.at(i);
            }
        }
    }

    cout << ret << endl;
    
    return 0;
}


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

using namespace std;

typedef pair<int,int> pii;
typedef vector<int> vi;

int main () {
    // N
    // A_1 ...... A_N
    int R;
    cin >> R;
    cout << 2*3.14*R << endl;
    return 0;
}

Measured memory_bytes: 3216
#include <iostream>
#include <vector>
#include <utility>
#include <numeric>
#include <functional>
#include <stdio.h>
#include <math.h>
#include <string>
#include <algorithm>
#include <deque>
#include <queue>
#include <map>
#include <chrono>

using namespace std;
using ll = long long;

int main() {
	int N;
	cin >> N;
	if (N == 1) {
		cout << "Hello World" << endl;
	}
	else {
		int a, b;
		cin >>a;
		cin >>b;
		cout << a + b << endl;
	}
	return 0;
}


Measured memory_bytes: 888
n = int(input())
b = input().split()
b = [int(s) for s in b]
a = []
for i in range(len(b)+1): a.append(-1)
a[0] = b[0]
for i in range(len(b)-1):
        if b[i] < b[i+1]: a[i+1] = b[i]
        else: a[i+1] = b[i+1]
a[len(b)] = b[len(b)-1]
#print(a)
print(sum(a))

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

#define PB push_back  
#define MP make_pair  
#define SZ(v) ((int)(v).size())  
#define FOR(i,a,b) for(int i=(a);i<(b);++i)  
#define REP(i,n) FOR(i,0,n)  
#define FORE(i,a,b) for(int i=(a);i<=(b);++i)  
#define REPE(i,n) FORE(i,0,n)  
#define FORSZ(i,a,v) FOR(i,a,SZ(v))  
#define REPSZ(i,v) REP(i,SZ(v))  
template<class Iter> void rprintf(const char *fmt, Iter begin, Iter end) {
    for (bool sp=0; begin!=end; ++begin) { if (sp) putchar(' '); else sp = true; printf(fmt, *begin); }
    putchar('\n');
}
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> VI;
#define db double
ll gcd(ll a,ll b) { return b==0?a:gcd(b,a%b); }
const int maxn=200008;
int a[maxn],b[maxn];
int main()
{
	int n,m;
	while(scanf("%d",&n)==1)
	{
		REP(i,n)
			scanf("%d",&a[i]);
		scanf("%d",&m);
		REP(i,m)
			scanf("%d",&b[i]);
		sort(a,a+n);
		sort(b,b+m);
		int j=0;
		bool ans=true;
		REP(i,m){
			bool flag=false;
			while(j<n&&a[j]<=b[i]){
				if(a[j]==b[i]){
					flag=true;
					j++;
					break;
				}
				j++;
			}
			if(!flag)	ans=false;	
		}
		if(ans)	printf("YES\n");
		else	printf("NO\n");
	}
	return 0;
}

Measured memory_bytes: 1792
H, W = map(int, input().split())
s = [input() for i in range(H)]
for i in range(H):
    for j in range(W):
        if s[i][j] == '#':
            if i > 0 and s[i-1][j] == '#':
                continue
            elif i < H-1 and s[i+1][j] == '#':
                continue
            elif j > 0 and s[i][j-1] == '#':
                continue
            elif j < W-1 and s[i][j+1] == '#':
                continue
            else:
                print("No")
                exit(0)
print("Yes")


Measured memory_bytes: 3064
#include <algorithm>
#include <iostream>
#include <vector>
#include <math.h>
#include <set>
#include <map>
#include <string>
#include <stack>
#include <queue>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <bitset>
#include <complex>
#include <unistd.h>
#include <cassert>
#include <cctype>
#include <random>
#define _USE_MATH_DEFINES
#define _GLIBCXX_DEBUG
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> plglg;
typedef tuple<int, int, int> tiii;
typedef tuple<ll, ll, ll> tlglglg;
typedef complex<double> xy_t;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
double pi = 3.141592653589793;
ll mod = 1000000007;
int intmax = 2147483647;
int intmin = -2147483648;
ll llmax = 9223372036854775807;
ll llmin = -9223372036854775807;
int iinf = intmax / 8;
ll inf = llmax / 8;
double eps = 1e-11;

int main() {
    int n, m;
    cin >> n >> m;
    int a[n][2];
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < 2; j++) {
            a[i][j] = i;
        }
    }
    pii pos[m];
    for (int i = 0; i < m; i++) {
        int x, y;
        cin >> x >> y;
        pos[i] = pii(x, y);
    }
    sort(pos, pos + m);
    for (int i = 0; i < m; i++) {
        int crane = pos[i].second;
        a[crane][0] = a[crane - 1][0];
        a[crane - 1][1] = a[crane][1]; 
    }
    for (int i = 0; i < n; i++) {
        cout << a[i][1] - a[i][0] + 1;
        if (i != n - 1) {
            cout << " ";
        }
    }
    cout << endl;
}



Measured memory_bytes: 5448
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include <fstream>
#include <time.h>
#include <iterator>


#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define REVERSE(v,n) reverse(v,v+n);
#define VREVERSE(v) reverse(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)
#define m0(x) memset(x,0,sizeof(x))
#define print(x) cout<<x<<endl;
#define pe(x) cout<<x<<" ";
#define lb(v,n) lower_bound(v.begin(), v.end(), n);
#define ub(v,n) upper_bound(v.begin(), v.end(), n);
#define int long long
#define all(x) (x).begin(), (x).end()

using namespace std;

int MOD = (ll)1000000000 + 7;
const ll INF = 1e17;
const double pi = acos(-1);
const double EPS = 1e-10;
typedef pair<int, int>P;
const int MAX = 200020;



int dp[2020][2020];
int N, M;
int S[2020], T[2020];

int func(int i, int j) {
	if (dp[i][j] != 0) {
		//printf("%lld %lld: %lld\n", i, j, dp[i][j]);
		return dp[i][j];
	}
	if (S[i-1] != T[j-1]) {
		int res = func(i - 1,j) + func(i,j - 1) - func(i - 1,j - 1) + MOD;
		res %= MOD;
		dp[i][j] = res;
		//printf("%lld %lld: %lld\n", i, j, dp[i][j]);
		return dp[i][j];
	}
	else {
		int res = func(i - 1,j) + func(i,j - 1)+MOD;
		res %= MOD;
		dp[i][j]=res;
		
		//printf("%lld %lld: %lld\n", i, j, dp[i][j]);
		return dp[i][j];
	}
}
signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);

	cin >> N >> M;
	REP(i, N)cin >> S[i];
	REP(j, M)cin >> T[j];
	REP(i, N+1) {
		dp[i][0] = 1;
	}
	REP(j, M+1) {
		dp[0][j] = 1;
	}
	print(func(N, M));
}


Measured memory_bytes: 32000
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.*;


public class Main {
    int[] a;
    private void solve() {
        a = new int[5];
        int ans = 0;
        int max = 0;
        for(int i = 0;i < 5;i++) {
            a[i] = nextInt();
            ans += a[i];
            int mod = 10 - a[i] % 10;
            if (mod != 10) {
                max = Math.max(max, mod);
            }
            ans += mod % 10;
        }

        out.println(ans - max);


    }

    public static void main(String[] args) {
        out.flush();
        new Main().solve();
        out.close();
    }

    /* Input */
    private static final InputStream in = System.in;
    private static final PrintWriter out = new PrintWriter(System.out);
    private final byte[] buffer = new byte[4096];
    private int p = 0;
    private int buflen = 0;

    private boolean hasNextByte() {
        if (p < buflen)
            return true;
        p = 0;
        try {
            buflen = in.read(buffer);
        } catch (IOException e) {
            e.printStackTrace();
        }
        if (buflen <= 0)
            return false;
        return true;
    }

    public boolean hasNext() {
        while (hasNextByte() && !isPrint(buffer[p])) {
            p++;
        }
        return hasNextByte();
    }

    private boolean isPrint(int ch) {
        if (ch >= '!' && ch <= '~')
            return true;
        return false;
    }

    private int nextByte() {
        if (!hasNextByte())
            return -1;
        return buffer[p++];
    }

    public String next() {
        if (!hasNext())
            throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = -1;
        while (isPrint((b = nextByte()))) {
            sb.appendCodePoint(b);
        }
        return sb.toString();
    }

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

    public long nextLong() {
        return Long.parseLong(next());
    }

    public double nextDouble() {
        return Double.parseDouble(next());
    }
}


Measured memory_bytes: 22612
import java.util.*;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long H = sc.nextLong();
        long count = 0;
        long count2 = 1;
        while (H != 0) {
            count += count2;
            count2 *= 2;
            H /= 2;
        }

        System.out.println(count);
    }
}

Measured memory_bytes: 21716
#include <iostream>
using namespace std;
class dice
{
public:
	int l[6];//label
	void in()
	{
		for(int i=0;i<6;i++)cin>>l[i];
	}
	void r(char a)//roll
	{
		if(a=='S')
		{
			int sto=l[0];
			l[0]=l[4];
			l[4]=l[5];
			l[5]=l[1];
			l[1]=sto;
		}
		else if(a=='N')
		{
			int sto=l[0];
			l[0]=l[1];
			l[1]=l[5];
			l[5]=l[4];
			l[4]=sto;
		}
		else if(a=='E')
		{
			int sto=l[0];
			l[0]=l[3];
			l[3]=l[5];
			l[5]=l[2];
			l[2]=sto;
		}
		else if(a=='W')
		{
			int sto=l[0];
			l[0]=l[2];
			l[2]=l[5];
			l[5]=l[3];
			l[3]=sto;
		}
		else if(a=='R')
		{
			r('N');r('E');r('S');
		}
		else if(a=='L')
		{
			r('N');r('W');r('S');
		}
		return;
	}
	void r_tf(int t,int f)
	{
		int i;for(i=0;i<6;i++)if(l[i]==t)break;
		if(i==1)r('N');
		else if(i==2)r('W');
		else if(i==3)r('E');
		else if(i==4)r('S');
		else if(i==5)r('N'),r('N');
		
		for(i=1;i<5;i++)if(l[i]==f)break;
		if(i==2)r('L');
		else if(i==3)r('R');
		else if(i==4)r('L'),r('L');
		
		return;
	}
};

int main() {
	dice d;d.in();
	int q;cin>>q;int t,f;
	for(int i=0;i<q;i++)
	{
		cin>>t>>f;d.r_tf(t,f);
		cout<<d.l[2]<<endl;
	}
	return 0;
}

Measured memory_bytes: 3076
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include<set>
#include<map>
using namespace std;


int main() {
    int a;
    cin >> a;
    if(a < 1200){
        cout << "ABC";
    }
    else
    {
        cout << "ARC";
    }
    
    cout << endl;
}


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

#define int long long
#define sync ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define file freopen("input.txt", "r", stdin), freopen("output.txt", "w", stdout)
#define endl "\n"
#define ends " "
#define die(x) return cout << x << endl, 0
#define all(v) v.begin(), v.end()
#define debug(x) cerr << #x << ": " << x << endl;
#define debugP(p) cerr << #p << ": {" << p.first << ", " << p.second << '}' << endl;
#define debugV(v) cerr << #v << ": [ "; for(int __ = 0; __ < v.size(); __++) cerr << v[__] << ((__ != v.size() - 1) ? ", " : ends); cerr << ']' << endl
#define debugVP(v) cerr << #v << ": [ "; for(int ___ = 0; ___ < v.size(); ___++) cerr << '{' << v[___].first << ", " << v[___].second << '}' << ((___ != v.size() - 1) ? ", " : ends); cerr << ']' << endl
#define debugA(a, n) cerr << #a << ": [ "; for(int ____ = 0; ____ < n; ____++) cerr << a[____] << ((____ != n - 1) ? ", " : ends); cerr << ']' << endl
#define print(args...) fprintf (st                                  derr, args)
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef vector<pii> vpii;
typedef map<pii, int> mpii;
typedef set<int> sti;
const int INF = 1e9, MOD = INF + 7;
int gcd(int a, int b) { return (b ? gcd(b, a % b) : a); }
int power(int a, int b) { return (!b ? 1 : power(a, b / 2) * power(a, b / 2) * (b % 2 ? a : 1)); }
int mod(int a) { return (a % MOD + MOD) % MOD; }

/////////////////////////////////////////////////////////////////////

const int N = 1e5 + 20, P = 104729;

int a[N];

int32_t main(){

    sync;

    int n; cin >> n;
    bool flag = false;
    for(int i = 0; i < n; i++) {
        cin >> a[i];
        if (a[i] % 2 == 1) flag = true;
    }

    if (flag) cout << "first" << endl;
    else cout << "second" << endl;

    return 0;
}
 

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

const int N = 100+5;
const int M = 1e5+5;
ll cache[N][M];
ll w[N];
ll v[N];
int n;
ll wt;

ll solve(int index,int wt_left){
	if( index == n ){ return 0; }
	if( cache[index][wt_left] != -1 ){ return cache[index][wt_left]; }
	ll &ans = cache[index][wt_left];
	ll a1 = solve(index+1, wt_left);
	ll a2 = 0;
	if( wt_left >= w[index] ){
		a2 = solve(index+1, wt_left - w[index] ) + v[index];
	}
	ans = max(a1,a2);
	return ans;
}


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

	cin>>n>>wt;
	for(int i=0; i<n; ++i){
		cin>>w[i]>>v[i];
	}
	memset(cache,-1,sizeof(cache));
	ll ans = solve(0,wt);
	cout<<ans<<'\n';
	return 0;
}


Measured memory_bytes: 82304
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i++)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;


int main()
{
    string s;
    cin >> s;
    if (s.at(0) != 'A') {
        cout << "WA" << endl;
        return 0;
    }
    string sub_str = s.substr(2, s.size()-3);
    if (count(ALL(sub_str), 'C') != 1) {
        cout << "WA" << endl;
        return 0;
    }

    auto it_of_c = find(s.begin()+2, s.end()-1, 'C');

    for (string::iterator it = s.begin()+1; it != s.end(); ++it) {
        if (it == it_of_c) continue;
        if (*it >= 'A' && *it <= 'Z') {
            cout << "WA" << endl;
            return 0;
        }
    }

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

Measured memory_bytes: 256
#A,B,C,D = map(int,input().split())
num = list(input())
A=int(num[0])
B=int(num[1])
C=int(num[2])
D=int(num[3])
ans=0
for i in range(1<<3):
    if( (i>>2) & 1 == 1):
        ans = A+B
        op1 = "+"
    else:
        ans = A-B
        op1 = "-"
    if((i>>1)&1 == 1):
        ans += C
        op2 = "+"
    else:
        ans -= C
        op2 = "-"
    if((i>>0) & 1 == 1):
        ans += D
        op3 = "+"
    else:
        ans -= D
        op3 = "-"
    if(ans == 7):
        print(str(A)+op1+str(B)+op2+str(C)+op3+str(D)+"=7")
        break

Measured memory_bytes: 9064
# ABC114D - 756
from collections import defaultdict


def prime_factorization(x: int) -> dict:
    max_prime, ret = 0, {}
    cnt = 0
    while x % 2 == 0:  # divide x by 2 as much as possible
        x //= 2
        cnt += 1
    if cnt > 0:
        max_prime = 2
        ret[max_prime] = cnt

    cnt = 0
    for i in range(3, int(x ** 0.5) + 1, 2):
        cnt = 0
        while x % i == 0:
            x //= i
            max_prime = i
            cnt += 1
        if cnt > 0:
            ret[max_prime] = cnt

    if x > 2:  # when x is prime greater than 2
        max_prime = x
        ret[max_prime] = 1
    return ret


def count(n: int) -> int:
    return sum(i >= n - 1 for i in prime_factors.values())


def main():
    global prime_factors
    N = int(input())
    prime_factors = defaultdict(int)
    for i in range(2, N + 1):
        for k, v in prime_factorization(i).items():
            prime_factors[k] += v
    ans = (
        count(75)
        + count(25) * (count(3) - 1)
        + count(15) * (count(5) - 1)
        + count(5) * (count(5) - 1) * (count(3) - 2) // 2
    )
    print(ans)


if __name__ == "__main__":
    main()

Measured memory_bytes: 3316
N,K = map(int,input().split())
mod = 10**9+7
def combination(n,k):
    bunsi = 1
    bunbo = 1
    for j in range(k):
        bunsi = bunsi*(n-j)%mod
        bunbo = bunbo*(j+1)%mod
    return(bunsi*pow(bunbo,mod-2,mod)%mod)
for i in range(1,K+1):
    print(combination(K-1,i-1)*combination(N-K+1,i)%mod)

Measured memory_bytes: 3316
#include<bits/stdc++.h>
using namespace std;
#define N 2019

int main(){
  int L,R;
  cin >> L >> R;
  int min = 2020;
  if(L/N != R/N){
    min = 0;
  }
  else{
    for(int i=L;i<=R;i++){
      for(int j=i+1;j<=R;j++){
        if(((i%N)*(j%N)%N)<min){
          min = ((i%N)*(j%N)%N);
        }
      }
    }
  }
  cout << min << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;
int a[200010];
int main(){
    int i,n,k; cin >> n >> k;
    for(i=0;i<n;i++) cin >> a[i];
    int l = 0,r = 1000000000;
    while(r - l>1){
        int mid =(l + r)/2,cnt = 0;
        for(i=0;i<n;i++){
            if(a[i]<=mid) continue;
            if(a[i]%mid==0) cnt += a[i]/mid - 1;
            else cnt += a[i]/mid;
        }
        if(cnt<=k) r = mid;
        else l = mid;
    }
    cout << r << endl;
}

Measured memory_bytes: 4396
import java.util.*;

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

        int[][] building1 = new int[3][10];
        int[][] building2 = new int[3][10];
        int[][] building3 = new int[3][10];
        int[][] building4 = new int[3][10];

        for(int i=0;i<n;i++){
            int b = sc.nextInt();
            int f = sc.nextInt();
            int r = sc.nextInt();
            int v = sc.nextInt();

            switch(b){
                case 1:
                    building1[f-1][r-1] += v;
                    break;
                case 2:
                    building2[f-1][r-1] += v;
                    break;
                case 3:
                    building3[f-1][r-1] += v;
                    break;
                case 4:
                    building4[f-1][r-1] += v;
                    break;
            }
        }
        for(int i=0;i<3;i++){
            for(int j=0;j<10;j++){
                System.out.print(" " + building1[i][j]);
            }
            System.out.println();
        }
        System.out.println("####################");
        for(int i=0;i<3;i++){
            for(int j=0;j<10;j++){
                System.out.print(" " + building2[i][j]);
            }
            System.out.println();
        }
        System.out.println("####################");        
        for(int i=0;i<3;i++){
            for(int j=0;j<10;j++){
                System.out.print(" " + building3[i][j]);
            }
            System.out.println();
        }
        System.out.println("####################");
        for(int i=0;i<3;i++){
            for(int j=0;j<10;j++){
                System.out.print(" " + building4[i][j]);
            }
            System.out.println();
        }
    }
}


Measured memory_bytes: 30124
#include <cstdio>
using namespace std;
#define cmax(_a, _b) (_a < (_b) ? _a = (_b) : 0)
int main(){
	register int a, b, c, x, ans = 0;
	scanf("%d %d %d", &a, &b, &c);
	if ((a & 1) != (b & 1) && (a & 1) != (c & 1)) ++b, ++c, ++ans;
	else if ((a & 1) != (b & 1) && (b & 1) != (c & 1)) ++a, ++c, ++ans;
	else if ((a & 1) != (c & 1) && (b & 1) != (c & 1)) ++a, ++b, ++ans;
	x = 0;
	cmax(x, a);
	cmax(x, b);
	cmax(x, c);
	ans += (x - a >> 1) + (x - b >> 1) + (x - c >> 1);
	printf("%d", ans);
	return 0;
}

Measured memory_bytes: 128
#include <iterator>
#include <list>
#include <algorithm>
#include <iostream>
#include <unordered_set>
#include <unordered_map>
#include <vector>
#include <sstream>
#include <iomanip>
#include <string>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <numeric>
using namespace std;

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

  vector<int> L(N);
  for (int i = 0; i < N; i++) {
    cin >> L[i];
  }

  int d = 0;
  int i = 0;
  int ans = 0;
  while (i < N) {
    if (d <= X)
      ++ans;
    d += L[i];
    i++;
  }
  if (d <= X)
    ++ans;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int main(){
	int n,add;
	int angka=1;
	scanf("%d%d",&n,&add);
	for(int i = 1;i<=n;i++){
		if(angka<=add) angka*=2;
		else angka+=add;
	}
	printf("%d\n",angka);
	
	
	
	return 0;
}

Measured memory_bytes: 1728
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define loop(i,a,b) for(ll i=a;i<b;i++)
const int mod=1e9+7;

int main()
{	
    ll n,m;
    cin>>n>>m;
    ll dp[n][m]={};
    char a[n][m];
    loop(i,0,n)
    {
    	loop(j,0,m)
    	{
    		cin>>a[i][j];
		}
	}
	loop(i,0,n)
	{
		if(a[i][0]=='.') dp[i][0]=1;
		else break;
	}
	loop(i,0,m)
	{
		if(a[0][i]=='.') dp[0][i]=1;
		else break;
	}
	loop(i,1,n)
    {
    	loop(j,1,m)
    	{
    		if(a[i][j]=='.')
    		dp[i][j]=(dp[i-1][j]+dp[i][j-1])%mod;
    		else
    		dp[i][j]=0;
		}
	}
	cout<<dp[n-1][m-1];
    return 0;
}


Measured memory_bytes: 9088
import sys
from io import StringIO
import unittest

sys.setrecursionlimit(10**6)

def rec(n, a, seen):
	if seen[n-1]:
		return -1
	if a[n-1] == 2:
		return seen.count(True) + 1
	seen[n-1] = True
	return rec(a[n-1], a, seen)

def resolve():
	n = int(input())
	a = []
	seen = [False]*n
	for _ in range(n):
		a.append(int(input()))
	print(rec(1, a, seen))
resolve()

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

int main(){

    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    int A[N];
    for(int i=0; i<N; i++){
        cin >> A[i];
    }

    int min = 1e9 + 1;
    int max = 0;

    for(int i=0; i<N; i++){
        if(min > A[i]){
            min = A[i];
        }

        if(max < A[i]){
            max = A[i];
        }
    }

    cout << max - min << "\n";

    return 0;
}

Measured memory_bytes: 256
#include <string.h>

#include <algorithm>
#include <iostream>
#include <vector>

#define rep1(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define MOD 1000000007

using namespace std;
using ll = long long;

int main(void) {
  int x, ans;
  cin >> x;
  if (x == 0) {
    ans = 1;
  } else {
    ans = 0;
  }
  cout << ans << endl;
  return 0;
}

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

int main()
{
    std::string s;
    std::cin >> s;

    if (s == "RSS" || s == "SRS" || s == "SSR" || s == "RSR")
    {
        std::cout << 1 << std::endl;
    }
    else if (s == "RRS" || s == "SRR")
    {
        std::cout << 2 << std::endl;
    }
    else if (s == "RRR")
    {
        std::cout << 3 << std::endl;
    }
    else
    {
        std::cout << 0 << std::endl;
    }

    return 0;
}

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

#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,s,n) for(int i=s;i<n;i++)
#define erep(e,v) for(auto && e :v)
#define all(in) in.begin(), in.end()
#define MP make_pair
#define INF (sizeof(int) == 4 ? 1e9:1e18)
#define EPS 0.0000000001
using namespace std;
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
template<typename Head, typename Value> auto vectors(const Head &head, const Value &v) { return vector<Value>(head, v); }
template<typename Head, typename... Tail> auto vectors(Head x, Tail... tail) { auto inner = vectors(tail...); return vector<decltype(inner)>(x, inner); }
template<class T> void join(T a){for(auto itr :a){if(itr != *a.begin())cout << " "; cout << itr;} }
using ld  = long double;
using pii = pair<int,int>;
using piii = pair<int,pii>;
int W,H;
int dx[]={0,0,1,-1}, dy[]={1,-1,0,0};
bool valid(int x,int y){return (0<=x&&x<W)&&(0<=y&&y<H);}

int bit [1000] = {},n;
int sum(int i){
    int s = 0;
    while (i > 0) {
        s += bit[i];
        i -= i & -i;
    }
    return s;
}

void add (int i,int x){
    while (i <= n) {
        bit[i] += x;
        i += i & -i;
    }
}
signed main(){
    int m,q; cin >> n >> m >> q;
    vector<piii>v( m + q);
    rep(i,m+q) {
        int a,b; cin >> a >> b;
        piii temp;
        temp.first = b, temp.second.first = i;
        temp.second.second = a;
        v[i] = temp;
    }
    sort (all(v));
    map<int,int>mp;
    erep(e,v){
        int left = e.second.second;
        int right = e.first;
        bool isQuery = e.second.first >= m;
        if (isQuery){
            mp[e.second.first] = sum(right)  - sum(left - 1);
        } else {
            add(left, 1);
        }
    }
    for(auto itr : mp)
        cout << itr.second << endl;
}





Measured memory_bytes: 9088
#include <bits/stdc++.h>
#include <cstdio>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
void printVector(vector<long> l)
{
    for (long i = 0; i < l.size(); i++)
    {
        if (i != 0)
        {
            cout << " ";
        }
        cout << l.at(i);
    }
    cout << endl;
}

vector<long> inputVector(long n)
{
    vector<long> vec(n);
    rep(i, n)
    {
        scanf("%d", &vec.at(i));
    }
    return vec;
}

vector<long> insertSort(vector<long> l)
{
    for (long i = 1; i < l.size(); i++)
    {
        long j = i - 1;
        long v = l.at(i);
        while (j >= 0 && v < l.at(j))
        {
            l.at(j + 1) = l.at(j);
            j--;
        }
        l.at(j + 1) = v;
    }
    return l;
}

int main()
{
    int n, m;
    long ans;
    // scanf("%d", &x);
    cin >> n >> m;
    vector<long> a = inputVector(n);
    a = insertSort(a);
    long s = 0;
    rep(i, n)
    {
        s += a.at(i);
    }
    if (a.at(n - m) * 4 * m < s)
    {
        cout << "No" << endl;
    }
    else
    {
        cout << "Yes" << endl;
    }
    // printf("%d\n", x * x * x);
    // cout << ans << endl;
}

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

constexpr ll mod = 1e9 + 7;

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

/*-------------------------------------------*/

vector<int> rollingHash(const string &s, const string &key) {
    using u64 = unsigned long long;
    u64 m = mod;
    int sl = s.size(), kl = key.size();
    vector<int> ret;
    u64 t = 1;
    u64 sh = 0, kh = 0;
    rep(i, kl) {
        t *= m;
        sh = sh * m + s[i];
        kh = kh * m + key[i];
    }
    rep(i, sl - kl + 1) {
        if(kh == sh) ret.push_back(i);
        if(i + kl < sl) sh = sh * m + s[i + kl] - s[i] * t;
    }
    return ret;
}

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

    string s, key;
    cin >> s >> key;
    vector<int> ret = rollingHash(s, key);
    rep(i, ret.size()) cout << ret[i] << endl;
}


Measured memory_bytes: 8748
#include<bits/stdc++.h>
#define x first
#define y second
#define sqr(x) ((x)*(x))
using namespace std;const int N=2e2+7;typedef long long ll;typedef pair<ll,ll>pa;
int n,i,j,kase,id[N];pa s[N],s1,tmp;ll ans;double angle[N];
ll dis(pa a){return sqr(a.x)+sqr(a.y);}
bool cmp(int x,int y){return angle[x]<angle[y];}
int main(){
    for(scanf("%d",&n),i=1;i<=n;++i)scanf("%lld%lld",&s[i].x,&s[i].y),angle[i]=atan2(s[i].y,s[i].x),id[i]=i;sort(id+1,id+n+1,cmp);
    for(i=1;i<=n;++i)id[n+i]=id[i];
    for(i=1;i<=n;++i){
        for(s1=pa(0,0),j=i;j<i+n;++j)s1.x+=s[id[j]].x,s1.y+=s[id[j]].y,ans=max(ans,dis(s1));
    }printf("%.15f\n",sqrt(ans*1.0));
}


Measured memory_bytes: 384
a, b = map(int, input().split())
if a <= 0 and b > 0:
    print('Zero')
    exit(0)
if a > 0:
    print('Positive')
    exit(0)
num = b - a + 1
if num % 2 == 0:
    print('Positive')
else:
    print('Negative')

Measured memory_bytes: 2940
#include <bits/stdc++.h>
#include <algorithm>
#include <string>
using namespace std;
 
int main() {
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    long long A, B, range;
    range = pow(10, 9);
    cin >> A >> B;
    for (long long k = 0; k < range; ++k) {
        if (abs(A - k) == abs(B - k)) {
            cout << k << endl;
            return 0;
        }
    }
    cout << "IMPOSSIBLE" << endl;
    return 0;
}

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

namespace CsProgramSpace
{
    class Program
    {
        static void Main(string[] args)
        {
            string temp = "";
            List<long> li = new List<long>();
            long sum = 0;
            while (true)
            {
                temp = Console.ReadLine();
                if (temp == "0") break;
                for(int i =0; i<temp.Length;i++)
                {
                    sum += int.Parse(temp.Substring(i, 1));
                }
                li.Add(sum);
                sum = 0;
            }
            foreach (long l in li) Console.WriteLine(l);
        }
    }
}


Measured memory_bytes: 15964
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;

int main() {
    int n, m;
    cin >> n >> m;
    cout << n * (n - 1) / 2 + m * (m - 1) / 2 << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int maxn=1e5+5;
const long long M=1e9+7;
int a[maxn],b[maxn];
long long c[maxn],pb[maxn];

long long pow2(long long n,long long m)
{
    long long  r=1,base=n%M;
    while(m)
    {
        if(m&1) r=r*base%M;
        base=base*base%M;
        m>>=1;
    }
    return r;
}
long long C(long n,long k)
{
    if(n==k) return 1;
    return c[n]*pb[k]%M*pb[n-k]%M;
}

void init()
{
    c[0]=1;
    for(int i=1;i<maxn;i++)
    {
        c[i]=c[i-1]*i%M;
        pb[i]=pow2(c[i],M-2);
    }
}

int main()
{
    int n;
    init();
    while(~scanf("%d",&n))
    {
        memset(a,0,sizeof(a));
        int tiwce;
        for(int i=0;i<n+1;i++)
        {
            scanf("%d",&b[i]);
            a[b[i]]++;
            if(a[b[i]]==2) tiwce=b[i];
        }
        int l=-1,r;
        for(int i=0;i<n+1;i++)
        {
            if(b[i]==tiwce)
            {
                if(l<0)
                    l=i;
                else r=i;
            }
        }
        int p=l+n-r;
        printf("%d\n",n);
        for(int i=2;i<=n+1;i++)
        {
            long long ans=C(n+1,i);
            if(i-1<=p) ans=(ans-C(p,i-1)+M)%M;
            printf("%lld\n",ans);
        }
    }
    return 0;
}


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

int main() {
    int N; cin >> N;
    for(int n = 1; n <= N; ++n) {
        int ans = 0;
        for(int x = 1; x <= N; ++x) {
            if(x * x > n) break;
            for(int y = 1; y <= N; ++y) {
                if(y * y > n) break;
                int b = x + y;
                int c = x*x + y*y + x*y - n;
                double z = (-b + sqrt((b * b) - 4 * c)) / 2.0;
                if(z < 1) continue;
                if(floor(z) == z) ans++;
            }
        }
        cout << ans << '\n';
    }
    return 0;
}


Measured memory_bytes: 3508
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define rep2(i, x, n) for (int i = x, i##_len = (n); i < i##_len; ++i)
#define ALL(n) begin(n), end(n)

int main()
{
  int N, M;
  cin >> N >> M;
  vector<int> num(N, 0);
  rep(i, M)
  {
    int a, b;
    cin >> a >> b;
    num.at(a - 1)++;
    num.at(b - 1)++;
  }
  rep(i, N)
  {
    cout << num.at(i) << endl;
  }
}

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

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
template<typename T> using v = vector<T>;
template<typename T> using pq = priority_queue<T>;
template<typename T> using minpq = priority_queue<T, vector<T>, greater<T>>;
template<typename T, typename K> using ump = unordered_map<T, K>;
const ll dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
const ll mod = 1000000007;
const ll inf = ll(1e9);
const ll e5 = ll(1e5);
const ll ll_inf = ll(1e9) * ll(1e9);

#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define repr(i, n) for(ll i = n - 1; i >= 0; i--)
#define repone(i, n) for(ll i = 1; i <= (ll)(n); i++)
#define each(i, mp) for(auto& i:mp)
#define eb emplace_back
#define F first
#define S second
#define all(obj) (obj).begin(), (obj).end()

template<class T>
void dump_debug(T list) {
#ifdef MY_DEBUG
    each(e, list) cout << e << " ";
    printf("\n");
#endif
}

inline ll inl() {
    ll x;
    cin >> x;
    return x;
}

inline string ins() {
    string x;
    cin >> x;
    return x;
}

/* ------------- ANSWER ------------- */
/* ---------------------------------- */

int main() {
#ifdef MY_DEBUG
    while (true) {
#endif
        string s = ins();
        ump<char, int> mp;
        rep(i, s.size()) {
            mp[s[i]]++;
        }
        if (mp.size() != 2) cout << "No" << endl;
        else {
            each(e, mp) {
                if (e.second != 2) {
                    cout << "No" << endl;
                    return 0;
                }
            }
            cout << "Yes" << endl;
        }

#ifdef MY_DEBUG
    }
#endif
    return 0;
}

Measured memory_bytes: 256