akhauriyash/Code-Regression huggingface dataset:
n = int(input())
a = list(map(int, input().split()))

a.sort()
if a[0] * a[-1] <= 0:
    total = 0
    for i in a:
        total += abs(i)
    print(total)
    now = a[-1]
    for i in range(0, n - 2):
        if a[i + 1] > 0:
            print(min(a[i], now), max(a[i], now))
            now = -1 * abs(a[i] - now)
        else:
            print(now, a[i])
            now -= a[i]
    if a[-2] > 0:
        print(a[-2], now)
    else:
        print(now, a[-2])

elif a[0] > 0:
    total = sum(a) - 2 * a[0]
    print(total)
    now = a[0]
    for i in range(1, n - 1):
        print(now, a[i])
        now -= a[i]
    print(a[-1], now)

else:
    total = -1 * sum(a) + 2 * a[-1]
    print(total)
    now = a[n - 1]
    for i in range(n - 2, -1, -1):
        print(now, a[i])
        now -= a[i]


Measured memory_bytes: 14260
import Control.Applicative
import Text.Printf

main :: IO ()
main = do
  xs <- (map read . words) <$> getLine
  putStrLn $ solve xs

solve :: [Int] -> String
solve xs = printf "%d %d %.10f" (a `div` b) (mod a b) (((fromIntegral a) / (fromIntegral b)) :: Double) 
  where a = xs !! 0
        b = xs !! 1
  

Measured memory_bytes: 3860
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  long long A,B,K;
  cin >> A >> B >> K;
   
    if(A-K<0){
      if(A+B-K<=0){
       cout << 0 << ' ' << 0 <<endl;
      }
      else if(A+B-K>0){
        cout << 0 << ' ' << B - (K-A) <<endl;      }
    }
    else{
      cout << A-K << ' ' << B <<endl;
    }
}

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

vector<int> root;
vector<int> Rank;

//通常バージョン
int find(int x){
    if (root[x] == x) return x;
    root[x] = find(root[x]);
    return root[x];
}

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

void Union(int x, int y){
    x = find(x); y = find(y);
    if (check(x, y)){
        return;
    }
    if (Rank[x] >= Rank[y]) root[y] = x;
    else root[x] = y;
    if (Rank[x] == Rank[y]) Rank[x]++;
}

int main(){
    int n, m;
    cin >> n >> m;
    vector<int> set_root(n);
    for (int i = 0; i < n; i++) set_root[i] = i;
    root = set_root;
    vector<int> set_Rank(n, 0);
    Rank = set_Rank;
    for (int i = 0; i < m; i++){
        int t, u, v;
        cin >> t >> u >> v;
        if (t == 0) Union(u, v);
		if (t == 1) cout << check(u, v) << endl;
    }
}

Measured memory_bytes: 6388
#include <iostream>
#include <string>
#include <sstream>
#include <iomanip> 
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <functional>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#include <bitset>

using namespace std;



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

	long long n, i, j, k, maxx, x, y, ans = 0;
	cin >> n;
	map<long long, long long> s;
	for (i = 0; i < n; i++) {
		cin >> x;
		s[x]++;
	}

	while (!s.empty()) {
		x = s.rbegin()->first;
		if (s[x] == 1) s.erase(x);
		else s[x]--;

		for (i = 1; i < 32; i++) {
			y = (1LL << i) - x;
			if (s.find(y) != s.end()) {
				ans++;
				if (s[y] == 1) s.erase(y);
				else s[y]--;
			}
		}
	}


	cout << ans << "\n";

	return 0;
}



Measured memory_bytes: 13432
public class Main {
    public static void main(String[] args){
        int S = new java.util.Scanner(System.in).nextInt();
        int h = S / 3600;
        int m = (S % 3600) / 60;
        int s = S % 60;

        System.out.println(h + ":" + m + ":" + s);
    }
}

Measured memory_bytes: 26376
// c++ -std=c++17 -o main main.cpp -lm
#include <bits/stdc++.h>

#define rep(i,n) for(int i=0;i<(n);++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
	
// auto mod int
// https://youtu.be/L8grWxBlIZ4?t=9858
// https://youtu.be/ERZuLAxZffQ?t=4807 : optimize
// https://youtu.be/8uowVvQ_-Mo?t=1329 : division
const int mod = 1000000007;
//const int mod = 998244353;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

int main() {
	int n;
	cin >> n;
	int zero = 0;
	map<pair<ll, ll>, P> mp;
	rep(i,n) {
		ll x, y;
		cin >> x >> y;
		if (x == 0 && y == 0) {
			zero++;
			continue;
		}
		ll g = gcd(x,y); // gcc 17 kara
		x /= g;
		y /= g;
		if (y < 0) {
			x = -x;
			y = -y;
		}
		if (y == 0 && x < 0) {
			x = -x;
			y = -y;
		}
		bool rot90 = (x <= 0);
		if (rot90) {
			ll temp = x;
			x = y;
			y = -temp;
		}
		// first: number for 2nd quadrant
		// second: number for 1st quadrant 
		if (rot90) mp[{x,y}].first++;
		else mp[{x,y}].second++;
	}
	mint ans = 1;
	for (auto p : mp) {
		int s = p.second.first;
		int t = p.second.second;
		mint now = 1;
		// count separately between s and t, 
		now += mint(2).pow(s) - 1;
		now += mint(2).pow(t) - 1;
		// here is multiplication because each sample
		// is able to choose freely.
		ans *= now;
	}
	
	ans -= 1;
	
	ans += zero;
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 16064
while True:
    h,w = map(int,input().split())
    if h == 0:
        break
    for i in range(h):
        for j in range(w):
            if i == 0 or i == h-1:
                print("#",end="")
            elif j == 0 or j == w-1:
                print("#",end="")
            else:
                print(".",end="")
        print()
    print()


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

#ifdef DEBUG
#include "../include/debug.hpp"
#else
#define debug(...) 42
#define rdfile(...) 42
#endif

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    // rdfile("_input.txt");

    int P, Q, R;
    cin >> P >> Q >> R;

    cout << (P + Q + R) - max({P, Q, R}) << endl;  

    return 0;
}

Measured memory_bytes: 256
N = int(input())
A = list(map(int, input().split()))
sort = sorted(A)
# amari = []
# while len(amari) != 1:
#   amari.clear()
#   if 0 in sort: sort.remove(0)
#   for item in sort:
#     if item%sort[0] not in amari:
#       amari.append(item%sort[0])
#   last_sort0 = sort[0]
#   sort = sorted(amari[:])
#   sort.append(last_sort0)

