akhauriyash/Code-Regression huggingface dataset:
#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define REP(i,a) FOR(i,0,a)
const ll MAX_N=20;
ll N,H[MAX_N];
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll ans=0;
    cin>>N;
    REP(i,N){
        cin>>H[i];
        bool f=true;
        REP(j,i){
            if(H[j]>H[i]){
                f=false;
            }
        }
        if(f)ans++;
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 256
h,w,k = map(int,input().split())
c_list=[input() for _ in range(h)]

def iter_p_adic(p, n):
    '''
    連続して増加するp進数をリストとして返す。nはリストの長さ
    return
    ----------
    所望のp進数リストを次々返してくれるiterator
    '''
    from itertools import product
    tmp = [range(p)] * n
    return product(*tmp)

h_iter = list(iter_p_adic(2, h))
w_iter = list(iter_p_adic(2, w))

count = 0
for h_iter_i in range(len(h_iter)):
    for w_iter_i in range(len(w_iter)):
        count_tmp = 0
        for h_i in range(len(c_list)):
            for w_i in range(len(c_list[h_i])):
#                 if c_list[h_i][w_i] == '#':
                if c_list[h_i][w_i] == '#' and h_iter[h_iter_i][h_i] == 0 and w_iter[w_iter_i][w_i] == 0:
                    count_tmp += 1
        if count_tmp == k:
            count += 1

print(count)

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

#define INF INT_MAX
#define UINF UINT_MAX
#define MOD 1000000007
#define REP(i,n) for(int i=0;i<n;i++)
#define all(x) (x).begin(),(x).end()

typedef long long ll;
typedef std::pair<int,int> pii;

using namespace std;

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

    string n; 
    cin >> n;

    string ans = "Yes";
    if(n.size() % 2 != 0){
        cout << "No" << endl;
        return 0;
    }
    for(int i = 0;i < n.size();i+=2){
        if(n[i] == 'h' && n[i+1] == 'i')continue;
        else{
            ans = "No";
            break;
        }
    }

    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(){
  int n;
  int i;
  int num[100];
  int rev[100];
  int input;

  scanf("%d", &n);
  for(i=0; i<n; i++){
    scanf("%d", &input);
    num[i]=input;
  }

  for(i=0; i<n/2; i++){
    int t=num[i];
    num[i]=num[n-i-1];
    num[n-i-1]=t;
  }

  for(i=0; i<n; i++){
    printf("%d", num[i]);
    if(i==n-1){
      break;
    }
    printf(" ");
  }

  printf("\n");
  return 0;
}


Measured memory_bytes: 2036
import java.util.*;

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

    while(true){
      int n = scan.nextInt();
      int[] score;
      double sum = 0, avg;
      double bunsan = 0;
      if(n==0) break;
      score = new int[n];
      for(int i=0;i<n;i++){
        score[i] = scan.nextInt();
        sum += score[i];
      }
      avg = sum / n;
      for(int i=0;i<n;i++){
        bunsan += (score[i]-avg)*(score[i]-avg);
      }
      bunsan /= (double)n;
      bunsan = Math.sqrt(bunsan);
      System.out.println(bunsan);
    }
  }
}



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