# print(last_sort0-amari[0])

while len(sort) != 1:
  for i in range(1,len(sort)):
    sort[i] = sort[i]%sort[0]
  sort = [j for j in sorted(sort) if j != 0]

print(sort[0])

Measured memory_bytes: 14252
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <cmath>
#include <iomanip>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cassert>
#include <cstring>
#include <climits>

using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define rep(i, n) FOR(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())
#define INF (ll)1e18
#define MOD (ll)1e9 + 7
#define pb push_back

typedef long long ll;
typedef long long int llt;
typedef pair<int, int> P;
typedef vector<int> V;
typedef map<int, int> M;

char dif = 'A' - 'a';

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    cin >> s;
    if(s[5]=='1'||s[6]-'0'>=5)
        cout << "TBD" << endl;
        else{
            int a = (s[8] - '0') * 10 + (s[9] - '0');
            if(a==31)
                cout << "TBD" << endl;
                else
                    cout << "Heisei" << endl;
        }
        return 0;
}

Measured memory_bytes: 256
N = int(input())
value_dict = {}
for i in range(1, N + 1):
    place, value = input().split()
    if not place in value_dict.keys():
        value_dict[place] = {}
    value_dict[place][int(value)] = i
for key, value_set in sorted(value_dict.items(), key=lambda x: x[0]):
    for value, index in sorted(value_set.items(), key=lambda y: -y[0]):
        print(index)

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

int main()
{
  string a, s[2];
  int x[2];
  cin >> s[0] >> s[1];
  cin >> x[0] >> x[1];
  cin >> a;
  if (a == s[0]){
    x[0]--;
  }
  else {
    x[1]--;
  }
  cout << x[0] << " " << x[1] << endl;
  return 0;
}


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

int main() {
  long n,m;
  cin >> n >> m;
  vector<int>s(n,0);
  vector<int>g(n,0);
  for(int i = 0;i < m;i++){
    int a,b;
    cin >> a >> b;
    if(a == 1){
      s[b-1]++;
    }
    else if(b == n){
      g[a-1]++;
    }
  }
  for(int i = 0;i < n;i++){
    if(s[i] != 0 && g[i] != 0){
      cout << "POSSIBLE" << endl;
      return 0;
    }
  }
  cout << "IMPOSSIBLE" << endl;
}


Measured memory_bytes: 1792
n = int(input())
alpha = "abcdefghijklmnopqrstuvwxyz"
D = {alpha[i]: 100 for i in range(26)}
for i in range(n):
  S = input()
  D2 = {alpha[i]: 0 for i in range(26)}
  for j in range(len(S)):
    D2[S[j]] += 1
  for k in D:
    D[k] = min(D2[k], D[k])
St = ""
for i in range(26):
  St = St[:] + alpha[i] * D[alpha[i]]
print(St)

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

int main(){
  int a, b, maxi = -1, mini = 1000000100;
  cin >> a;
  for(int i = 0;i < a; i++){
    int x;cin >> x;
    mini = min(mini, x);
  	maxi = max(maxi, x);
  }
  cout << maxi - mini << endl;
  return 0; 
}

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

#ifdef LOCAL
#include "dump.hpp"
#else
#define dump(...)
#define dumpv(...)
#endif

#define rep(i, n) for (int i = 0; i < (n); i++)
#define mins(x, y) (x = min(x, y))
#define maxs(x, y) (x = max(x, y))
using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vi>;
using vvl = vector<vl>;
using P = pair<int, int>;
const int MOD = 1e9 + 7;
const int INF = 1001001001;
const ll LINF = 1001002003004005006ll;

ll a, b, c, d;
map<ll, ll> mp;
ll f(ll n, ll co) {
  // dump(n, co);
  if (n < 0) return LINF;
  if (n == 0) return co;
  if (n == 1) return co + d;
  if (mp[n] > 0) return co + mp[n];
  ll add = LINF;
  if (LINF / d > n) add = n * d;
  if (n % 2 == 0) {
    mins(add, f(n / 2, co) + a);
  } else {
    mins(add, f((n - 1) / 2, co) + a + d);
    mins(add, f((n + 1) / 2, co) + a + d);
  }
  if (n % 3 == 0) {
    mins(add, f(n / 3, co) + b);
  } else if (n % 3 == 1) {
    mins(add, f((n - 1) / 3, co) + b + d);
    mins(add, f((n + 2) / 3, co) + b + d * 2);
  } else {
    mins(add, f((n - 2) / 3, co) + b + d * 2);
    mins(add, f((n + 1) / 3, co) + b + d);
  }
  if (n % 5 == 0) {
    mins(add, f(n / 5, co) + c);
  } else if (n % 5 == 1) {
    mins(add, f((n - 1) / 5, co) + c + d);
    mins(add, f((n + 4) / 5, co) + c + d * 4);
  } else if (n % 5 == 2) {
    mins(add, f((n - 2) / 5, co) + c + d * 2);
    mins(add, f((n + 3) / 5, co) + c + d * 3);
  } else if (n % 5 == 3) {
    mins(add, f((n - 3) / 5, co) + c + d * 3);
    mins(add, f((n + 2) / 5, co) + c + d * 2);
  } else {
    mins(add, f((n - 4) / 5, co) + c + d * 4);
    mins(add, f((n + 1) / 5, co) + c + d);
  }
  dump(n, add, co);
  mp[n] = add - co;
  return add;
}

void solve() {
  int t;
  cin >> t;
  rep(i, t) {
    ll n;
    cin >> n >> a >> b >> c >> d;
    ll ans = f(n, 0);
    cout << ans << endl;
    mp.clear();
  }
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  // freopen("temp.1", "r", stdin);
  solve();
  return 0;
}

Measured memory_bytes: 4352
#include <iostream>

using namespace std;

int main() {
    long long N, A, B;
    cin >> N >> A >> B;

    if (N == 1) {
        cout << (A == B) << endl;
    } else { // N > 1
        long res = 0;
        if (A <= B) {
            res = (N - 2) * (B - A) + 1;
        }
        cout << res << endl;
    }
}

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

int main(){
    int x[5];
    rep(i, 5) cin >> x[i];

    rep(i, 5){
        if (x[i] == 0){
            cout << i + 1 << endl;
        }
    }

    return 0;
}

Measured memory_bytes: 3588
import sys
import math
import collections
import itertools
import array
import inspect

# Set max recursion limit
sys.setrecursionlimit(10000)

# Debug output
def chkprint(*args):
    names = {id(v):k for k,v in inspect.currentframe().f_back.f_locals.items()}
    print(', '.join(names.get(id(arg),'???')+' = '+repr(arg) for arg in args))

# Binary converter
def to_bin(x):
    return bin(x)[2:]

# Set 2 dimension list
def dim2input(N):
    li = []
    for _ in range(N):
        li.append(input().split())
    return li

# --------------------------------------------

dp = None

def main():
    seats = 0
    N = int(input())

    for _ in range(N):
        l, r = list(map(int, input().split()))
        seats += r - l + 1

    print(seats)


main()


Measured memory_bytes: 4800
#include <iostream>
using namespace std;
int main() {
  int A, B;
  cin >> A >> B;
  if (A <= 5) {
    cout << 0 << endl;
  } else if (A <= 12) {
    cout << (B / 2) << endl;
  } else {
    cout << B << endl;
  }
}

Measured memory_bytes: 256
import numpy as np
n, m, x = map(int, input().split())
texts = []

for i in range(n):
    array = list(map(int, input().split()))
    texts.append(array)
num = 2**n
min_money = 10**20
for i in range(num):
    flg = True
    t = str(format(i, 'b')).zfill(n)
    total = np.zeros(m+1)
    for j in range(n):
        if t[j] == '1':
            total += texts[j]
    y = total[1:]
    for k in y:
        if k < x:
            flg = False
            break
    money = total[0]
    if money < min_money and flg is True:
        min_money = money

if min_money == 10**20:
    print(-1)
else:
    print(int(min_money))

Measured memory_bytes: 27192
#include<bits/stdc++.h>
#define mins(a,b) a=min(a,b)
#define maxs(a,b) a=max(a,b)
 template < typename T > std::string to_string( const T& n )
  {
    std::ostringstream stm ;
    stm << n ;
    return stm.str() ;
  }
using namespace std;

const long long INF=9000000000000000;
int main(){
  int n,ans;
  bool ok=false;
  string s,t;
  cin>>n>>s>>t;
  ans=n+n;
  for(int i=0;i<n;i++){
    for(int j=0;j<n-i;j++){
      if(s[i+j]==t[j])
        ok=true;
      else{
        ok=false;
        break;
      }
    }
    if(ok){
      ans=i+n;
      break;
    }
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N,A,B;
  cin >> N >> A >> B;
  int res = 0;
  for (int i = 1; i <= N; i++){
    int sum = 0;
    for (int j = 0; j < to_string(i).size(); j++) sum += to_string(i)[j] - '0';
    if (A <= sum && sum <= B) res += i;
  }
  cout << res;
}

Measured memory_bytes: 256
s = input()
t = input()

len_s = len(s)
len_t = len(t)

ans = 0

for i in range(len_s - len_t+1):
    cnt = 0
    for j in range(len_t):
        if s[i+j]==t[j]:
            cnt += 1
    ans = max(ans, cnt)

print(len_t - ans)

Measured memory_bytes: 9128
while n = gets.to_i
    break if n == 0
    a = gets.split.map(&:to_i).each_with_object(Hash.new(0)) { |k, h| h[k] += 1 }
    puts a.each_value.all?{|v| v <= n - v} ? "NO COLOR" : a.key(a.each_value.max)
end

Measured memory_bytes: 116452
def myargmin(array):
    array = list( array )
    return array.index(min(array))

X, N = map(int, input().split(" "))

if N == 0:
    print(X)
else:

    P = sorted(map(int, input().split(" ")))
    array = list(range(0, 102))
    for p in P:
        if p in array:
            array.remove(p)
        else:
            continue

    resid = [abs(a - X) for a in array]
    min_idx = myargmin(resid)

    print(array[min_idx])

Measured memory_bytes: 61996
#include <iostream>
#include <vector>
using namespace std;
long cntfive(long n){
    long ans = 0;
    while(n % 5 == 0){
        ans++;
        n /= 5;
    }
    return ans;
}
int main(void){
    long n;
    cin >> n;
    long ans = 0;
    if(n % 2 == 0){
        for(long i = 10;i <= n;i *= 5){
            ans += n / i;
        }
    }
    cout << ans << endl;
    
}

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

#define ll long long
using namespace std;
long long power(ll  x, ll n){
    if(n==0)return 1;
    ll temp=power(x,n/2);
    if(n%2==0)return temp*temp;
    else return x*temp*temp;

}
ll max(ll a,ll b){
    return a>b?a:b;

}

ll max(ll a,ll b,ll c){
    return max(max(a,b),c);
}
ll min(ll x,ll  y){
    return x+y-max(x,y);
}
ll min(ll x,ll y,ll z){
    return min(min(x,y),z);

}



void swap(int* a, int* b)
{
    int t = *a;
    *a = *b;
    *b = t;
}

bool f(ll x,ll y){
    return x>y;

}


int main(){
    ll n;
    cin>>n;
  cin.ignore();
  string s;
  cin>>s;
  ll total=(n*(n-1)*(n-2))/6;

  s='a'+s;

  ll r,b,g;
  r=b=g=0;
  for(ll i=1;i<=n;i++){
      if(s[i]=='R')r++;
      if(s[i]=='B')b++;
      if(s[i]=='G')g++;
  }

ll count1=(r*(r-1)*(r-2))/6+(b*(b-1)*(b-2))/6+(g*(g-1)*(g-2))/6;
ll count2=((r*(r-1))*(b+g))/2+((b*(b-1))*(r+g))/2+((g*(g-1))*(b+r))/2;
ll count3=0;

for(ll i=1;i<=n;i=i+2){
    for(ll k=i+2;k<=n;k=k+2){
        ll j=(i+k)/2;
         if((s[i]!=s[j])&&(s[i]!=s[k])&&(s[j]!=s[k]))count3++;

    }



}
    for(ll i=2;i<=n;i=i+2){
        for(ll k=i+2;k<=n;k=k+2){
            ll j=(i+k)/2;
            if((s[i]!=s[j])&&(s[i]!=s[k])&&(s[j]!=s[k]))count3++;

        }



    }
    cout<<total-count1-count2-count3;



    return 0;
}






































Measured memory_bytes: 3628
package main
 
import (
    "bufio"
    "fmt"
    "os"
    "strconv"
    "math"
)

func main(){
    
    N := nextInt()
    W := nextInt()
    w := make([]int, N)
    v := make([]int, N)
    for i:=0;i<N;i++ {
        w[i] = nextInt()
        v[i] = nextInt()
    }
    
    dp := make([][]int, N)
    for i:=0;i<N;i++ {
        dp[i] = make([]int, 100001)
        for j:=0;j<100001;j++ {
            dp[i][j] = math.MaxInt32
        }
    }
    dp[0][0] = 0
    dp[0][v[0]] = w[0]
    
    for i:=1;i<N;i++ {
        for j:=0;j<100001;j++ {
            dp[i][j] = dp[i-1][j]
            if j-v[i]>=0 {
                dp[i][j] = Min([]int{dp[i][j], dp[i-1][j-v[i]]+w[i]})
            }
        }
    }
    
    ans := 0
    for i:=0;i<100001;i++ {
        if dp[N-1][i]<=W {
            ans = i
        }
    }
    
	fmt.Println(ans)
}

/* templates */


func Max(a []int) int {
    r := a[0]
    for i := 0; i < len(a); i++ {
        if r < a[i] {
            r = a[i]
        }
    }
    return r
}
 
func Min(a []int) int {
    r := a[0]
    for i := 0; i < len(a); i++ {
        if r > a[i] {
            r = a[i]
        }
    }
    return r
}
 
func Sum(a []int) (r int) {
    for i := range a {
        r += a[i]
    }
    return r
}
 
func Abs(a int) int {
    if a < 0 {
        return -a
    }
    return a
}
 
type Pair struct {
    a, b int
}
 
type Pairs []Pair
 
func (p Pairs) Len() int {
    return len(p)
}
 
func (p Pairs) Swap(i, j int) {
    p[i], p[j] = p[j], p[i]
}
 
func (p Pairs) Less(i, j int) bool {
    return p[i].b < p[j].b
}
 
var nextReader func() string
 
func init() {
    nextReader = NewScanner()
}
 
func NewScanner() func() string {
    r := bufio.NewScanner(os.Stdin)
    r.Buffer(make([]byte, 1024), int(1e+11))
    r.Split(bufio.ScanWords)
    return func() string {
        r.Scan()
        return r.Text()
    }
}

func nextString() string {
    return nextReader()
}
 
func nextInt64() int64 {
    v, _ := strconv.ParseInt(nextReader(), 10, 64)
    return v
}
 
func nextInt() int {
    v, _ := strconv.Atoi(nextReader())
    return v
}
 
func nextInts(n int) []int {
    r := make([]int, n)
    for i := 0; i < n; i++ {
        r[i] = nextInt()
    }
    return r
}

func nextStrings(n int) []string {
    r := make([]string, n)
    for i := 0; i < n; i++ {
        r[i] = nextString()
    }
    return r
}

func nextFloat64() float64 {
    f, _ := strconv.ParseFloat(nextReader(), 64)
    return f
}


Measured memory_bytes: 82968
#include<stdio.h>
#include<stdio.h>
int main(void)
{
  int n,i;
  int pt=0,ph=0;
  char taro[101],hana[101];
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%s %s", taro, hana);
    if(strcmp(taro,hana)>0) pt+=3;
       else if (strcmp(taro,hana)<0) ph+=3;
    else{
      pt++;
      ph++;
    }
  }
  printf("%d %d\n",pt,ph);
  return 0;
}