int main()
{
  const int g[12] = {1,3,1,2,1,2,1,1,2,1,2,1};
  int x,y;
  cin >> x>>y;

  if(g[x-1]==g[y-1]) cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rrep(i, n) for (int i = (n) - 1; i >= 0; i--)
#define reps(i, n) for (int i = 1; i <= (n); i++)
#define repi(i, a, b) for (int i = (a); i < (b); i++)
#define all(a) (a).begin(), (a).end()
#define bit(b) (1ull << (b))

using namespace std;
using i32 = int;
using u32 = unsigned int;
using i64 = long long;
using u64 = unsigned long long;
using f64 = double;
using f80 = long double;
using pii = pair<i32, i32>;
using vi32 = vector<i32>;
using vu32 = vector<u32>;
using vi64 = vector<i64>;
using vu64 = vector<u64>;
using vf64 = vector<f64>;
using vf80 = vector<f80>;
using vstr = vector<string>;
using vpii = vector<pii>;
using vvi32 = vector<vi32>;
using vvu32 = vector<vu32>;
using vvi64 = vector<vi64>;
using vvu64 = vector<vu64>;
using vvf64 = vector<vf64>;
using vvf80 = vector<vf80>;

template<typename T, typename S> bool amax(T &x, S y) { if (x < y) { x = y; return 1; } return 0; }
template<typename T, typename S> bool amin(T &x, S y) { if (y < x) { x = y; return 1; } return 0; }

bool judge(vi64 &x, vi64 &y) {
  bool b = labs(x[0] + y[0]) % 2;
  reps(i, x.size() - 1) {
    if (b != labs(x[i] + y[i]) % 2) {
      return false;
    }
  }
  return true;
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout << fixed << setprecision(16);
  cerr << fixed << setprecision(16);
  int n;
  cin >> n;
  vi64 x(n), y(n);
  rep(i, n) cin >> x[i] >> y[i];
  if (!judge(x, y)) {
    cout << -1 << endl;
    return 0;
  }
  int len = 32;
  if (labs(x[0] + y[0]) % 2 == 0) {
    cout << len + 1 << endl;
    rrep(i, len) {
      cout << bit(i) << " ";
    }
    cout << bit(0) << endl;
  } else {
    cout << len << endl;
    rrep(i, len) {
      if (i == 0) {
        cout << bit(i) << endl;
      } else {
        cout << bit(i) << " ";
      }
    }
  }
  rep(i, n) {
    string s = "";
    i64 fx = x[i], fy = y[i];
    rrep(j, len) {
      if (labs(fx) > labs(fy)) {
        if (fx < 0) {
          fx += bit(j);
          s.push_back('L');
        } else {
          fx -= bit(j);
          s.push_back('R');
        }
      } else {
        if (fy < 0) {
          fy += bit(j);
          s.push_back('D');
        } else {
          fy -= bit(j);
          s.push_back('U');
        }
      }
    }
    if (fx == 1) {
      s.push_back('R');
    } else if (fx == -1) {
      s.push_back('L');
    } else if (fy == 1) {
      s.push_back('U');
    } else if (fy == -1) {
      s.push_back('D');
    }
    cout << s << endl;
  }
  return 0;
}

Measured memory_bytes: 256
N, K = gets.split.map(&:to_i)
A = gets.split.map(&:to_i).sort

dp = Array.new(K + 1, false)
A[0].upto(K) do |i|
  A.each do |n|
    break if i - n < 0
    if !dp[i - n]
      dp[i] = true
      break
    end
  end
end
puts dp[K] ? 'First' : 'Second'

Measured memory_bytes: 2556
#include <iostream>
#include <queue>
#include <vector>
using namespace std;

vector<vector<int> > Next;
int n, m, S, T;

void tansaku(){
    queue<int> Q;
    vector<int> d(3*n, -1); d[S-1] = 0;
    Q.push(S-1);
    for(int j = 0; !Q.empty(); j++){
        int cur = Q.front(); Q.pop();
        for(int i = 0; i < Next[cur].size(); i++){
            int t = Next[cur][i];
            if(d[t]==-1){
                Q.push(t); d[t] = d[cur] + 1;
            }
            if(t==T-1){
                cout << d[t]/3 << endl; return;
            }
        }
    }
    cout << -1 << endl;
    return;
}


int main(){
    cin >> n >> m;
    Next.resize(3*n);
    for(int i = 0; i < m; i++){
        int u, v; cin >> u >> v;
        Next[u-1].push_back(v-1+n);
        Next[u-1+n].push_back(v-1+n+n);
        Next[u-1+n+n].push_back(v-1);
    }
    cin >> S >> T;
    tansaku();
    return 0;
}


Measured memory_bytes: 17792
#include <algorithm>
#include <climits>
#include <cmath>
#include <iostream>
#include <numeric>
#include <queue>
#include <unordered_map>
#include <vector>

const int mod = 1e9 + 7;

int main()
{
    std::vector<int> num_cakes(3);
    for (int i = 0; i < 3; i++) {
        std::cin >> num_cakes[i];
    }

    int k;
    std::cin >> k;

    std::vector<std::vector<long long>> value_cakes(3);
    for (int i = 0; i < 3; i++) {
        for (int j = 0; j < num_cakes[i]; j++) {
            long long temp;
            std::cin >> temp;

            value_cakes[i].push_back(temp);
        }
        std::sort(value_cakes[i].begin(), value_cakes[i].end(), std::greater<long long>());
    }

    std::priority_queue<std::tuple<long long, int, int, int>> q;
    std::vector<std::tuple<long long, int, int, int>> found;

    std::tuple<long long, int, int, int> first = std::make_tuple(value_cakes[0][0] + value_cakes[1][0] + value_cakes[2][0], 0, 0, 0);
    q.push(first);
    found.push_back(first);

    for (int i = 0; i < k; i++) {
        std::tuple<long long, int, int, int> top = q.top();
        q.pop();

        std::cout << std::get<0>(top) << std::endl;

        std::vector<int> idxes(3);
        idxes[0] = std::get<1>(top);
        idxes[1] = std::get<2>(top);
        idxes[2] = std::get<3>(top);

        for (int l = 0; l < 3; l++) {
            if (idxes[l] + 1 >= num_cakes[l]) {
                continue;
            }
            std::tuple<long long, int, int, int> next = std::make_tuple(0, 0, 0, 0);
            for (int j = 0; j < 3; j++) {
                std::get<0>(next) += value_cakes[j][idxes[j] + (j == l ? 1 : 0)];
            }
            std::get<1>(next) = idxes[0] + (l == 0 ? 1 : 0);
            std::get<2>(next) = idxes[1] + (l == 1 ? 1 : 0);
            std::get<3>(next) = idxes[2] + (l == 2 ? 1 : 0);
            if (std::find(found.begin(), found.end(), next) != found.end()) {
                continue;
            }
            q.push(next);
            found.push_back(next);
        }
    }
}


Measured memory_bytes: 768
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES

#include <cmath>
#include <cstdio>

#include <algorithm>
#include <iostream>
#include <iterator>
#include <numeric>
#include <map>
#include <set>
#include <vector>

using namespace std;

void preambule() {
  cin.tie(0);
  cout.precision(16);
  cout << fixed;
}

int a;
int b;

void input() {
  cin >> a >> b;
}

void solve1() {
  cout << (a + b - 1) / b;
}

int main() {
  preambule();
  input();
  solve1();
}

Measured memory_bytes: 256
#include<stdio.h>

int main(){
	int x,n;
	scanf("%d %d",&x,&n);
	if(n == 0){
		printf("%d",x);
		return 0;
	}
	int i,p[101],tmp,min,max;
	for(i = 0; i < n; i++){
		scanf("%d",&tmp);
		p[tmp] = 1;
	}
	min = x;
	max = x;
	while(1){
		/*if(n == 0){
			printf("%d",x);
			break;
		}*/
		if(p[min] != 1 || p[max] != 1){
			if(p[min] != 1){
				printf("%d",min);
				break;
			} else {
				printf("%d",max);
				break;
			}
		}
		min--;
		max++;
		if(min == 0){
			printf("%d",min);
			break;
		}
		if(101 < max){
			printf("%d",max);
		}
	}
	/*if(n == 0){
		printf("%d",x);
	}*/

	return 0;
}


Measured memory_bytes: 1708
#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 a;
  string s;
  cin >> a >> s;
  
  if(a >= 3200) cout << s << endl;
  else cout << "red" <<endl;
  
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0;i<(n);i++)
#define N 100000
typedef long long ll;
#define ALL(v) (v).begin(),(v).end()
#define SZ(x) int(x.size())
#define OUT(a) cout<<(a)<<endl
#define VECIN(type, c, n) vector<type> c(n);for(auto& i:c) cin>>i;

int main(){
	int n;
    cin>>n;
    vector<int> a(n);
    REP(i,n){
        cin>>a[i];
    }
    pair<int,int> p[3];
    int cnt=0;
    REP(i,n){
        if(a[i]!=(i+1)){
            p[cnt]={i+1,a[i]};
            cnt++;
            if(cnt>=3) break;
        }
    }
    if(cnt>=3) OUT("NO");
    else if(cnt==0)OUT("YES");
    else{
        if(p[0].first==p[1].second) OUT("YES");
        else OUT("NO");
    }
	return 0;
}

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

using namespace std;
using ll = long long;
using vll = vector<long long>;
using sll = set<long long>;
const long long ll_max = 9223372036854775807;
const long long ll_min = -9223372036854775807;
const int int_max = 2147483647;

template<typename T>
T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
template<typename T>
T lcm(T a, T b) { return a / gcd(a, b) * b; }

template<typename T>
map<T, T> getPrimeFactor(T n) {
	map<T, T> ret;
	for (T i = 2; i * i <= n; ++i) {
		while (n % i == 0) {
			ret[i] ++;
			n /= i;
		}
	}
	if (n != 1) ret[n] = 1;
	return ret;
}