Measured memory_bytes: 604
#include <bits/stdc++.h>
using namespace std; 
const int N = 3001, mod = 1e9+7;

int f[N], g[N];

inline int add(int x, int y) { return x += y, x %= mod; }
inline int mul(long long x, int y) { return x *= y, x %= mod; }
inline int power(int x, int y) {
    int z = 1;
    while (y > 0) {
        if (y&1)        
            z = mul(z,x);
        x = mul(x,x), y >>= 1; }
    return z; }
    
inline int nCk(int n, int k) { return mul(f[n],mul(g[k],g[n-k])); }

int main() {
    int s, ans = 0; 
    cin >> s, f[0] = f[1] = g[0] = g[1] = 1;
    for (int x = 2; x < N; ++x)
        f[x] = mul(f[x-1],x);
    g[N-1] = power(f[N-1],mod-2);
    for (int x = N-1; x > 2; --x)
        g[x-1] = mul(g[x],x);
    for (int k = 1, n = s-3; n >= 0; ++k, n -= 3)
        ans = add(ans,nCk(n+k-1,n));
    cout << ans; }
    

Measured memory_bytes: 3652
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n;
  cin>>n;
  vector<int> a(n);
  for(int i=0;i<n;i++){
    cin>>a[i];
  }
  vector<int> cost;
  for(int p=-100;p<=100;p++){
    int sum=0;
    for(int i=0;i<n;i++){
      sum+=(p-a[i])*(p-a[i]);
    }
    cost.push_back(sum);
  }
  cout<<(*min_element(cost.begin(),cost.end()));
}

Measured memory_bytes: 256
fun main(args:Array<String>):Unit {
    while (true) {
        val n = readLine()!!.toInt()
        if (n == 0) return
        val (w, h) = readLine()!!.trim().split(' ').map(String::toInt)
        val state = Array(h){Array(w){0}}
        val tree = Array(n){
            val (x, y) = readLine()!!.trim().split(' ').map(String::toInt)
            Pair(x - 1, y - 1)
        }
        val (s, t) = readLine()!!.trim().split(' ').map(String::toInt)
        tree.forEach { (x, y) ->
            state[y][x]++
            if (y + t in 0 until h) state[y + t][x]--
            if (x + s in 0 until w) state[y][x + s]--
            if (y + t in 0 until h && x + s in 0 until w) state[y + t][x + s]++
        }
        for (y in 1 until h) for (x in 0 until w) state[y][x] += state[y - 1][x]
        for (y in 0 until h) for (x in 1 until w) state[y][x] += state[y][x - 1]

        println(state.mapNotNull{it.max()}.max()!!)
    }
}


Measured memory_bytes: 42368
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int a = scan.nextInt();
        int b = scan.nextInt();
        int c = scan.nextInt();

        System.out.println(Math.max(0, c - (a - b)));
    }
}


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

using namespace std;

//小さい文字列を返す関数
string compare_str(string a, string b){
    int len_a = a.length();
    int len_b = b.length();
    //(ありえないが)長さが違う場合
    if(len_a != len_b){
        if(len_a > len_b){
            return b;
        }else{
            return a;
        }
    }
    //比較
    if(a.compare(b) > 0){
        return b;
    }else{
        return a;
    }
}

int main(){
    int N,L;
    string tmp,smaller,result;
    vector<string> vec;

    //read
    cin >> N >> L;

    //vecにSnを格納
    for(int i=0; i<N; i++){
        cin >> tmp;
        vec.push_back(tmp);
    }

    //sort
    sort(vec.begin(),vec.end());

    //出力結果作成
    for(int i=0;i<N; i++){
        result += vec[i];
    }
    //出力
    cout << result << endl;

    return 0;
}

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

using namespace std;
int main()
{
  int a,b ;
  cin >> a >> b ;
  
  int ans=-1;
  for(float i=10.0;i<1010;++i){
    if(int(i*0.08)==a && int(i*0.1)==b){ 
      ans=i;
      break;
    }
  }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

def main():
    A,B=map(int, input().split())
    ans = factorization(gcd(A,B))
    if ans[0][0] == 1:
        print(1)
    else:
        print(len(ans)+1)

if __name__ == '__main__':
    main()

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#include <boost/integer/common_factor_rt.hpp>
using namespace std;
using ll=long long;
const int MOD=1000000007;


int main() {
  int n,m,c;
  cin >> n >> m >> c;
  vector<int> b(m);
  for(int i=0;i<m;i++){
    cin >> b.at(i);
  }
  vector<vector<int>> data(n, vector<int>(m));
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      cin >> data.at(i).at(j);
    }
  }
  int ans=0;
  for(int i=0;i<n;i++){
    int sum=0;
    for(int j=0;j<m;j++){
      sum+=(data.at(i).at(j))*b.at(j);
    }
    if(sum+c>0)
    ans++;
  }
  cout << ans << endl;
}



Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<int, int> PII;
template<class A, class B> ostream& operator <<(ostream& out, const pair<A, B> &p) {
    return out << "(" << p.first << ", " << p.second << ")";
}
template <typename T, size_t N>
ostream& operator <<(ostream& out, const array<T, N>& a) {
  out << "["; bool first = true;
  for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
  return out;
}
template <typename T>
ostream& operator <<(ostream& out, const vector<T>& a) {
  out << "["; bool first = true;
  for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
  return out;
}
template <typename T, class Cmp>
ostream& operator <<(ostream& out, const set<T, Cmp>& a) {
  out << "{"; bool first = true;
  for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "}";
  return out;
}
template <typename U, typename T, class Cmp>
ostream& operator <<(ostream& out, const map<U, T, Cmp>& a) {
  out << "{"; bool first = true;
  for (auto& p : a) { out << (first ? "" : ", "); out << p.first << ":" << p.second; first = 0;} out << "}";
  return out;
}
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;
}
template<class T> T gcd(T a, T b) {
    if(a && b) { return gcd(min(a, b), max(a, b) % min(a, b)); }
    else { return a; }
}
template<class T> T lcm(T a, T b){
    return a / gcd(a, b) * b;
}
const int MOD = 2019;
long long qpow(long long a, long long b) {
    if (b == 0) return 1;
    long long res = 1;
    while (b) {
        if (b & 1) res = (res * a) % MOD;
        a = (a * a) % MOD;
        b >>= 1;
    }
    return res;
}

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

    int n;
    cin >> n;
    vector<int> a(n + 1);
    for (int i = 1; i <= n; i++) cin >> a[i];
    map<int, int> m;
    LL ans = 0;
    for (int i = 1; i <= n; i++) {
        ans += m[i - a[i]];
        m[a[i] + i]++;
    }
    cout << ans << '\n';


    return 0;
}