template<typename T>
bool IsPrimeNumber(T num)
{
	if (num <= 2) return true;
	else if (num % 2 == 0) return false;

	double sqrtNum = sqrt(num);
	for (int i = 3; i <= sqrtNum; i += 2)
	{
		if (num % i == 0)
		{
			return false;
		}
	}

	return true;
}

template<typename T>
T modinv(T a, T m) {
	T b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}



// 繰り返し二乗法
ll pow2(ll n, ll p, ll mod) {
	if (p == 0 || n == 1) {
		return 1;
	}
	else {
		ll ret = pow2(n * n % mod, p / 2, mod);
		if (p % 2 == 1) {
			ret *= n;
		}
		return ret % mod;
	}
}


#define rep(i,s,e) for(ll i=s;i<e;i++)
#define repeq(i,s,e) for(ll i=s;i<=e;i++)


int main() {
	ll n;
	cin >> n;
	const ll v_max = 1e6;
	
	ll ans = 0;
	rep(a, 1, v_max) {
		ll b = n / a;
		if (a * b == n) {
			b--;
		}
		ans += b;
	}
	cout << ans << endl;
	return 0;
}


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

##
## A - Frog1
## https://atcoder.jp/contests/dp/tasks/dp_b
##

import sys

def solve(N, K, nums):
    assert N > 0
    if N == 1:
        return 0
    costs = []
    costs.append(0)
    costs.append(abs(nums[1] - nums[0]))
    #for i in range(2, min(K, N)):
    #    c = min( costs[j] + abs(nums[i] - nums[j]) for j in range(0, i) )
    #    costs.append(c)
    #for i in range(K, N):
    #    c = min( costs[j] + abs(nums[i] - nums[j]) for j in range(i-K, i) )
    #    costs.append(c)
    for i in range(2, N):
        c = min( costs[j] + abs(nums[i] - nums[j])
                     for j in range(max(i-K, 0), i) )
        costs.append(c)
    return costs[-1]

def load(input):
    line = input.readline()
    N, K = [ int(s) for s in line.split() ]
    nums = [ int(s) for s in input.read().split() ]
    return N, K, nums

def main():
    N, K, nums = load(sys.stdin)
    result = solve(N, K, nums)
    print(result)

main()


Measured memory_bytes: 13924
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 1e18;
const ll MOD = 1e9 + 7;
#define all(v) v.begin(), v.end()
#define repi(i, n, init) for (ll i = init; i < (n); i++)
#define repd(i, n, init) for (ll i = (n); i >= init; i--)
#define repm(i, m) for (auto i = m.begin(); i != m.end(); i++)
#define repb(bit, n, init) for (ll bit = init; bit < (1 << n); ++bit)

int main()
{
    string s;
    cin >> s;
    repi(i, s.length(), 0)
    {
        if ((i + 1) % 2 == 0)
        {
            if (!(s.at(i) == 'L' || s.at(i) == 'D' || s.at(i) == 'U'))
            {
                puts("No");
                return 0;
            }
        }
        else
        {
            if (!(s.at(i) == 'R' || s.at(i) == 'D' || s.at(i) == 'U'))
            {
                puts("No");
                return 0;
            }
        }
    }
    puts("Yes");
    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <queue>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;

int R, G;

int main() {
  cin >> R >> G;
  cout << 2 * G - R << endl;

  return 0;
}


Measured memory_bytes: 3624
n=int(input())
lst=tuple(map(int,input().split()))

sm=1000
stock=0

#token=0:下降しきるまで待つフェイズ。token=1:上昇しきるまで待つフェイズ
token=0
for i in range(n-1):
    if token==0:
        if lst[i+1]<=lst[i] : continue 
        stock=sm//lst[i]       
        sm=sm%lst[i]
        token=1
    else :
        if lst[i+1]>=lst[i] : continue
        sm+=stock*lst[i]
        stock=0
        token=0

if token==1 :
    sm+=stock*lst[n-1]

print(sm)

        

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

using namespace std;
using namespace __gnu_pbds;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fbo find_by_order
#define ook order_of_key

typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<int> vi;
typedef long double ld;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;

int main(){
    ios_base::sync_with_stdio(0); cin.tie(0);
    ll n,a,b;
    cin>>n>>a>>b;
    vector<ll> x;
    for(ll i=0;i<n;i++){
        ll k;
        cin>>k;
        x.pb(k);
    }
    ll ans=0;
    for(ll i=1;i<=n-1;i++){
        ll d=x[i]-x[i-1];
        if(d*a>b){
            ans+=b;
        }
        else{
            ans+=d*a;
        }
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 1400
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for (long long  i=a;i<n;i++)
#define sz(A) (int)(A.size())
#define all(x) (x).begin(),(x).end()
#define get(c,x) (upper_bound(c.begin(),c.end(),x)-c.begin())
typedef long long ll;
typedef pair<int, int> PII;
typedef vector<int> VI;

void solve() {
	int n, m, k;
	
	cin >> n >> m >> k;
	VI a(n), b(m);
	rep(i, 0, n)cin >> a[i];
	rep(i, 0, m)cin >> b[i];
	vector<ll> pre1(n), pre2(m);
	pre1[0] = a[0];
	pre2[0] = b[0];
	rep(i, 1, n)pre1[i] = pre1[i - 1] + a[i];
	rep(i, 1, m)pre2[i] = pre2[i - 1] + b[i];
	int ans = get(pre2, k);
	for (int i = 1; i <= n; i++) {
		if (k < pre1[i-1]) {
			break;
		}
		ll left = k - pre1[i-1];
		int find = get(pre2, left);
		ans = max(ans, i + find);
	}
	cout << ans;
}
int main() {
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	int T_ = 1;
	//cin >> T_;
	for (int i = 0; i < T_; i++)solve();
	return 0;
}







Measured memory_bytes: 7952
#include <bits/stdc++.h>
using namespace std;
#define Rep(i,n) for(int i=0;i<(int)(n);i++)
#define For(i,n1,n2) for(int i=(int)(n1);i<(int)(n2);i++)
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define RREP(i,n) for(ll i=((ll)(n)-1);i>=0;i--)
#define FOR(i,n1,n2) for(ll i=(ll)(n1);i<(ll)(n2);i++)
#define RFOR(i,n1,n2) for(ll i=((ll)(n1)-1);i>=(ll)(n2);i--)
#define all(a)  (a).begin(),(a).end()
#define SORT(a) sort((a).begin(),(a).end())
#define oorret 0
#define oor(x) [&](){try{x;} catch(const out_of_range& oor){return oorret;} return x;}()
#define IOS cin.tie(0),ios::sync_with_stdio(false)
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
template<typename T1, typename T2> inline bool chmin(T1& a, T2 b) { if (a > b) { a = b; return 1; }return 0; }
template<typename T1, typename T2> inline bool chmax(T1& a, T2 b) { if (a < b) { a = b; return 1; }return 0; }
template<class Type>struct is_vector : std::false_type {};
template<class ValueType, class Alloc>struct is_vector<std::vector<ValueType, Alloc>> : std::true_type {};
template <typename T> inline ostream& operator << (ostream& out, const vector<T>& v) {
	if (v.empty())return out;
	constexpr bool is_vector_v = is_vector<T>::value;
	if (is_vector_v)for (auto itr = v.begin(); itr != v.end();)out << (*itr), out << ((++itr != v.end()) ? "\n" : "");
	else for (auto itr = v.begin(); itr != v.end();)out << (*itr), out << ((++itr != v.end()) ? " " : "");
	return out;
}
inline void put() {}
template<class T> inline void put(const T& first) { std::cout << first << "\n"; }
template<class T, class... N> inline void put(const T& first, const N& ... rest) { std::cout << first << " "; put(rest...); }
inline void putn() {}
template<class T, class... N> inline void putn(const T& first, const N& ... rest) { std::cout << first << "\n"; putn(rest...); }


int main() {
	int n;
	cin >> n;
	vector<int> a(n);
	bool flag = true;
	REP(i, n) {
		cin >> a[i];
		if (a[i] != n - 1) {
			flag = false;
		}
	}
	if (flag) {
		put("Yes");
		return 0;
	}
	int m = *max_element(all(a));
	vector<int> c(2, 0);
	REP(i, n) {
		if (0 <= m - a[i] && m - a[i] < 2) {
			c[m - a[i]]++;
		} else {
			put("No");
			return 0;
		}
	}
	if (c[0] == 1) {
		put("No");
		return 0;
	}
	if (n - c[0] + 1 <= m && m <= n - c[0] + c[0] / 2) {
		put("Yes");
		return 0;
	}
	put("No");
	return 0;
}


Measured memory_bytes: 640
from collections import deque
s = deque(list(input()))
q = int(input())
# -1がnotReverse, 1がReverser
isR = -1
for i in range(q):
    line = list(input().split())
    t = int(line[0])
    if t == 1:
        isR *= -1
    else:
        f = int(line[1])
        if isR + f == 0 or isR + f == 3:
            s.appendleft(line[2])
        else:
            s.append(line[2])
if isR == 1:
        s.reverse()
print("".join(s))

Measured memory_bytes: 14308
#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.at(i);
  int count = 0;
  for(int i = 0;i < N;i++){
    if(a.at(i) != i + 1){
      count++;
    }
  }
    if(count == 0 || count == 2){
      cout << "YES" << endl;
    }
  else{
    cout << "NO" << endl;
  }
  
}


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

int main () {
    string S;
    cin >> S;
    int n = S.length();
    long long res = 0;
    for(int i = 0; i< (1 << (n - 1)); i++) {
        long long tmp = 0;
        for(int j = 0; j<n; j++) {
            tmp = tmp * 10 + S[j] - '0';
            if(i & (1<<j)) {
                res += tmp;
                tmp = 0;
            }
        }
        res += tmp;
    }
    printf("%ld" , res);
}

Measured memory_bytes: 256
#include<iostream>
#include<list>
#include<vector>
#include<algorithm>
#include<string>
#include<stdio.h>
#include<math.h>
#include<unordered_map>

using namespace std;
using vec = vector<int>;
using mat = vector<vec>;
using lst = list<int>;


int main()
{
	int A, P;
	cin >> A >> P;

	cout << (3 * A + P) / 2 << endl;

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define lli long long int
#define MOD 1000000007
#define KING 1000000002
#define queen 1000002
#define fi first
#define se second
#define se second
#define lsb(i) (i & -i)
#define nl cout<<'\n'
#define TEST cout<<"TEST",nl
#define pr pair<lli,lli>
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define vi vector<lli>
#define vpi vector<pr> 
#define P pair<lli,pr>
#define fastIO ios_base::sync_with_stdio(false); cin.tie(NULL)
#define NA(i,s,n) for(lli i=s;i<n;i++)
using namespace std;

void solve(){
    lli n,k,s=0; cin>>n>>k;
    NA(i,k,n+2){
        lli s1 = ((i-1)*i)/2, s2 = (n*i) - s1; 
        // cout<<(abs(s1-s2))<<' ';
        s += (abs(s1-s2) + 1);
        s %= MOD;
    } //nl;
    cout<<s<<'\n';
    return;
}
int main(){
    fastIO;
    lli t = 1; 
    // cin>>t;
    NA(i,0,t) solve();
    return 0;
}

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

typedef vector<int> vi;



int main(){
  vi dw;
  int dp[100000][5]={};
  for(int i=1;i*i<=100000;i++){
    dw.push_back(i*i);
  }

  for(int t=0;t<dw.size();t++){
    for(int i=1;i+dw[t]<100000;i++){
      for(int h=1;h<4;h++){
	if(i==dw[t] && h==1){dp[i][h]++;}
	dp[i+dw[t]][h+1]+=dp[i][h];
      }
    }
  }
  /*
  for(int i=1;i<26;i++){
    for(int t=1;t<=4;t++){
      cout<<dp[i][t]<<" ";
    }
    cout<<endl;
  }
  */
  while(1){
  int n;
  cin>>n;
  if(n==0){break;}
  cout<<dp[n][1]+dp[n][2]+dp[n][3]+dp[n][4]<<endl;
  }
  
  return 0;
}



Measured memory_bytes: 5112
import java.util.*;

class Main{
	public static void main(String[] args){
		Solve s = new Solve();
		s.solve();
	}	
}

class Solve{
	Solve(){}
	
	Scanner in = new Scanner(System.in);

	void solve(){
		int n = in.nextInt(), m = in.nextInt();
		System.out.println(n * m);
	}

}

Measured memory_bytes: 26324
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
int main() {
  ll n; cin>>n;
  vector<ll> b(n-1);
  rep(i, n-1) cin>>b.at(i);
  ll s=0;
  s+=b.at(0); s+=b.at(n-2);
  for(int i=1; i<n-1; i++) s+=min(b.at(i-1), b.at(i));
  cout << s << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string.h>

typedef long long ll;

using namespace std;

int main()
{
    ll l,r,i,j,mod1,mod2=2019;
    cin >> l >> r;
    if((r-l)/2019>=1)
    {
        cout << 0;
    }else
    {
    for(i=l;i<r;i++)
    {
        for(j=i+1;j<=r;j++)
        {
            mod1 = ((i%2019)*(j%2019))%2019;
            mod2 = min(mod1,mod2);
        }
        if(mod2==0)
        {
            break;
        }
    }
    cout << mod2;
    }
}

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

namespace ConsoleApplication4
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] vals = Console.ReadLine().Split(' ').Select(tmp => int.Parse(tmp)).ToArray();
            int flag = 0;
            for (int i = 0; i < vals[0]+1; i++) {
                if (2 * i + 4 * (vals[0] - i) == vals[1]) {
                    flag = 1;
                }
            }


                if (flag == 1)
                {
                    Console.WriteLine("Yes");
                }
                else
                {
                    Console.WriteLine("No");
                }

        }
    }
}