Measured memory_bytes: 20964
(let ((s (read-line))
      (a 300000)
      (z 0))
     (loop for i from 0 below (length s) do
           (if (eq #\A (char s i)) (setf a (min a i)))
           (if (eq #\Z (char s i)) (setf z (max z i))))
     (princ (1+ (- z a))))

Measured memory_bytes: 12644
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long ll;
typedef pair<ll,ll> P;
const ll mod=1000000007;
const ll LINF=1LL<<60;
const int INF=1<<30;

int main(){
	ll a,b;
	cin >> a >> b;
	ll c = b - a;
	ll d = 0;
	for (int i = 1;i<= c;i++){
		d+= i;
	}
	cout << d - b <<endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<vector>
using namespace std;
#define lli long long int
#define test                lli t;cin>>t;while(t-->0)
#define ainput  int n;cin>>n;int a[n];for(int i=0;i<n;i++){cin>>a[i];}
#define vec vector<lli>v;
vec
#define avinput  int n;cin>>n;int a[n];for(int i=0;i<n;i++){cin>>a[i];v.push_back(a[i]);}
#define vp  for(lli i=0;i<v.size();i++) {cout<<v[i]<<" ";}cout<<endl;
#define vp1  for(lli i=0;i<v1.size();i++) {cout<<v1[i]<<" ";}cout<<endl;
#define vp2  for(lli i=0;i<v2.size();i++) {cout<<v2[i]<<" ";}cout<<endl;
#define vp3  for(lli i=0;i<v3.size();i++) {cout<<v3[i]<<" ";}cout<<endl;
#define vp6  for(lli i=0;i<v6.size();i++) {cout<<v6[i].first<<" "<<v6[i].second<<endl;}
#define vp16  for(lli i=0;i<v16.size();i++) {cout<<v16[i].first<<" "<<v16[i].second<<endl;}
#define ln cout<<endl;
  //cout << fixed << setprecision(10) <<((double)((sum*1.0)/((n*1.0-k*1.0)+1.0))) << endl;
set<lli>s1;
set<lli>s2;
set<string>st2;
vector<lli>v1;
vector<lli>v2;
vector<lli>v3;
vector<lli>v4;
vector<lli>v5;
vector<pair<lli,lli> >v6;
vector<pair<lli,lli> >v16;
vector<string>v7;
vector<string>v8;
vector<char>v9;
vector<double>v11;
list<lli>l;
//****coding start****
int main(){
lli n;cin>>n;
lli b[n-1];
for(lli i=0;i<n-1;i++){
    cin>>b[i];
}
v.push_back(b[0]);
//cout<<b[0]<<" "<<b[1]<<endl;
for(lli i=1;i<n-1;i++){
    v.push_back(min(b[i],b[i-1]));
}
lli sum=0;
v.push_back(b[n-2]);
for(lli i=0;i<v.size();i++){
    sum=sum+v[i];
}
cout<<sum<<endl;
return 0;
}

Measured memory_bytes: 3608
#include <iostream>
#include <string>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
#include <stack>
#include <functional>
#include <bitset>
#include <assert.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef pair<ll,ll> P;
typedef vector<P> vpl;
typedef tuple<ll,ll,ll> tapu;
#define rep(i,n) for(ll i=0; i<(n); i++)
#define REP(i,a,b) for(int i=(a); i<(b); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
const int inf = 1<<30;
const ll linf = 1LL<<62;
const int MAX = 510000;
ll dy[8] = {0,1,0,-1,1,-1,1,-1};
ll dx[8] = {1,0,-1,0,1,-1,-1,1};
const double pi = acos(-1);
const double eps = 1e-7;
template<typename T1,typename T2> inline bool chmin(T1 &a,T2 b){
	if(a>b){
		a = b; return true;
	}
	else return false;
}
template<typename T1,typename T2> inline bool chmax(T1 &a,T2 b){
	if(a<b){
		a = b; return true;
	}
	else return false;
}
template<typename T1,typename T2> inline void print2(T1 a, T2 b){cout << a << " " << b << "\n";}
template<typename T1,typename T2,typename T3> inline void print3(T1 a, T2 b, T3 c){
	cout << a << " " << b << " " << c << "\n";
}
const int mod = 1e9 + 7;
//const int mod = 998244353;

int main(){
	ll n; cin >> n;
	vl a(n); rep(i,n) cin >> a[i];
	multiset<ll> mse;
	vl cnt(2*n+1,0);
	rep(i,n){
		if(a[i] > n) continue;
		cnt[a[i] - i - 1 + n]++;
	}
	ll ans = 0;
	rep(i,n){
		if(a[i] > n) continue;
		if(a[i] + i + 1 > n) continue; 
		ans += cnt[n - (a[i] + i + 1)];
		cnt[a[i] - i - 1 + n]--;
	}
	cout << ans << endl;
}

Measured memory_bytes: 8008
#include <bits/stdc++.h>
typedef long long int ll;
using namespace std;
#define MAX 1000000000
vector<ll> vec;
void dfs(ll x) {
    ll a1 = x * 10 + 3;
    ll a2 = x * 10 + 5;
    ll a3 = x * 10 + 7;
    if (a1 < MAX) {
        vec.push_back(a1);
        dfs(a1);
    }
    if (a2 < MAX) {
        vec.push_back(a2);
        dfs(a2);
    }
    if (a3 < MAX) {
        vec.push_back(a3);
        dfs(a3);
    }
}
bool check(ll a) {
    bool thr = false;
    bool fiv = false;
    bool sev = false;
    while (a) {
        if (a % 10 == 3) {
            thr = true;
        }
        else if (a % 10 == 5) {
            fiv = true;
        }
        else {
            sev = true;
        }
        a /= 10;
    }
    return thr && fiv && sev;
}
int main () {
    int n;
    cin >> n;
    int count = 0;
    dfs(0);
    for (int i = 0; i < vec.size(); i++) {
        if ((n >= vec[i])&&(check(vec[i]))) {
            count++;
        }
    }
    cout << count << endl;
    return 0;
}

Measured memory_bytes: 3760
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<cstring>
#include<queue>
#include<cstdio>
#include<sstream>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
const double EPS=1e-10;
const int inf=1e9;
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;
int main(){
	int n,m;
	while(cin>>n>>m,n||m){
		vi in(m);
		rep(i,m)cin>>in[i];
		int r=1,l=15000001;
		while(l-r>1){
			int h=(r+l)/2;
			int c=1;
			int sum=0;
			rep(i,m){
				if(sum==0&&in[i]>h){
					c=1e9;
					break;
				}else if(sum+in[i]>h){
					c++;sum=0;
					i--;
				}else{
					sum+=in[i];
				}
			}
			if(c<=n)l=h;
			else r=h;
		}
		cout<<l<<endl;
	}
}

Measured memory_bytes: 1196
// 22
/****************************************************
https://searleser97.gitlab.io/algorithms/template.cpp
****************************************************/

#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define fors(_, x, n, s) for (int _ = x; _ < n; _ += s)
#define forn(_, x, n) fors(_, x, n, 1)
#define rep(_, n) forn(_, 0, n)
#define forrs(_, x, n, s) for (int _ = x; _ > n; _ -= s)
#define forrn(_, x, n) forrs(_, x, n, 1)
#define rrep(_, n) forrn(_, n - 1, -1)
#define fi first
#define se second
#define pb push_back
#define pairii pair<int, int>
#define all(x) x.begin(), x.end()
#define cerr(s) cerr << "\033[48;5;196m\033[38;5;15m" << s << "\033[0m"
// typedef __int128_t lli;
typedef long long int li;
typedef long double ld;
// 12
void _main(int tc) {
  li n, W;
  cin >> n >> W;
  vector<int> w(n), v(n);
  rep(i, n) { cin >> w[i] >> v[i]; }
  vector<vector<li>> mem(n, vector<li>(W + 1, -1));
  // function<li(int, int)> knapsack = [&](int i, int k) -> li {
  //   assert(k <= W);
  //   if (i == n - 1)
  //     if (k + w[i] <= W)
  //       return v[i];
  //     else
  //       return 0;
  //   if (mem[i][k] != -1) return mem[i][k];
  //   if (k + w[i] <= W) mem[i][k] = v[i] + knapsack(i + 1, k + w[i]);
  //   mem[i][k] = max(mem[i][k], knapsack(i + 1, k));
  //   return mem[i][k];
  // };
  // cout << knapsack(0, 0) << endl;
  rrep(i, n) {
    rrep(k, W) {
      if (i == n - 1) {
        if (k + w[i] <= W) mem[i][k] = v[i];
        else mem[i][k] = 0;
        continue;
      }
      if (k + w[i] <= W) mem[i][k] = v[i] + mem[i + 1][k + w[i]];
      mem[i][k] = max(mem[i][k], mem[i + 1][k]);
    }
  }
  cout << mem[0][0] << endl;
}

int main() {
  ios_base::sync_with_stdio(0), cin.tie(0);
  _main(0);
  return 0;
  int tc;
  cin >> tc;
  rep(i, tc) _main(i + 1);
}

Measured memory_bytes: 79488
/* {{{ Shinobu kawaii */
/*
  ______   __        _                  __                 
.' ____ \ [  |      (_)                [  |                
| (___ \_| | |--.   __   _ .--.   .--.  | |.--.   __   _   
 _.____`.  | .-. | [  | [ `.-. |/ .'`\ \| '/'`\ \[  | | |  
| \____) | | | | |  | |  | | | || \__. ||  \__/ | | \_/ |, 
 \______.'[___]|__][___][___||__]'.__.'[__;.__.'  '.__.'_/ 

*/
/* }}} */

#include <bits/stdc++.h>
using namespace std;

// #define int long long
struct Fast {Fast(){std::cin.tie(0);ios::sync_with_stdio(false);}} fast;

/* cpp template {{{ */

/* short */
#define pb push_back
#define mp make_pair
#define Fi first
#define Se second
#define ALL(v) (v).begin(), (v).end()
#define X real()
#define Y imag()

/* REPmacro */
#define REPS(i, a, n) for (int i = (a); i < (n); ++i)
#define REP(i, n) REPS(i, 0, n)
#define RREP(i, n) REPS(i, 1, n + 1)
#define DEPS(i, a, n) for (int i = (a); i >= n; --i)
#define DEP(i, n) DEPS(i, n, 0)

/* debug */
#define debug(x) cerr << x << " " << "(L:" << __LINE__ << ")" << '\n';

/* typedef */
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<vii> viii;
typedef pair<int, int> pii;
typedef double D;
typedef complex<D> P;

/* const */
const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1e9 + 7;
const D EPS = 1e-9;
const int dx[] = {0, 1, 0, -1, 1, -1, 1, -1}, dy[] = {1, 0, -1, 0, 1, -1, -1, 1};

/* func */
inline bool inside(int y, int x, int H, int W) {return y >= 0 && x >= 0 && y < H && x < W;}
inline int in() {int x; std::cin >> x; return x;}
template <typename T> void print(T x) {std::cout << x << '\n';}
template <typename T>
void print(std::vector<T>& v, std::string s = " ") {
  REP(i, v.size()) {
    if (i != 0) std::cout << s;
    std::cout << v[i];
  }
  std::cout << '\n';
}

/* }}} */

signed main()
{
  string s;
  cin >> s;

  s.insert(4, " ");
  print(s);

  return 0;
}



Measured memory_bytes: 256
/*
Author:Jenil Mehta
Not yet serious but trying to be serious :)
Coding is lub
*/
 
#include <iostream>
#include <sstream>
#include <cstdio>
#include <climits>
#include <cmath>
#include <cstring>
#include <cctype>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <functional>
#include<iostream>
#include<vector>
#include<algorithm>
#include<iomanip>
#define boostup ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
typedef long long int ll;
ll power(ll a, ll n) {ll p = 1;while (n > 0) {if(n%2) {p = p * a;} n >>= 1; a *= a;} return p;}
ll power(ll a, ll n, ll mod) {ll p = 1;while (n > 0) {if(n%2) {p = p * a; p %= mod;} n >>= 1; a *= a; a %= mod;} return p % mod;}
using namespace std;
int main()
{
    boostup;
    // ll t;
    // while(t--)
    // {
        ll n;
        cin>>n;
        stack <int> s;
        s.push(1);
        s.push(5);
        s.push(10);
        s.push(50);
        s.push(100);
        s.push(500);
        ll cost=0;
        while(n!=0)
        {
            if(s.top()<=n)
            {
                if(s.top()==500)
                {
                    ll d=n/s.top();
                    n=n-d*s.top();
                    s.pop();
                    cost+=d*1000;
                    //cout<<cost<<" ";
                }
                if(s.top()==5)
                {
                    ll d=n/s.top();
                    n=n-d*s.top();
                    s.pop();
                    cost+=d*5;
                    //cout<<cost<<" ";
                }
                if(s.top()==50||s.top()==100||s.top()==200||s.top()==10)
                {
                    s.pop();
                }
                else
                {
                    n=0;
                }
            }
            else
            {
                s.pop();
            }
            //cout<<s.top()<<" "<<n<<endl;
        }
        //cout<<endl;
        cout<<cost<<endl;
    //}
}

Measured memory_bytes: 256
# coding:utf-8

import numpy as np


INF = float('inf')


def inpl(): return list(map(int, input().split()))


N = int(input())
V = inpl()

A = [0 for _ in range(10**5+1)]
for i in range(0, N, 2):
    A[V[i]] += 1

B = [0 for _ in range(10**5+1)]
for i in range(1, N, 2):
    B[V[i]] += 1

A = np.array(A)
B = np.array(B)

if A.argmax() == B.argmax():
    A.sort()
    B.sort()
    tmp = max(A[-1] + B[-2] , A[-2] + B[-1])
    ans = N - tmp
else:
    A.sort()
    B.sort()
    ans = N - A[-1] - B[-1]

print(ans)


Measured memory_bytes: 32156
#include <stdio.h>
int main() {
    char S[110];
    int ans = 0;
    scanf("%s",S);
    for (int i = 0; i <= sizeof S / sizeof S[0]; i++) {
        if (((i + 1)%2 == 0) &&  S[i] == 'R') {
            ans = 1;
        }else if(((i + 1)%2 == 1) && S[i] == 'L'){
            ans = 1;
        }
    }
    if(ans == 0){
        printf("Yes");
    }else{
        printf("No");
    }
    return 0;
}

Measured memory_bytes: 128
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        char[] s = sc.next().toCharArray();
        int n = s.length;
        int res = 0;
        for(int i=0; i<(n-1-i); i++) {
            if(s[i] != s[n-1-i]) {
                res++;
            }
        }

        System.out.println(res);
    }
}


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

ll r(ll x, ll y) {
  if (y == 0) return 1;
  else if (y % 2 == 0) return r(x, y/2) * r(x, y/2) % mod;
  else return x * r(x, (y-1)/2) % mod * r(x, (y-1)/2) % mod;
}
  
int main() {
  string s;
  cin >> s;
  bool f = 0;
  for (int i = 0; i < 3; i++) {
    if (s[i] == '7') {
      f = 1;
      break;
    }
  }
  if (f) {
    cout << "Yes" <<endl;
  }
  else {
    cout << "No" <<endl;
  }
} 


Measured memory_bytes: 3624
#include<stdio.h>
int main(){
    int num;
    int data[4][3][10];
    int b, f, r, v;
    int i, j, k;
    for(i = 0;i < 4;i++){
        for(j = 0;j < 3;j++){
            for(k = 0;k < 10;k++){
                data[i][j][k] = 0;
            }
        }
    }
    scanf("%d", &num);
    for(i = 0;i < num;i++){
        scanf("%d %d %d %d", &b, &f, &r, &v);
        data[b - 1][f - 1][r - 1] += v;
    }
    for(i = 0;i < 4;i++){
        for(j = 0;j < 3;j++){
            for(k = 0;k < 10;k++){
                printf(" %d", data[i][j][k]);
            }
            printf("\n");
        }
        if(i != 3){
           printf("####################\n");
        }
    }
    return 0;
}


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

using namespace std;
typedef long long ll;
const int INF = 1e9;

int main(){
	ll T = 1;
	//cin >> T;
	while (T--){
		int a;
		int b;
		int c;
		int d;
		cin >> a >> b >> c >> d;
		while (a > 0 && b > 0) {
          c = c - b;
          if (c <= 0) {
			  cout << "Yes" << endl;
			  return 0;
		  }
		  a = a - d;
		  if (a <= 0) {
			  cout << "No" << endl;
			  return 0;
		  }
	  }
	}
}

Measured memory_bytes: 3616
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <limits>
#include <numeric>
#define FOR(i, a, n) for (int i = (a); i < (n); i++)
#define REP(i, n) for(int i = 0; i < (n); i++)
#define ALL(obj) (obj).begin(), (obj).end()
using namespace std;


int main()
{
	int R = 0;

	cin >> R;

	if (R < 1200)
	{
		cout << "ABC" << endl;
	}
	else if(R < 2800)
	{
		cout << "ARC" << endl;
	}
	else
	{
		cout << "AGC" << endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 2e5+5;

ll s[N];

int main()
{
    //freopen("in.txt","r",stdin);
    //freopen("out.txt","w",stdout);
    ios_base::sync_with_stdio(false);
    cin.tie(NULL),cout.tie(NULL);
    cout<<setprecision(10)<<fixed;

    register ll n,k,x,m=0;
    scanf("%lld%lld",&n,&k);

    for(int i=1;i<=n;i++)
    {
        scanf("%lld",&x);
        s[i]=(x+1+s[i-1]);
    }

    for(int i=k;i<=n;i++)
        m = (s[i]-s[i-k] > m) ? (s[i]-s[i-k]) : m;

    printf("%0.12lf\n",(m/2.0));

    return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define pi 3.14

typedef long long LL;
using namespace std;

int main()
{
	int N;
	LL dp[2001];
	LL S[2001];
	LL MOD=1e9+7;
	cin>>N;
	dp[0]=0;
	dp[1]=0;
	dp[2]=0;
	S[0]=0;
	S[1]=0;
	S[2]=0;
	for(int i=3;i<=N;i++){
		dp[i]=S[i-3]+1;
		S[i]=dp[i]+S[i-1];
		dp[i]%=MOD;
		S[i]%=MOD;
	}
	cout<<dp[N]<<endl;
	return 0;

}

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

void bubble(int *pbuff, int n){
	int v;
	int j;
	int flag=1;
	int i=0;
	int count=0;
	while(flag){
		flag=0;
		for(int i=n-1;j<i;i--){
			if(pbuff[i]<pbuff[i-1]){
				v=pbuff[i];
				pbuff[i]=pbuff[i-1];
				pbuff[i-1]=v;
				count++;
			}
			flag=1;
		}
		j++;
	}
		for(int j=0;j<n-1;j++) cout << pbuff[j]<<" ";
		cout << pbuff[n-1]<<endl;
		cout << count<<endl;
	return ;
}

int main()
{
	int n;
	cin>> n;
	int buff[100];
	for(int j=0;j<n;j++) cin >> buff[j];
	bubble(buff,n);
	return 0;
}



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

int main() {
    int N;
    ll prev, sum = 0;
    cin >> N >> prev;
    for(int i = 1; i < N; i++) {
        ll a;
        cin >> a;
        if(prev <= a) prev = a;
        else sum += prev - a;
    }
    cout << sum << endl;
}

Measured memory_bytes: 3592
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <numeric>
#include <map>
#include <queue>
#include <deque>
#include <set>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define FOR(i,a,b) for (int i = (a) ; i <= (b); ++i)
#define all(x) (x).begin(), (x).end()
//#define repitr(itr, st) for(auto itr = st.begin(); itr != st.end(); ++itr)
#define P_B push_back
#define PO_B pop_back
#define E_B emplace_back
#define M_P make_pair
#define fi first
#define se second
#define debug(x) cout << #x << ": " << x << endl
//#define print(x) printf("%d\n", x)

using namespace std;
using ll = long long;
using Pii = pair<int,int>;
using Pll = pair<ll,ll>;
using VI = vector<int>;
using VL = vector<ll>;
using VVI = vector<vector<int> >;
using VVL = vector<vector<ll> >;
//int dx[4] = {1, 0, -1, 0};
//int dy[4] = {0, 1, 0, -1};
//const ll LINF = (ll)1e18 - 1;
//const int INF = 1e9 - 1;
//int:±2*10^9くらい　ll:±9*10^18くらい


void Main(){
	int N, M;
	cin >> N >> M;
	int INF = 1000000007;
	VI dp(N+1, 0);
	rep(i, M){
		int a;
		cin >> a;
		dp[a] = -1;
	}

	dp[0] = 1;
	if(dp[1] == -1) dp[1] = 0;
	else dp[1] = 1;

	FOR(i, 2, N){
 		if(dp[i] == -1){
			dp[i] = 0;
			continue;
		}
		dp[i] = (dp[i-1] + dp[i-2]) % INF;
	}

	cout << dp[N] << endl;

}

int main()
{
	cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Main();

  return 0;
}


Measured memory_bytes: 3664