Measured memory_bytes: 28212
#include<bits/stdc++.h> 
#define ll long long
#define pb push_back
#define mp make_pair
using namespace std;
ll gcd(ll a,ll b) 
{ 
	if (a == 0) 
		return b; 
	return gcd(b % a, a); 
} 
bool isprime(ll n)
{
    for(ll i=2;i<=sqrt(n);i++)
    {
        if(n%i==0)
            return false;
    }
    return true;
}
int main()
{
	ll a,b;
	cin>>a>>b;
	if((a+b)%2!=0)
	{
		cout<<"IMPOSSIBLE";
	}
	else
	{
		ll ans=(a+b)/2;
		cout<<ans;
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
#define rep(i,n) for(int i = 0;i < n;i++)
#define INF 0x3f //plus infinite


int main(){
  string atcoder,s,contest;
  cin >> atcoder;
  cin >> s;
  cin >> contest;
  string ans = "";
  ans += atcoder.at(0);
  ans += s.at(0);
  ans += contest.at(0);
  cout << ans << endl;
}

/*文字列の辞書順について
 *C++の順序では'0'～'9'→'A'～'Z'→'a'～'z'の順に
 *                       なっていることに注意しましょう。
 */

/*行単位での入力
 * getline(cin,文字列変数);
 */


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

#define int long long

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

int N;
int x[100], y[100];

double norm(double d) {
    if (d > M_PI) {
        d -= 2 * M_PI;
    }
    if (d < -M_PI) {
        d += 2 * M_PI;
    }
    return d;
}
double dist(double s, double t) {
    double res = s - t;
    if (res < 0) {
        res += 2 * M_PI;
    }
    return res;
}

bool is_aida(double s, double t, double x) {
    if (s >= t) {
        return s >= x && x >= t;
    } else {
        return (s >= x && t >= x) || (s <= x && t <= x);
    }
}

signed main() {
    cin >> N;
    for (int i = 0; i < N; i++) {
        cin >> x[i] >> y[i];
    }
    double ans[100];
    for (int i = 0; i < N; i++) {
        double start_min = 4, end_min = -4;
        for (int j = 0; j < N; j++) {
            if (i == j) {
                continue;
            }
            double cur = atan2(y[i] - y[j], x[i] - x[j]);
            double s = norm(cur + M_PI / 2);
            double t = norm(cur - M_PI / 2);
            if (!is_aida(start_min, end_min, s) &&
                !is_aida(start_min, end_min, t) && !is_aida(s, t, start_min) &&
                !is_aida(s, t, end_min)) {
                start_min = end_min = 0;
                break;
            }
            if (is_aida(start_min, end_min, s)) {
                start_min = s;
            }
            if (is_aida(start_min, end_min, t) || end_min <= -M_PI - 0.5) {
                end_min = t;
            }
        }
        ans[i] = dist(start_min, end_min);
    }
    for (int i = 0; i < N; i++) {
        cout << ans[i] / (2 * M_PI) << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(void) {
    int n,info[101][101],i,j,m,k,temp,list[100],flag,count;
    while (1) {
        scanf("%d",&n);
        if (n==0) break;
        for (i=1; i<=n; i++) {
            for (j=1; j<=n; j++) info[i][j]=0;
        }
        for (i=1; i<=n; i++) {
            scanf("%d",&m);
            for (j=0; j<m; j++) {
                scanf("%d",&temp);
                info[i][temp]=1;
            }
        }
        scanf("%d",&k);
        for (i=0; i<k; i++) scanf("%d",&list[i]);
        flag=0,count=0;
        for (i=1; i<=n; i++) {
            for (j=0; j<k; j++) {
                if (info[i][list[j]]!=1) break;
            }
            if (j==k) {
                flag=i;
                count++;
            }
            if (count>1) break;
        }
        if (count==1) {
            printf("%d\n",flag);
        } else {
            printf("-1\n");
        }
    }
    return 0;
}

Measured memory_bytes: 652
#include<iostream>
using namespace std;
 
int main(){
  int h=0,a=0,i=0;
  cin>>h>>a;
  if(a==1)cout<<h<<endl;
  else 
    for(i=0;i<=h; i++){
      if(a*i>=h){cout<<i<<endl;break;}
    }
}

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

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

int W,H; bool ok;
char f[64][64],h[64][64];
typedef complex<double> D;

void getblock(int x, int y, vector<D> &p)
{
	h[y][x]='.'; p.push_back(D(x,y));
	for(int i=0; i<4; i++)
	{
		int nx=x+dx[i],ny=y+dy[i];
		if(0<=nx&&nx<W&&0<=ny&&ny<=H)
		if(f[y][x]==h[ny][nx])
		{
			getblock(nx,ny,p);
		}
	}	
}

D dfs(int x, int y)
{
	if(!ok) return D(-1,-1);
	
	D rt,gm(0,0);
	vector<D> pt;
	int left=100,right=-100;

	getblock(x,y,pt);
	for(int i=0; i<pt.size(); i++)
	{

		int nx=pt[i].real();
		int ny=pt[i].imag();
		gm.real() += nx+0.5;
		gm.imag() += 1;

		if(f[ny-1][nx]!='.')
		if(f[ny-1][nx]!=f[ny][nx])
		{
			left =min(left ,nx);
			right=max(right,nx);
		}

		if(ny+1>H) continue;
		if(h[ny+1][nx]=='.') continue;
		rt  = dfs(nx,ny+1);
		gm += rt;
	}
	double cg=gm.real()/gm.imag();
	if(!(left<cg && cg<right+1)) ok=0;

	return gm;
}

int main()
{
	strcpy(f[0],"----------------");
	while(cin >> W >> H, (W||H))
	{
		for(int y=0; y<H; y++)
		{
			cin >> f[H-y];
		}
		memcpy(h,f,sizeof(f));

		ok=1;
		for(int x=0,y=1; x<W; x++)
		{
			if(h[y][x]!='.') dfs(x,y);
		}

		cout << (ok?"":"UN") << "STABLE" << endl;					 	
	}
}

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

int main(){
  vector<int>ans(10005, 0);
  for(int x=1;x<=100;x++){
    for(int y=1;y<=100;y++){
      for(int z=1;z<=100;z++){
        int sum = x*x + y*y + z*z + x*y + y*z + z*x;
        if(sum <= 10000)ans[sum]++;
      }
    }
  }

  int n;cin >> n;

  for(int i=1;i<=n;i++)printf("%d\n", ans[i]);
}

Measured memory_bytes: 3648
#pragma GCC optimize("03")

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define f first
#define s second
#define pb push_back
#define all(v) (v).begin(), (v).end()
#define debug(v) cout << #v << ":\t" << v << endl

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;

const ll N = 10 + 1;

ll n, m, sum;
vector<ll> a;

bool chk(ll x) {
	while (x) {
		if (binary_search(all(a), x % 10)) return true;
		x /= 10;
	}
	return false;
}

int main() {
	ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	
	cin >> n >> m;
	while (m--) {
		ll x; cin >> x;
		a.pb(x);
	}
	sort(all(a));
	
	for ( ; chk(n); ++n);
	cout << n;
	
	return 0;
}


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

int main()
{
	int k, x;
	cin >> k >> x;
	if (500 * k >= x)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
}

Measured memory_bytes: 256
import math
def main():
    N = int(input())
    if N < 5:
        return 0
    if N % 2 == 1:
        return 0
    t = int(math.log(N, 5))
    a = 0
    for i in range(1, t+1):
        a += N // (2 * (5 ** i))
    return a
print(main())


Measured memory_bytes: 3060
//Template
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
#define rep(i,s,n)for(int i = s;i<n;i++)
#define repe(i,s,n)for(int i = s;i<=n;i++)
typedef long long ll;
static const ll MOD = 1e9 + 7;
static const ll INFTY = (ll)1 << 62;

ll a[100001] = {};
ll c[100][100] = {};
int main()
{
	ll h, w, n; cin >> h >> w >> n;
	rep(i, 0, n)cin >> a[i];

	bool r = true;
	ll H = 0, W = 0;
	rep(i, 0, n) {
		rep(j, 0, a[i]) {
			c[H][W] = i + 1;
			if (r) {
				W++;
			}
			else {
				W--;
			}

			if (W >= w) {
				r = false;;
				H++;
				W--;
			}
			else if (W < 0) {
				r = true;
				H++;
				W++;
			}
		}
	}

	rep(i, 0, h) {
		rep(j, 0, w) {
			cout << c[i][j];
			if (j != w - 1)cout << " ";
			else cout << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++) //for文マクロ
#define all(obj) obj.begin(), obj.end()
#define fast                      \
    ios_base::sync_with_stdio(0); \
    cin.tie(0);                   \
    cout.tie(0);

using namespace std;

typedef unsigned long long ull;
typedef int long long ll;
constexpr ll bigNum = 1000000007;

signed main()
{
    fast;
    string str;
    cin >>str;

    string pre = "0";
    int l = 0;
    int  fetch  = 1;
    int leng = str.size()-1;
    string tmp;
    int count = 0;

    while(l <= leng)
    {
        tmp = str.substr(l,fetch);
        if(pre != tmp)
        {
            count++;
            pre = tmp;
            l += fetch ;
            fetch  = 1;
        }
        else if(l == leng)
        {
            break;
        }
        else 
        {
            fetch++;
        }
    }

    cout << count;
}


Measured memory_bytes: 720
n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
count = 0
for i in range(n):
    if b[i] >= a[i] + a[i+1]:
        count += a[i] + a[i+1]
        a[i+1] = 0
    elif b[i] > a[i] and b[i] < a[i] + a[i+1]:
        count += b[i]
        a[i+1] -= b[i] - a[i]
    elif a[i] >= b[i]:
        count += b[i]
print(count)


Measured memory_bytes: 18752
#include <bits/stdc++.h>
using namespace std;
 
int main() {
 int A, B, C, D;
  cin >> A >> B >> C >> D ;
  
  if(A+B<C+D){
    cout << "Right" << endl;
  }
  else if(A+B>C+D){
    cout << "Left" << endl;
  }
  else{
    cout << "Balanced" << endl;
  }
}

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

int main()
{
  string S;
  cin >>S;
  int n=S.length();
  if(S[0]!='A') {cout <<"WA"; return 0;}
  int count=0;
  for(int i=2;i<n-1;i++)
    if(S[i]=='C') count ++;
  if(count !=1) {cout <<"WA"; return 0;}
 count =0;
  for(int i=0;i<n;i++){
  if('a'<=S[i] && S[i]<='z') count++;
}
  if(count !=n-2) {cout <<"WA"; return 0;}
  else{cout <<"AC"; return 0; }
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <queue>
#include <cassert>
using namespace std; typedef long long ll; const int MINF=-1e9; typedef pair<int,int> P;

int main() {
  int n; cin>>n;
  int x[n]; for(int i=0;i<n;i++) cin>>x[i];
  int a[n*n]; fill(a,a+n*n,0);
  for(int i=0;i<n;i++) {
    --x[i];
    if (a[x[i]] != 0) return puts("No")*0;
    a[x[i]]=i+1;
  }

  P p[n];
  for(int i=0;i<n;i++) {
    p[i]={x[i],i}; // i-1個i+1が必要
  }
  sort(p,p+n);
  int j=0;
  for(P y:p) {
    for(int i=0;i<y.second;i++) {
      while(a[j]!=0) {
        j++; if (j>=y.first) return puts("No")*0; // j<n*nも伴う
      }
      a[j]=y.second+1;
    }
  }
  // この時点で、o[i]=i+1（残りn-1-i）
  j=0;
  for(P y:p) {
    for(int i=0;i<n-1-y.second;i++) {
      while(a[j]!=0 || j<y.first) {
        j++; if (j>=n*n) return puts("No")*0; // j<n*nも伴う
      }
      a[j]=y.second+1;
    }
  }

  cout<<"Yes"<<endl;
  for(int i=0;i<n*n;i++) cout<<a[i]<<" ";
  cout<<endl;
}

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

int min(int a, int b){
	return a <= b ? a : b;
}

int main(){
	int D, G, i, j, S, now_solve, now_score, ans = (int)(1e9);
	scanf("%d%d", &D, &G);
	int *p = (int *)malloc(sizeof(int) * D);
	int *c = (int *)malloc(sizeof(int) * D);
	for(i = 0; i < D; i++){
		scanf("%d%d", &p[i], &c[i]);
	}
	for(S = 0; S < (1 << D); S++){
		now_solve = 0;
		now_score = 0;
		for(i = 0; i < D; i++){
			if((S | (1 << i)) == S){
				now_solve += p[i];
				now_score += c[i] + 100 * (i + 1) * p[i];
			}
		}
//		printf("S = %d\n", S);
//		printf("(solve, score) = (%d, %d)\n", now_solve, now_score);
		for(i = D - 1; i >= 0 && now_score < G; i--){
			if((S & (1 << i)) == 0){
				for(j = 0; j < p[i] && now_score < G; j++){
					now_solve++;
					now_score += 100 * (i + 1);
				}
			}
		}
		ans = min(ans, now_solve);
	}
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <cstdlib>
#include <string>
#include <iomanip>
#include <vector>
#include <utility>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <stack>
#include <ctime>
#include <fstream>
#include <stdarg.h>
using namespace std;
const bool debug=false;
const bool INJUDGE=false;
#define FASTERCIN cin.tie(0);ios_base::sync_with_stdio(false)
typedef long long ll;
/*Time:
Status:
Type:
Author:*/
int n;
int a[200005];
void calc(int k){
	ll s=0;
	for(int i=0;i<n;++i)s+=ll(abs(a[i]-k));
	cout<<s<<endl;
}
int main(){
	scanf("%d",&n);
	for(int i=0;i<n;i++)scanf("%d",&a[i]),a[i]-=i+1;
	sort(a,a+n);
	if(n&1){
		calc(a[n/2]);
	}
	else{
		calc((a[n/2]+a[n/2-1])/2);
	}
	return 0;
}


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

int main(){
    int N;cin>>N;
    vector<int> num(N);
    vector<int> res(N);
    for(int i=0;i<N;i++)cin>>num.at(i);
    res.at(0)=0;
    res.at(1)=abs(num.at(1)-num.at(0));
    for(int i=2;i<N;i++){
        int k=res.at(i-1)+abs(num.at(i)-num.at(i-1));
        int j=res.at(i-2)+abs(num.at(i)-num.at(i-2));
        res.at(i)=min(k,j);
    }
    cout<<res.at(N-1)<<endl;
}

Measured memory_bytes: 1024
#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <climits>
#include <ctime>
#include <cassert>
using namespace std;

#define rep(i,a,n) for(int i=a; i<n; i++)
#define repr(i,a,n) for(int i=a; i>=n; i--)
#define pb(a) push_back(a)
#define fr first
#define sc second
#define INF 999999999

#define X real()
#define Y imag()
#define EPS (1e-10)
#define EQ(a,b) (abs((a) - (b)) < EPS)
#define EQV(a,b) ( EQ((a).X, (b).X) && EQ((a).Y, (b).Y) )
#define LE(n, m) ((n) < (m) + EPS)
#define LEQ(n, m) ((n) <= (m) + EPS)
#define GE(n, m) ((n) + EPS > (m))
#define GEQ(n, m) ((n) + EPS >= (m))

typedef vector<int> VI;
typedef vector<VI> MAT;
typedef pair<int, int> pii;
typedef long long int ll;

typedef complex<double> P;
typedef pair<P, P> L;
typedef pair<P, double> C;

int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
int const MOD = 1000000007;

namespace std {
    bool operator<(const P& a, const P& b) {
        return a.X != b.X ? a.X < b.X : a.Y < b.Y;
    }
}

int main() {
    ll a, b, c; cin >> a >> b >> c;
    if(a % 2 == 0 || b % 2 == 0 || c % 2 == 0) cout << 0 << endl;
    else cout << min(a*b, min(b*c, c*a)) << endl;
    return 0;
}

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

# AtCoder Beginner Contest
# Problem B

if __name__ == '__main__':
    five_hundred_yen_count = int(input())
    one_hundred_yen_count = int(input())
    fifty_yen_count = int(input())
    total_yen = int(input())

    pattern_count = 0

    for i in range(five_hundred_yen_count + 1):
        for j in range(one_hundred_yen_count + 1):
            for k in range(fifty_yen_count + 1):
                summed_yen = 500 * i + 100 * j + 50 * k

                if total_yen - summed_yen == 0:
                    pattern_count += 1

    print(pattern_count)


Measured memory_bytes: 3060
import java.util.*

fun main(args: Array<String>) {
    val argList = Scanner(System.`in`)

    val n = argList.nextLine().toInt()
    val a = argList.nextLine().split(" ").map { it.toInt() }

    val e = ResistorsInParallel()
    e.execute(n, a)

}

class ResistorsInParallel {
    fun execute(n: Int, a: List<Int>) {
        val result = a.map {
            1F / it
        }

        var sumR = 0F

        result.forEach {
            sumR += it
        }
        println(1 / sumR)
    }
}

Measured memory_bytes: 35948
import java.util.Scanner;

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

		int N = sc.nextInt();
		int a,b,c,d,e,f,g,h,i,fx ;
		String ans = "No" ;

		a = N % 10 ; //1の位
		b = (N/10) % 10 ; //10の位
		c = (N/100) % 10 ; //100の位
		d = (N/1000) % 10 ; //1000の位
		e = (N/10000) % 10 ; //10000の位
		f =  (N/100000) % 10 ; //100000の位
		g = (N/1000000) % 10 ; //1000000の位
		h = (N/10000000) % 10 ; //10000000の位
		i = (N/100000000) % 10 ; //100000000の位
		fx = a+b+c+d+e+f+g+h+i ;

		if ( N % fx == 0 ) {
			ans = "Yes" ;
		}
		System.out.println(ans);
	}
}


Measured memory_bytes: 23124
#include <iostream>
#include <string>
#include <cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
#include <functional>
using namespace std;

#define rep(i,x) for(ll i=0;i<x;i++)
#define repn(i,x) for(ll i=1;i<=x;i++)

typedef long long ll;
const ll INF = 1e17;
const ll MOD = 998244353;
const ll MAX = 1000001;

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

ll min(ll a, ll b) {
	if (a > b) { return b; }
	return a;
}

ll gcd(ll a, ll b) {
	if (b == 0) { return a; }
	if (a < b) { return gcd(b, a); }
	return gcd(b, a%b);
}

ll lcm(ll a, ll b) {
	return a / gcd(a, b) *b;
}

struct edge {
	ll ind;
	ll fr;
	ll to;
	ll d;
};


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



int main() {
	
	ll N;
	string A, B, C;
	cin >>N>> A >> B >> C;

	ll ans = 0;
	
	rep(i, N) {
		if(A[i]==B[i]&&B[i]==C[i]){}
		else if (A[i] == B[i]) { ans++; }
		else if (C[i] == B[i]) { ans++; }
		else if (A[i] == C[i]) { ans++; }
		else { ans += 2; }
	}
	cout << ans;

	system("PAUSE");
}


Measured memory_bytes: 504
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define MOD 1000000007
#define FAST ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);srand(time(NULL))
ll d, x, y;
void extendedEuclid(ll A, ll B) {
    if(B == 0) {
        d = A;
        x = 1;
        y = 0;
    }
    else {
        extendedEuclid(B, A%B);
        ll temp = x;
        x = y;
        y = temp - (A/B)*y;
    }
}
ll modInverse(ll A)
{
    extendedEuclid(A,MOD);
    return (x%MOD+MOD)%MOD;   
}
int main()
{
     FAST;
    ll n;
    cin >> n;
    string s;
    cin >> s;
    ll a[n+1];
    a[0]=0;
    ll p = 31;
    ll power[n+1],poweri[n+1];
    power[1] = 1;
    poweri[1] = modInverse(1);
    for(ll i=2;i<=n;i++)
    {
         power[i] = (power[i-1] * p) %MOD;
         poweri[i] = modInverse(power[i]);
    }
    for(ll i=1;i<=n;i++)
    {
         a[i] = ((power[i])%MOD*(s[i-1]-'a'+1)%MOD)%MOD;
         if(i!=1)   a[i] = ((a[i])%MOD + (a[i-1])%MOD)%MOD;
    }
    ll low = 0,high = n;
    ll ans=0;
    while(low<=high)
    {
         ll mid = (low+high)/2;
         ll chk = 0;
         for(ll i=1;i<=n-mid+1;i++)
         {
              ll temp = ((a[i+mid-1] - a[i-1]+MOD)%MOD*(poweri[i])%MOD)%MOD;
              for(ll j = i+mid;j<=n-mid+1;j++)
              {
                   ll temp1=((a[j+mid-1]-a[j-1]+MOD)%MOD*(poweri[j])%MOD)%MOD;
                   if(temp1==temp) 
                   {
                       chk = 1;
                       i=INT_MAX;
                       break;
                   }   
              }
         }
         if(chk)   
         {
              ans = mid;
              low = mid+1;
         }
         else
         {
              high = mid-1;
         }
    }
    cout<<ans;
}


Measured memory_bytes: 384
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <string>
#include <cstring>
#include <utility>

#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
#define MEMSET(v, h) memset((v), h, sizeof(v))
typedef long long ll;

using namespace std;

int main(void){
    ll N, val, Minim=1e9, tot=0, isMutable=0;
    cin >>N;
    rep(i, N){
        cin >> val;
        if(val < 0){
            val = -val;
            isMutable++;
        }
        Minim = min(Minim, val);
        tot += val;
        //cout << Minim << endl;
    }
    cout << ((isMutable%2 == 0) ? tot : (tot-2*Minim)) << endl;
    return 0;
}


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

// find_by_order(k)  returns iterator to kth element starting from 0;
// order_of_key(k) returns count of elements strictly smaller than k;

# define ll long long int
#define M 1000000007
#define pb push_back
#define ss second
#define ff first
#define inf 1000000000000000


 

													//nestedcode


bool is_composite[1000005];
ll lp[1000005];
vector<ll> prime;
void sieve (int n) {
	std::fill (is_composite, is_composite + n, false);
	for (int i = 2; i < n; ++i) {
		if (!is_composite[i]) {
			prime.push_back (i);
			lp[i] = i;
		}	for (int j = 0; j < prime.size () && i * prime[j] < n; ++j) {
			is_composite[i * prime[j]] = true;
			lp[i * prime[j]] = prime[j];
			if (i % prime[j] == 0) break;
		}
	}
}

ll vis[200005];
vector<ll> adj[200005];
ll d;
void dfs(ll n){
	
	d++;
	
	vis[n] = 1;
	for(auto x: adj[n]){
		if(vis[x] == 0){
			dfs(x);
		}
	}
}
int main(){
	ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    ll n,m,a,b,i,ans = 0;
    cin>>n>>m;
    map<pair<ll,ll> , ll> map;
    for(i=0;i<m;i++){
    	cin>>a>>b;
    	if(map[{min(a,b),max(a,b)}] == 1){
    		continue;
		}
		map[{min(a,b),max(a,b)}] = 1;
		adj[a].pb(b);
		adj[b].pb(a);
		
	}
	
	for(i=1;i<=n;i++){
		if(vis[i] == 0){
			d = 0;
			dfs(i);
		}
		ans = max(ans,d);
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 34752
import java.io.*;

public class Main {
	public static void main(String[] args) throws IOException{
		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
		String line1 = reader.readLine();
		String[] dice = line1.split(" ", -1);
		int[] diceNum = new int[dice.length];
		for (int i = 0; i < dice.length; i++) {
			diceNum[i] = Integer.parseInt(dice[i]);
		} 
		String line2 = reader.readLine();
		char[] direction = line2.toCharArray();
		
		int rotate = rotation(diceNum,direction);
		System.out.println(rotate);
	}
	
	static int rotation(int[] dice,char[] chr) {
		int temp;
		for (int i = 0; i < chr.length; i++) {
			if (chr[i] == 'W') {
				//1>4 4>6 6>3 3>1
				temp = dice[0];
				dice[0] = dice[2];
				dice[2] = dice[5];
				dice[5] = dice[3];
				dice[3] = temp;
			} else if (chr[i] == 'E') {
				//1>3 3>6 6>4 4>1
				temp = dice[0];
				dice[0] = dice[3];
				dice[3] = dice[5];
				dice[5] = dice[2];
				dice[2] = temp;
			} else if (chr[i] == 'N') {
				//1>5 5>6 6>2 2>1
				temp = dice[0];
				dice[0] = dice[1];
				dice[1] = dice[5];
				dice[5] = dice[4];
				dice[4] = temp;
			} else if (chr[i] == 'S') {
				//1>2 2>6 6>5 5>1
				temp = dice[0];
				dice[0] = dice[4];
				dice[4] = dice[5];
				dice[5] = dice[1];
				dice[1] = temp;
			}
		}
		return dice[0];
	}
}

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

void bubblesort(vi a, int n){
  int cnt=0;
  bool flag=1;
  while(flag){
    flag=0;
    for(int j=n-1; j>0; j--){
      if(a[j]<a[j-1]){
        int x=a[j], y=a[j-1];
        a[j]=y;
        a[j-1]=x;
        flag=1;
        cnt++;
      }
    }
  }
  rep(i, n-1)cout << a[i] << " ";
  cout << a[n-1] << endl << cnt << endl;
}

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

  int n;
  cin >> n;
  vi a(n);
  rep(i ,n)cin >> a[i];

  bubblesort(a, n);

  return 0;
}


Measured memory_bytes: 3192