akhauriyash/Code-Regression huggingface dataset:
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Main{
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] str = new String[3];
		String s;
		int[] result = new int[114514];
		int count=0;
		while((s=br.readLine()) != null){
			str=s.split(",");
			if(check(Double.parseDouble(str[1]), Double.parseDouble(str[2]))){
				System.out.println(str[0]);
				count++;
			}
		}
		if(count==0){
			System.out.println("該当者なし");
		}
	}
	public static boolean check(double kg, double m){
		double bmi = kg/(m*m);
		if(bmi>=25)
			return true;
		else
			return false;
	}
}

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

int main() {
  ll n,k,c[2007][2007];
  ll m = 1e9+7;
  cin >> n >> k;

  rep(i,n+1) c[0][i] =0;
  

  for(int i=0;i<=n;i++){
      c[i][0]=1;
      for(int j=1;j<=i;j++){
          c[i][j] = (c[i-1][j-1] + c[i-1][j]) % m;
      }
  }

  for(int i=1;i<=k;i++) cout << c[n-k+1][i] * c[k-1][i-1] % m << endl;


}

Measured memory_bytes: 31360
X=input()

for i in range(len(X)):
    if X[-7:] == "dreamer":
        X = X[:-7]
    elif X[-6:] == "eraser":
        X = X[:-6]
    elif X[-5:] == "dream":
            X = X[:-5]
    elif X[-5:] == "erase":
        X = X[:-5]

print("YES" if X=="" else "NO")



Measured memory_bytes: 3188
/*------------------------------------
........Bismillahir Rahmanir Rahim....
..........created by Abdul Aziz.......
------------------------------------*/
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <cstring>
#include <unordered_map>
#include <queue>
#define   mod  998244353
#define   int  long long 
#define   ld   long double
#define   pb   push_back
#define   vi  vector<int> 
#define   dbg(x)  cerr << #x << " = " << x << '\n'
#define   sz(x)  (int)x.size()
#define   all(a) (a.begin(),a.end())
#define   ff   first
#define   ss   second
#define   pii  pair<int,int> 
#define   lcm(a,b) (a*b)/__gcd(a,b) 
using namespace std;

inline void solve(){ 
    int n; cin>>n; 
    vector <pii> v(n);
    for (int i=0;i<n;i++) 
    	cin>>v[i].ss>>v[i].ff; 
    bool ok=true; 
    sort(v.begin(), v.end()); 
    int sum=0; 
    for (int i=0;i<n;i++){ 
    	sum += v[i].ss; 
    	if (sum>v[i].ff) ok=false; 
    } 
    if (ok) cout << "Yes" << endl;
    else cout << "No" << endl;
} 

signed main()
{
    int n=1; // cin>>n; 
    while (n--) solve();
    return 0;
}


Measured memory_bytes: 6428
n = int(input())

ans=n
for i in range(n+1):
  c = 0
  t = i
  while t>0:
    c += t%6
    t = t//6

  s = n-i
  while s>0:
    c += s%9
    s = s//9
  ans = min(ans,c)
  
print(ans)

Measured memory_bytes: 3060
//============================================================================
// Name        : AOL.cpp
// Author      : Akari Fujii
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
#include <cctype>
#include <string>
#include<algorithm>

using namespace std;



int main(){


	int n;

	cin>>n;


	cout<<"ABC"<<n<<endl;




}









Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <chrono>
#define _USE_MATH_DEFINES
#include <cmath>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iostream>
#include <iterator>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <utility>
#include <vector>
using namespace std;

#define FOR(i,m,n) for(int i=(m);i<(n);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()

const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-8;
const int MOD = 1000000007; // 998244353;
const int dy[] = {1, 0, -1, 0}, dx[] = {0, -1, 0, 1};
/*-------------------------------------------------*/
int main() {
  cin.tie(0); ios::sync_with_stdio(false);
  // freopen("input.txt", "r", stdin);

  int n, x; cin >> n >> x;
  vector<int> l(n); REP(i, n) cin >> l[i];
  vector<int> d{0};
  REP(i, n) d.emplace_back(d.back() + l[i]);
  int ans = 0;
  for (int e : d) {
    if (e <= x) ++ans;
  }
  cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <algorithm>
#include <vector>
#include <string>
#include <functional>
#include <array>
#include <stack>
#include <queue>
#include <chrono>
#include <numeric>
#include <memory.h>
#include <map>
#include <math.h>
#include <utility>


#pragma warning(disable:4996)
using namespace std;
#define REP(i,n) for(int i = 0 ; i < n ; ++i)
typedef long long Int;
const double PI = 3.141592653589793238;
const Int INF = 999999999999;
typedef pair<int, int> P;


int main()
{
	int n;
	cin >> n;
	REP(i, n){
		double x1, x2, x3, y1, y2, y3;
		cin >> x1>> y1 >> x2 >> y2 >> x3 >> y3;

		double x21 = x2 - x1;
		double x31 = x3 - x1;
		double y21 = y2 - y1;
		double y31 = y3 - y1;
		/*
		double xc = 1.0*((y31*(x21*x21 + y21*y21)) - (y21*(x31*x31 + y31*y31))) /
			(2 * (x21*y31 - y21*x31));

		double yc = 1.0*((x21*(x31*x31 + y31*y31)) - (x31*(x21*x21 + y21*y21))) /
			(2 * (x21*y31 - y21*x31));	
		*/

		double xc = ((y1 - y3)*(y1*y1 - y2*y2 + x1*x1 - x2*x2) - (y1 - y2)*(y1*y1 - y3*y3 + x1*x1 - x3*x3)) / (2 * (y1 - y3)*(x1 - x2) - 2 * (y1 - y2)*(x1 - x3));

		double yc = ((x1 - x3)*(x1 *x1 - x2 *x2 + y1 *y1 - y2 *y2) - (x1 - x2)*(x1*x1  - x3 *x3 + y1 *y1 - y3 *y3) ) / (2*(x1 - x3)*(y1 - y2) - 2*(x1 - x2)*(y1 - y3));

		double d = (xc - x1)*(xc - x1) + (yc - y1)*(yc - y1);
		d = sqrt(d);

		printf("%.3lf %.3lf %.3lf\n", xc, yc, d);
	}
	return 0;
}

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

int main() {
	int n;
	cin >> n;
	int64_t a[n], b[n];
	bool f = true;
	for (int i = 0; i < n; i++) {
		cin >> a[i] >> b[i];
		f &= a[i] == b[i];
	}
	if (f) {
		cout << 0 << endl;
		return 0;
	}
	int64_t c = 1ll << 60;
	bool flag = true;
	for (int i = 0; i < n; i++) {
		if (a[i] > b[i]) {
			c = min(c, b[i]);
			flag = false;
		}
	}
	cout << accumulate(b, b + n, 0ll) - (flag ? 0 : c) << endl;
	return 0;
}

Measured memory_bytes: 512
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import sys

input = sys.stdin.readline

def main():
    _, _, x, y = map(int, input().split())
    X = list(map(int, input().split()))
    Y = list(map(int, input().split()))

    max_x = max(X)
    min_y = min(Y)
    for i in range(x, y + 1):
        if max_x < i and i <= min_y and x < i and i <= y:
            print("No War")
            return
    print("War")

main()


Measured memory_bytes: 3060
n = int(input())
a = []
for _ in range(n):
    ai, bi, ci = list(map(int, input().split()))
    a.append([ai, bi, ci])
    
dp = [[0]*3 for _ in range(n+1)]

for i in range(1, n+1):
    for j in range(3):
        dp[i][j] = max(dp[i-1][(j+1)%3]+a[i-1][j], dp[i-1][(j+2)%3]+a[i-1][j])

print(max(dp[n]))

Measured memory_bytes: 42884
#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>;

int main() {
  int n, k;
  cin >> n >> k;
  vector<int> A(109);
  vector<int> ans(109);
  rep(i,k) {
    int d;
    cin >> d;
    A = vector<int>(109, 0);
    rep(j,d) {
      cin >> A.at(j);
      ans.at(A.at(j) - 1) = 1;
    }
  }
  int cnt = 0;
  rep(i,n) {
    if (ans.at(i) == 0) cnt++;
  }
  cout << cnt << endl;
}

Measured memory_bytes: 3628
//                     بِسْمِ ٱللَّٰهِ ٱلرَّحْمَٰنِ ٱلرَّحِيمِ
//                   لآ اِلَهَ اِلّا اللّهُ مُحَمَّدٌ رَسُوُل اللّهِ

//                                আমি একজন বাংলাদেশী
#include <bits/stdc++.h>

using namespace std;

int main()
{
    string x;
    cin >> x;
    if(x[0] == 'R' && x[1] == 'R' && x[2] == 'R') cout << 3 << endl;
    else if((x[0] == 'R' && x[1] == 'R') || (x[1] == 'R' && x[2] == 'R')) cout << 2 << endl;
    else if(x[0] == 'S' && x[1] == 'S' && x[2] == 'S')cout << 0 << endl;
    else cout << 1 << endl;

















    return 0;
}


Measured memory_bytes: 3588
#include <iostream>
using namespace std;
int main(){
  int N;cin>>N;
  int a[N];
  int syuryo = 0;
  for(int i = 0; N > i; i++)cin >> a[i];
  int nobi = a[0];
  for(int i = 0; N > i; i++){
    if(nobi > a[i]){
      syuryo += nobi - a[i];
    }
    nobi = a[i];
  }
  cout << nobi+syuryo << endl;
}

Measured memory_bytes: 256
#include<cstdio>
int main()
{
	int i, n, a, b;
	scanf("%d", &n);
	for(i = 1; i <= n; i++)
	{
		a = i * i;
        b = (i + 1)*(i + 1);
        if(a <= n  &&  n < b)
        	break;
		}
		printf("%d\n", a);
	}

Measured memory_bytes: 128
N = int(input())
count = 0
counter = []

for i in range(1, N+1):
    num = i
    while num % 2 == 0:
        count += 1
        num /= 2
    counter.append([count, i])
    count = 0

counter.sort()
counter.reverse()

print(counter[0][1])


Measured memory_bytes: 3060
# coding: utf-8


def main():
    d = int(input())

    if d == 25:
        print('Christmas')
    elif d == 24:
        print('Christmas Eve')
    elif d == 23:
        print('Christmas Eve Eve')
    elif d == 22:
        print('Christmas Eve Eve Eve')


if __name__ == '__main__':
    main()


Measured memory_bytes: 2940
import java.util.Scanner;
import java.math.*;
import java.text.*;
public class Main {

	public static void main(String[] args) {
		Scanner input = new Scanner(System.in);
		while(input.hasNextInt()){
			int n = input.nextInt();
			int ans = 0;
			for(int a=0; a<10; a++)
				for(int b=0; b<10; b++)
					for(int c=0; c<10; c++)
						for(int d=0; d<10; d++)
							if(a+b+c+d==n) ans++;
			System.out.println(ans);
		}
	}

}

Measured memory_bytes: 12000
#include <iostream>
#include <string>
using namespace std;
int main(){
string a;
int n;
int b;//上面
int c;//前面
int d;//右面
int e;
int f;
int g;
while(cin>>n){
if(n!=0){
b=1;
c=2;
d=3;
e=0;
g=1;
while(e<n){
cin>>a;
if(a=="North"){f=c; c=7-b; b=f;}
if(a=="East"){f=b; b=7-d; d=f;}
if(a=="West"){f=d; d=7-b; b=f;}
if(a=="South"){f=b; b=7-c; c=f;}
if(a=="Right"){f=d; d=7-c; c=f;}
if(a=="Left"){f=c; c=7-d; d=f;}
g=g+b;
e=e+1;}
cout << g<<endl;
}
}
}

Measured memory_bytes: 1204
n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = list(map(int,input().split()))

total = 0
total += b[a[0]-1]

for i in range(1,n):
    total += b[a[i]-1]
    if a[i-1] + 1 == a[i]:
        total += c[a[i-1]-1]

print(total)


Measured memory_bytes: 3064
import numpy as np
N, M = map(int, input().split(' '))

height = np.array(list(map(int, input().split(' '))))
height_all = np.array(list(height))

for i in range(M):
  a, b = map(int, input().split(' '))
  #print(a, b, height[a - 1], height[b - 1])
  if height[a - 1] > height[b - 1]:
    height_all[b - 1] = 0
  
  elif height[a - 1] == height[b - 1]:
    height_all[a - 1] = 0
    height_all[b - 1] = 0
    
  else:
    height_all[a - 1] = 0
    
  #print(height_all)
  
print(len(np.nonzero(height_all)[0]))

Measured memory_bytes: 38600
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <utility>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <cmath>
#include <queue>
using namespace std;
typedef long long ll;
const int INF = 1<<30; 
const int MOD = 1e9 + 7;
const int dy[] = {1, 0, -1, 0};
const int dx[] = {0, 1, 0, -1};
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, q;
    cin >> n >> q;
    priority_queue<int> que[n];
    for(int i = 0; i < q; i++)
    {
        int v, t, x;
        cin >> v >> t;
        if(v == 0)
        {
            cin >> x;
            que[t].push(x);
        }
        else if(v == 1)
        {
            if(que[t].size() != 0) cout << que[t].top() << endl;
        }
        else if(v == 2)
        {
            if(que[t].size() != 0) que[t].pop();
        }
    }
    return 0;
}





Measured memory_bytes: 4128
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>

#include <algorithm>
#include <bitset>
#include <complex>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>

#include <cassert>
#include <functional>

typedef long long ll;
using namespace std;

#ifndef LOCAL
#define debug(...) ;
#else
#define debug(...) cerr << __LINE__ << " : " << #__VA_ARGS__ << " = " << _tostr(__VA_ARGS__) << endl;

template<typename T>
ostream &operator<<(ostream &out, const vector<T> &v);

template<typename T1, typename T2>
ostream &operator<<(ostream &out, const pair<T1, T2> &p) {
  out << "{" << p.first << ", " << p.second << "}";
  return out;
}

template<typename T>
ostream &operator<<(ostream &out, const vector<T> &v) {
  out << '{';
  for (const T &item : v) out << item << ", ";
  out << "\b\b}";
  return out;
}

void _tostr_rec(ostringstream &oss) {
  oss << "\b\b \b";
}

template<typename Head, typename... Tail>
void _tostr_rec(ostringstream &oss, Head &&head, Tail &&... tail) {
  oss << head << ", ";
  _tostr_rec(oss, forward<Tail>(tail)...);
}

template<typename... T>
string _tostr(T &&... args) {
  ostringstream oss;
  int size = sizeof...(args);
  if (size > 1) oss << "{";
  _tostr_rec(oss, forward<T>(args)...);
  if (size > 1) oss << "}";
  return oss.str();
}
#endif

#define mod 1000000007 //1e9+7(prime number)
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 200010

// GCC __gcd(long long A, long long B)

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

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

int main() {
  int N, A[SIZE];
  int L[SIZE], R[SIZE];

  cin >> N;

  for (int i = 0; i < N; i++) cin >> A[i];

  L[1] = A[0];
  for (int i = 1; i < N; i++) {
    L[i + 1] = gcd(L[i], A[i]);
  }

  R[N - 2] = A[N - 1];
  for (int i = N - 2; i > 0; i--) {
    R[i - 1] = gcd(R[i], A[i]);
  }

  int ans = max(R[0], L[N]);

  for (int i = 0; i <= N; i++) {
    debug(L[i], R[i]);
    ans = max(ans, (int)gcd(L[i], R[i]));
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 4772
/*
author : seryu
title : ABC168D_"Double Dots"
*/
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < n; i++)
#define reps(i,n) for(int i = 1; i <= n; i++)
#define mrep(i,j,n) for(int i = j; i < n; i++)
#define mreps(i,j,n) for(int i = j; i <= n; i++)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define ERASE(x,val) x.erase(remove(all(x), val), x.end())
typedef long long ll;
typedef pair<int, int> P;
template<class T>inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; }return false; }
template<class T>inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; }return false; }
ll MOD = 1000000007;
int INF = 1001001001;

int n, m;
vector<int> ans;
vector<vector<int>> graph;

void solve()
{
	cin >> n >> m;
	ans.resize(n);
	rep(i, n)ans[i] = -1;
	graph.resize(n);
	rep(i, m)
	{
		int a, b;
		cin >> a >> b;
		a--;b--;
		graph[a].push_back(b);
		graph[b].push_back(a);
	}
	queue<int> que;
	que.push(0);
	ans[0] = 0;
	while (que.size())
	{
		int s = que.front();que.pop();
		for(auto e : graph[s])
		{
			if(ans[e] >= 0)continue;
			que.push(e);
			ans[e] = s;
		}
	}
	cout << "Yes" << endl;
	reps(i, n-1)cout << ans[i]+1 << endl;
	return;	
}

int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	solve();
	return 0;
}


Measured memory_bytes: 10180
#!/usr/bin/env python3
(n,), *d = [list(map(int, c.split())) for c in open(0)]
n -= 1
for i in range(n):
    t = 0
    for j in range(i, n):
        c, s, f = d[j]
        t = (s if t < s else t if t % f == 0 else t + f - t%f) + c
    print(t)
print(0)

Measured memory_bytes: 3188
#include <bits/stdc++.h>
using namespace std;
int main(){
  long long ans=1;
  string s;
  cin >> s;
  vector<int> vec[26];
  map<char, int> mp;
  for(int i=0;i<s.size();i++){
    vec[s[i]-'a'].push_back(i);
    mp[s[i]]++;
  }
  for(int i=0;i<26;i++){
    if(vec[i].size()==0) continue;
    for(size_t j=0;j<vec[i].size();j++){
      ans+=s.size()-vec[i][j]-mp[i+'a'];
      mp[i+'a']--;
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 1908
"""
author : halo2halo
date : 31, Jan, 2020
"""

import sys
import itertools

# import numpy as np

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

S = readline().decode('utf8')
f0 = S[::2].count('1') + S[1::2].count('0')
f1 = S[::2].count('0') + S[1::2].count('1')

print(min(f1, f0))


Measured memory_bytes: 3188
// 2013/10/22 Tazoe

#include <iostream>
using namespace std;

char F[102][102];

void DFS(int Y, int X, char C)
{
	if(F[Y][X]!=C)
		return;

	F[Y][X] = 0;

	DFS(Y-1, X, C);
	DFS(Y, X+1, C);
	DFS(Y+1, X, C);
	DFS(Y, X-1, C);
}

int main()
{
	while(true){
		int H, W;
		cin >> H >> W;

		if(H==0 && W==0)
			break;

		for(int y=0; y<=H+1; y++){
			for(int x=0; x<=W+1; x++){
				F[y][x] = 0;
			}
		}

		for(int y=1; y<=H; y++){
			for(int x=1; x<=W; x++){
				cin >> F[y][x];
			}
		}

		int cnt = 0;
		for(int y=1; y<=H; y++){
			for(int x=1; x<=W; x++){
				if(F[y][x]!=0){
					cnt++;
					DFS(y, x, F[y][x]);
				}
			}
		}

		cout << cnt << endl;
	}

	return 0;
}

Measured memory_bytes: 1472
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define vll vector<ll>
#define mll map<ll,ll>
#define test ll t;cin>>t;while(t--)
#define rep(i,k,n) for(ll i=k;i<n;i++)
#define MOD 998244353
#define fast  ios_base::sync_with_stdio(false);  cin.tie(NULL);
#define pb push_back
#define mod 1000000007
#define MAX 100000
ll inv_euclid(ll a, ll m = MOD) {ll m0 = m; ll y = 0, x = 1; if (m == 1)return 0; while (a > 1) {ll q = a / m; ll t = m; m = a % m, a = t; t = y; y = x - q * y; x = t;} if (x < 0)x += m0; return x;}
ll power(ll x, ll y, ll p)  { ll res = 1; x = x % p; if (x == 0) return 0; while (y > 0) { if (y & 1) res = (res * x) % p; y = y >> 1; x = (x * x) % p;} return res;}
ll max(ll a, ll b) {if (a > b)return a; return b;}
ll min(ll a, ll b) {if (a < b)return a; return b;}
ll ssum(ll n) {return (n * (n + 1)) / 2;}
ll gcd(ll a, ll b) {if (b == 0)return a; return gcd(b, a % b);}


void mult(ll a[][2] , ll b[][2]) {
	ll c[2][2];
	rep(i, 0, 2) {
		rep(j, 0, 2) {
			c[i][j] = 0;
			rep(k, 0, 2)
			c[i][j] = (c[i][j] % mod + ( a[i][k] * b[k][j]) % mod) % mod;
		}
	}
	rep(i, 0, 2)
	rep(j, 0, 2)
	a[i][j] = c[i][j];
}

ll fib(ll n, ll a, ll b) {
	ll I[2][2] = {{1, 0}, {0, 1}};
	ll A[2][2] = {{0, 0}, {1, (b / a)}};
	while (n) {
		if (n % 2)
			mult(I, A);
		mult(A, A);
		n /= 2;
	}
	return a * I[0][0] + b * I[1][0];
}



ll k[110][100100];
ll w[100010], v[1000010];
ll kp(ll n, ll s) {
	if (s == 0 || n == 0)
		return 0;
	if (k[n][s] != -1)
		return k[n][s];

	if (s < w[n - 1])
		return k[n][s] = kp(n - 1, s);
	else
		return k[n][s] = max(kp(n - 1, s), v[n - 1] + kp(n - 1, s - w[n - 1]));
}






int main() {


	ll n, s;
	cin >> n >> s;
	rep(i, 0, n)
	cin >> w[i] >> v[i];

	rep(i, 0, 108) {
		rep(j, 0, 100033)
		k[i][j] = -1;
	}
	cout << kp(n, s);
}







Measured memory_bytes: 88320
W, H, x, y = map(int, input().split())
bigarea = W * H

j = (bigarea/2.000000)

# print('{:6f}'.format(bigarea/2))

if W /2 == x and H / 2 == y:
    k = '1'
else:
    k = '0'

# print(j, k)
# j = str(j)
print('{:6f} {:}'.format(j,k))

Measured memory_bytes: 2940
x = int(input())

memo = [0]
i = 1
while(pow(i, 5) < 10**18):
  memo.append(pow(i, 5))
  i+=1
  
  
for i in range(len(memo)):
  for j in range(len(memo)):
    if memo[i]-memo[j] == x:
      print(i, j)
      exit()
    if memo[i]+memo[j]  == x:
      print(i, -j)
      exit()
  


Measured memory_bytes: 9352
num = str(input())
list_num = list(num)
list_num = [int(s) for s in list_num]

#print(list_num)

count_0 = 0
count_1 = 0

def _return_next_val(cur_num):
  if cur_num == 0:
    return 1
  else:
    return 0

check_num = 0

## 0101010101....にする場合のカウント
for i in range(len(list_num)):
  if list_num[i] != check_num:
    count_0 += 1
  check_num=_return_next_val(check_num) 

check_num = 1
## 101010101....にする場合のカウント
for i in range(len(list_num)):
  if list_num[i] != check_num:
    count_1 += 1
  check_num=_return_next_val(check_num) 

if count_0 < count_1:
  print(count_0)
else:
  print(count_1)
  


Measured memory_bytes: 4852
import java.util.Scanner;

public class Main {

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

        int[] number = new int[3];

        int judgement5 = 0;
        int judgement7 = 0;

        for (int i = 0; i < number.length; i++) {
            number[i] = sc.nextInt();
        }

        for (int i : number) {
            if (i == 5) {
                judgement5++;
            } else if (i == 7) {
                judgement7++;
            }
        }

        if (judgement5 == 2 && judgement7 == 1) {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }
    }
}


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

int h[100005], dp[100005];

int main() {
	int n;
	scanf("%d", &n);
	for (int i = 0; i < n; i++) {
		scanf("%d", &h[i]);
	}
	dp[1] = abs(h[0] - h[1]);
	for (int i = 2; i < n; i++) {
		dp[i] = min(abs(h[i] - h[i - 1]) + dp[i - 1], abs(h[i] - h[i - 2]) + dp[i - 2]);
	}
	printf("%d", dp[n - 1]);
}

Measured memory_bytes: 1024
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AOJ
{
	class Program
	{
		static void Main(string[] args)
		{
			var N = int.Parse(Console.ReadLine());
			while (N-- != 0)
			{
				var n1 = Console.ReadLine();
				var n2 = Console.ReadLine();
				var r = f(n1, n2);
				Console.WriteLine(r.Length > 80 ? "overflow" : r);
			}
		}

		static string f(string n1, string n2)
		{
			var r = new List<int>();
			int f = 0;
			for (int i = 0; i < 82; i++)
			{
				if (i >= n1.Length && i >= n2.Length && f != 1) break;
				int c = f;
				f = 0;
				if (i < n1.Length) c += n1[n1.Length - i - 1] - '0';
				if (i < n2.Length) c += n2[n2.Length - i - 1] - '0';
				if (c > 9) f = 1;
				r.Add(c % 10);
			}
			r.Reverse();
			return new string(r.Select(i => (char)('0' + i)).ToArray());
		}
	}
}

Measured memory_bytes: 5708
#include <iostream>
#include <algorithm>
#include <functional>
#include <math.h>
using namespace std;
int main(){
  int h,w;
  while(1){
    cin>>h>>w;
    if(h==0&&w==0)break;
    for(int i=0;i<w;i++)cout<<'#';
    cout<<'\n';
    for(int i=0;i<h-2;i++){
      cout<<'#';
      for(int j=1;j<w;j++){
	if(j==w-1)cout<<'#';
	else cout<<'.';
      }
      cout<<'\n';
    }
    for(int i=0;i<w;i++)cout<<'#';
    cout<<'\n';
    cout<<'\n';
  }   
  return 0;
}



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

int main(){
	while(1){
		int a, b;
		scanf("%d %d", &a, &b);
		if(a==0 && b==0) break;
		int n;
		scanf("%d", &n);
		int c[n][2];
		for(int i=0; i<n; i++){
			scanf("%d %d", &c[i][0], &c[i][1]);
		}
		int map[a][b];
		for(int i=0; i<a; i++){
			for(int j=0; j<b; j++){
				map[i][j] = 0;
			}
		}
		bool f = false;
		for(int i=0; i<a; i++){
			for(int j=0; j<n; j++){
				if(c[j][0]-1 == i && c[j][1]-1 == 0) f = true;
			}
			if(f){
				break;
			}else{
				map[i][0] = 1;
			}
		}
		f = false;
		for(int i=0; i<b; i++){
			bool f = false;
			for(int j=0; j<n; j++){
				if(c[j][0]-1 == 0 && c[j][1]-1 == i) f = true;
			}
			if(f){
				break;
			}else{
				map[0][i] = 1;
			}
		}
		for(int i=0; i<a; i++){
			for(int j=0; j<b; j++){
				if(i!=0 && j!=0){
					f = false;
					for(int k=0; k<n; k++){
						if(c[k][0]-1 == i && c[k][1]-1 == j) f = true;
					}
					if(f){
						map[i][j] = 0;
					}else{
						map[i][j] = map[i-1][j] + map[i][j-1];
					}
				}
//			printf("%d %d %d\n", i, j, map[i][j]);
			}
		}
		printf("%d\n", map[a-1][b-1]);
	}

	return 0;
}

Measured memory_bytes: 1028
#include <stdio.h>
#include <stdint.h>

int get_group_num(const uint32_t a) {
    if (a == 2) return 0;
    if (a == 4 || a == 6 || a == 9 || a == 11) return 1;
    return 2;
}

int main(void) {
    uint32_t x, y;
    scanf("%d %d", &x, &y);
    if (get_group_num(x) == get_group_num(y)) {
        printf("Yes\n");
    } else {
        printf("No\n");
    }
    return 0;
}



Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
const ull B = 1000000007ULL;

int main(){
  int N; // N is the size of string s
  string s,P;
  cin >> s >> P;
  N=s.size();
  vector<ull> p(N+1); // p is power (base B)
  vector<ull> hash(N+1); // hash values
  p[0] = 1; hash[0] = 0;
  for (int i = 0; i < N; i++) {
    hash[i+1] = hash[i]*B + s[i];
    p[i+1] = p[i]*B;
  }
  /*
    s?????¨????????????s[L,R]??????????????\????????\?????????????????????.
    hash[L,R] := hash[R+1]-hash[L]*p[R-L+1];
  */
  ull base=0,ans=0;
  for(int i=0;i<P.size();i++){
    base=base*B+P[i];
  }
  for(int i=0;i+P.size()<=N;i++){
    int L=i,R=i+P.size()-1;
    if(hash[R+1]-hash[L]*p[R-L+1]==base) printf("%d\n",i);//cout<<i<<endl;
  }
  return 0;
}



Measured memory_bytes: 19828
#include <stdio.h>
#define MAX_H 101
#define MAX_W 101
#define JUDGE(nx,ny) (nx < h && ny <w && nx>=0 && ny >=0)

char farm[MAX_W][MAX_H];
int area;
int w,h;
int dx[4] = {1,-1,0,0};
int dy[4] = {0,0,1,-1};


void dfs(char ch,int x,int y);

int main()
{
    while(1)
    {
        area=0;
        scanf("%d%d",&h,&w);
        if(!w && !h)
            break;
        gets(farm[100]);
        int i,j;
        for(i=0;i<h;i++)
            gets(farm[i]);
        for(i=0;i<h;i++)
            for(j=0;j<w;j++)
                if(farm[i][j]!='x')
                {
                    area++;
                    dfs(farm[i][j],i,j);
                }
        printf("%d\n",area);
    }

    return 0;
}


void dfs(char ch,int x,int y)
{
    farm[x][y] = 'x';
    int i;
    int nx,ny;
    for(i=0;i<4;i++)
    {
        nx = x + dx[i];
        ny = y + dy[i];
        if(JUDGE(nx,ny) && farm[nx][ny]==ch)
        {
            dfs(ch,nx,ny);
        }
    }
}

Measured memory_bytes: 1076
#include<iostream>
#include<string>
#include<cmath>
#include<set>
using namespace std;
int main()
{
  int n,k,d[11],ans;
  cin>>n>>k;
  for(int i=0;i<k;i++)
    cin>>d[i];
  ans=n;
  while(1){
    int c=ans;
    bool f=true;
    do{
      int a=c%10;
      c/=10;
      for(int i=0;i<k;i++)
        if(a==d[i]){
          f=false;
          break;
        }
      if(!f)
        break;
    }while(c>0);
    if(f)
      break;
    ans++;
  }
  cout<<ans;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <string>
#include <map>
#include <numeric>
#include <bitset>
#include <vector>
#include <queue>

using namespace std;

typedef long long ll;
#define FOR(i,a,b)   for(ll i = (a); i < (b); i++ )
#define REP(i, n)    FOR(i,0,n)
typedef pair< ll, ll >   cp2;
typedef pair< ll, cp2 >   cp3;
#define fi first
#define se second
#define sec  se.fi
#define thr  se.se
const ll mod = 1000000007;
//              123456789

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

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

ll N, X, Y;
ll S;
bool f[100];
string ans;

int main(){
	
	while( 1 ){
		cin>>N>>Y>>X;
		if( !( X | Y | N ) ) break;
		ans = "";
		ll i = N;
		S = 1ll<<N;
		while( i-- ){
			//cout<<"-"<<Y<<endl;
			if( Y <= S/2 ){
				f[i] = true;
				Y = S/2-Y+1;
			}
			else{
				f[i] = false;
				Y = Y - S/2;
			}
			S>>=1;
		}
		S = 1ll<<N;
	
		REP( i, N ){
			//cout<<"*"<<X<<endl;
			if( X <= S/2 ){//左半分にあったら
				if( f[i] ){
					ans += "L";
					X = S/2 - X + 1;
				}
				else{
				ans += "R";
				}
			}
			else{//右半分にあったら
				if( f[i] ){
					ans += "R";
					X = S - X + 1;
				}
				else{
					ans += "L";
					X = X - S/2;
				}
			}
		S>>=1;
		}
		cout<<ans<<endl;
	}
			

	return 0;

}


Measured memory_bytes: 3164
import sys
input = sys.stdin.readline
from collections import deque
N = int(input())
lis = [[] for i in range(N)]
for i in range(N-1):
    a,b,w = map(int,input().split())
    lis[a-1].append((b-1,w%2))#移動先、偶奇の順
    lis[b-1].append((a-1,w%2))

flg = [True] * N
ans = [-1] * N
que = deque([ (0,0) ])
#flg[0] = False
ans[0] = 0
flg[0] = False
while len(que) != 0:
    p = que.popleft()
    #print(p)
    for i in lis[p[0]]:
        if flg[i[0]] == True:
            que.append(i)
            flg[i[0]] = False
            if i[1] == 0:
                ans[i[0]] = ans[p[0]]
            else:
                if ans[p[0]] == 1:
                    ans[i[0]] = 0
                else:
                    ans[i[0]] = 1
for i in ans:
    print(i)


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

public static class Program
{
    public static void Main(string[] args)
    {
        var n = int.Parse(Console.ReadLine());
        var ds = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
        var comb = ds.Comb(2);
        Console.WriteLine(comb.Select(x => x.ToArray()).Select(y => y[0] * y[1]).Sum());
    }

    public static IEnumerable<T> Before<T>(this IEnumerable<T> items, T first)
    {
        yield return first;
        foreach (var i in items)
        {
            yield return i;
        }
    }

    public static IEnumerable<IEnumerable<T>> Comb<T>(this IEnumerable<T> items, int r)
    {
        if (r == 0)
        {
            yield return Enumerable.Empty<T>();
        }
        else
        {
            var i = 1;
            foreach (var x in items)
            {
                var xs = items.Skip(i);
                foreach (var c in Comb(xs, r - 1))
                {
                    yield return c.Before(x);
                }
                i++;
            }
        }
    }
}

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

using namespace std;

const int MX = 1000;

char s[MX][MX + 1];

int main() {
	int n, m;
	ignore = scanf("%d %d", &n, &m);
	for (int i = 0; i < n; i++) ignore = scanf("%s", s[i]);
	
	vector<tuple<int, int, int>> queue;
	for (int i = 0; i < n; i++)
		for (int j = 0; j < m; j++)
			if (s[i][j] == '#')
				queue.emplace_back(i, j, 0);
	
	for (size_t i = 0; i < queue.size(); i++) {
		int x, y, d;
		tie(x, y, d) = queue[i];
		
		if (x > 0 && s[x - 1][y] == '.') {
			s[x - 1][y] = '#';
			queue.emplace_back(x - 1, y, d + 1);
		}
		
		if (x + 1 < n && s[x + 1][y] == '.') {
			s[x + 1][y] = '#';
			queue.emplace_back(x + 1, y, d + 1);
		}
		
		if (y + 1 < m && s[x][y + 1] == '.') {
			s[x][y + 1] = '#';
			queue.emplace_back(x, y + 1, d + 1);
		}
		
		if (y > 0 && s[x][y - 1] == '.') {
			s[x][y - 1] = '#';
			queue.emplace_back(x, y - 1, d + 1);
		}
	}
	
	printf("%d\n", get<2>(queue.back()));
	
	return 0;
}


Measured memory_bytes: 15976
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ld long double
#define al(a) (a).begin(),(a).end()
#define mk make_pair
#define check cout<<"?"<<endl;

ll MOD=1000000007;
ll mod=998244353;
int inf=1000001000;
ll INF=1e18+5;

int main(){
    ll n,m,k,ans=0; cin>>n>>m>>k;
    vector<ll> a(n,0),b(m,0),suma(n+1,0),sumb(m+2,0);
    sumb.back()=INF;
    rep(i,n){
        cin>>a[i];
        suma[i+1]=suma[i]+a[i];
    }
    rep(i,m){
        cin>>b[i];
        sumb[i+1]=sumb[i]+b[i];
    }
    rep(i,n+1){
        ll cnt=i,cur=suma[i];
        ll l=0,r=m+1,c;
        if(cur>k) continue;
        while(l!=r){
            c=(l+r+1)/2;
            if(sumb[c]<=k-cur) l=c;
            else r=c-1;
        }
        cnt+=l;
        ans=max(ans,cnt);
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 9568
#include "bits/stdc++.h"
#define REP(i, n) for(int i = 0; i < int(n); i++)
#define FOR(i,n,m) for(int i = int(n); i < int(m); i++)
using namespace std;
typedef long long ll;
const int MOD = 1e9 + 7;
const int INF = 1e9 + 6;
const ll LLINF = 1e18 + 1;

int main() {
    vector<int> cnt(26, -1);
    string s,t; cin >> s >> t;
    REP(i, s.size()) {
        if (cnt[s[i] - 'a'] == -1) {
            cnt[s[i] - 'a'] = i;
        }
    }
    REP(i, s.size()) {
        if (t[i] != t[cnt[s[i] - 'a']]) {
            puts("No");
            return 0;
        }
    }
    vector<int> cnt2(26, -1);
    REP(i, s.size()) {
        if (cnt2[t[i] - 'a'] == -1) {
            cnt2[t[i] - 'a'] = i;
        }
    }
    REP(i, s.size()) {
        if (s[i] != s[cnt2[t[i] - 'a']]) {
            puts("No");
            return 0;
        }
    }
    puts("Yes");
    return 0;
}

Measured memory_bytes: 776
n=list(input())

for i in range(8):
    v=['+']*3
    for j in range(3):
        if (i>>j) & 1 ==1:
            v[j]='-'

    w=n[0]
    for k in range(3):
        w+=(v[k]+n[k+1])


    if eval(w)==7:
        print(w+'=7')
        exit()

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
typedef long long       ll;
typedef pair<int,int>   ii;
typedef vector<int>     vi;
typedef vector<ii>      vii;
typedef set<int>        si;
typedef set<ii>         sii;

#define sz(x) (int)x.size()
#define all(x) x.begin(),x.end()
#define clr(x,v) memset(x,v,sizeof x)
#define forn(i,a,b) for(int i=a;i<b;i++)
#define re return

template<typename T> T sgn (T x)      {re x<0? -1:(x>0? 1:0); }
template<typename T> T gcd (T a, T b) {re a ? gcd (b % a, a) : b; }
template<typename T> T abs (T x)      {re x < 0 ? -x : x; }
template<typename T> T sqr (T x)      {re x*x;}

#define _ ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define popcount __builtin_popcount
#define mp make_pair
#define pb push_back
#define ins insert
#define sc second
#define fr first
#define endl "\n"
#define MOD ((int)1e9+7)
#define N ((int)2e5+123)5

ll a, b, n,ans;
ll f(ll x){
    re ((a*x)/b)-a*((x)/b);
}

void solve(){
    cin >> a >> b >> n;
    ans=f(min(n,b-1));
    cout << ans<<endl;
    //cout << bt(0,n)<<endl;
    //forn(i,0,n+1)cout<<i << " "<<f(i)<<endl;
}
int main(){_
    solve();
    /*
    int t; cin >> t;
    while(t--){
        solve();
    }
     */
}

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

#define REP(i, s,  n) for(int i = s;i < (n);i++)
#define VSORT(v) sort(v.begin(), v.end());
#define int64 long long
#define pb(a) push_back(a)
#define REP64(i, s,  n) for(int64 i = s;i < (n);i++)
#define INF 999999999
#define MOD 1000000007
using namespace std;

typedef pair<int, int> P;
typedef pair<int, P> PP;

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

//---------------------------------------------------------------
//---------------------------------------------------------------

int N;

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

	cin >> N;
	bool first = false;
	int a;
	REP(i, 0, N) {
		cin >> a;
		if(a % 2 == 1)	first = true;
	}
	if(first)	cout << "first" << endl;
	else 		cout << "second" << endl;
	
	return 0;
}


Measured memory_bytes: 256
"""
at-abc164c.py
2020-05-06
/usr/bin/python3
Info Fields (opt.)
- Type: 
- Keywords:
- Notes:
"""
if __name__ == "__main__":
    fruits = set()
    n=int(input())
    for i in range(n):
        fruits.add(input())
    print(len(fruits))


Measured memory_bytes: 30960
#include"bits/stdc++.h"

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, n) for (int i = 1; i <= (int)(n); i++)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
using namespace std;
using ll = long long;
using pi = pair<int, int>;
const ll INF = 1LL << 60;

int main() {
	string s;
	cin >> s;
	s.replace(s.begin(), s.begin() + 4, "2018");
	cout << s << endl;
	return 0;
}



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

#define rep(i, n) for (int i = 0; i < int(n); i++)
#define rrep(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define reps(i, n) for (int i = 1; i <= int(n); i++)
#define rreps(i, n) for (int i = int(n); i >= 1; i--)
#define repc(i, n) for (int i = 0; i <= int(n); i++)
#define rrepc(i, n) for (int i = int(n); i >= 0; i--)
#define repi(i, a, b) for (int i = int(a); i < int(b); i++)
#define repic(i, a, b) for (int i = int(a); i <= int(b); i++)
#define each(x, y) for (auto &x : y)
#define all(a) (a).begin(), (a).end()
#define bit(b) (1ll << (b))

using namespace std;

using i32 = int;
using i64 = long long;
using u64 = unsigned long long;
using f80 = long double;
using vi32 = vector<i32>;
using vi64 = vector<i64>;
using vu64 = vector<u64>;
using vf80 = vector<f80>;
using vstr = vector<string>;

inline void yes() { cout << "Yes" << '\n'; exit(0); }
inline void no() { cout << "No" << '\n'; exit(0); }
inline i64 gcd(i64 a, i64 b) { if (min(a, b) == 0) return max(a, b); if (a % b == 0) return b; return gcd(b, a % b); }
inline i64 lcm(i64 a, i64 b) { return a / gcd(a, b) * b; }
inline u64 xorshift() { static u64 x = 88172645463325252ull; x = x ^ (x << 7); return x = x ^ (x >> 9); }
void solve(); int main() { ios::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(16); solve(); return 0; }
template <typename T> class pqasc : public priority_queue<T, vector<T>, greater<T>> {};
template <typename T> class pqdesc : public priority_queue<T, vector<T>, less<T>> {};
template <typename T> inline void amax(T &x, T y) { if (x < y) x = y; }
template <typename T> inline void amin(T &x, T y) { if (x > y) x = y; }
template <typename T> inline T power(T x, i64 n, T e = 1) { T r = e; while (n > 0) { if (n & 1) r *= x; x *= x; n >>= 1; } return r; }
template <typename T> istream& operator>>(istream &is, vector<T> &v) { each(x, v) is >> x; return is; }
template <typename T> ostream& operator<<(ostream &os, vector<T> &v) { rep(i, v.size()) { if (i) os << ' '; os << v[i]; } return os; }
template <typename T, typename S> istream& operator>>(istream &is, pair<T, S> &p) { is >> p.first >> p.second; return is; }
template <typename T, typename S> ostream& operator<<(ostream &os, pair<T, S> &p) { os << p.first << ' ' << p.second; return os; }

void solve() {
  int n; cin >> n;
  vi32 a(n); cin >> a;
  vector<bool> b(n);
  rrep(i, n) {
    int sum = 0;
    int di = i + 1;
    for (int j = di; j <= n; j += di) {
      sum += b[j - 1];
      sum %= 2;
    }
    if (sum != a[i]) b[i] = true;
  }
  vi32 ans;
  rep(i, n) if (b[i]) ans.push_back(i + 1);
  cout << ans.size() << '\n';
  if (ans.size() > 0) cout << ans << '\n';
}


Measured memory_bytes: 2424
#ABC132 = 2*2*3*11
S = input()
A = []
for i in range(len(S)):
    A.append(S[i])
if S[0] == S[1] and S[2] == S[3] or S[0] == S[2] and S[1] == S[3] or S[0] == S[3] and S[1] == S[2]:
    if A.count(S[0]) == 4:
        print("No")
    else:
        print("Yes")
else:
    print("No")

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define fi first
#define se second
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }
typedef long long ll;
typedef pair<int, int> pii;
const ll INF = 1e9+100;
const ll MOD = 1e9+7;
const bool debug = 0;
//-----------------------------------------------//

int N;
int A[112345];

int main() {
	cin >> N;
	REP(i, N) scanf("%d", A + i);
	
	int sum = abs(A[0]);
	REP(i, N - 1) sum += abs(A[i + 1] - A[i]);
	sum += abs(A[N - 1]);
	
	REP(i, N) {
		int ans;
		if (i == 0) ans = sum - abs(A[0]) - abs(A[1] - A[0]) + abs(A[1]);
		else if (i == N - 1) ans = sum - abs(A[N-1]) - abs(A[N-1] - A[N-2]) + abs(A[N-2]);
		else ans = sum - abs(A[i] - A[i-1]) - abs(A[i+1] - A[i]) + abs(A[i+1] - A[i-1]);
		printf("%d\n", ans);
	}
	
	return 0;
}


Measured memory_bytes: 1664
K = int(input())
F = set()
val = 7
flg = True
for i in range(K+6):
  if val % K == 0:
    flg = False
    print(i+1)
    break
  F.add(val%K)
  val *= 10
  val += 7
  val %= K
  if val % K in F:
    break
if flg:
  print(-1)

Measured memory_bytes: 77988
#include <cstdio>
#include <cctype>
using namespace std;
int main(void){
    char ch;

    while(1){
        scanf("%c", &ch);
        if(isalpha(ch)){
            if(islower(ch)){
                printf("%c",toupper(ch));
            }
            if(isupper(ch)){
                printf("%c",tolower(ch));
            }
        }
        else printf("%c",ch);
        if(ch=='\n') break;
    }    
    return 0;
}



Measured memory_bytes: 2624
#include <algorithm>
#include <cstdio>
#include <deque>
#include <iomanip>
#include <iostream>
#include <queue>
#include <stack>
#include <utility>
#include <vector>
using std::cerr;
using std::cin;
using std::cout;
using std::endl;

int main(void) {
  cout << std::fixed << std::setprecision(10);
  cin.tie(0);
  std::ios::sync_with_stdio(false);
  int n;
  cin >> n;
  std::vector<int> h(n, 0);
  std::vector<int> c(n, 0);
  for (int i = 0; i < n; i++) {
    cin >> h[i];
  }
  c[1] = std::abs(h[1] - h[0]);
  // cout << c[1] << endl;
  for (int i = 2; i < n; i++) {
    c[i] = std::min(std::abs(h[i] - h[i - 1]) + c[i - 1],
                    std::abs(h[i] - h[i - 2]) + c[i - 2]);
    // cout << c[i] << endl;
  }
  cout << c[n - 1] << endl;

  return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define all(v) ((v).begin()), ((v).end())
#define INF 1e18
#define EPS 1e-9
#define bitcount __builtin_popcount
#define sz(v) ((int)((v).size()))
#define clr(v, d) memset(v, d, sizeof(v))
#define rep(i, v) for (int i = 0; i < sz(v); ++i)
#define lp(i, n) for (int i = 0; i < (int)(n); ++i)
#define LSOne(S) (S & (-S))
#define PI acos(-1.0)
#define P(x) cout << #x << " = { " << x << " }\n"
#define tests()  \
    int tttt;    \
    cin >> tttt; \
    while (tttt--)
#define fast_IO                       \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL);
#define file_IO                       \
    freopen("input.txt", "r", stdin); \
    freopen("output.txt", "w", stdout)
typedef long long ll;
int dcmp(long double x, long double y)
{
    return fabs(x - y) <= EPS ? 0 : x < y ? -1 : 1;
}
const int MAX_ITEM = 110;
const int MAX_VAL = 110 * 1000;
ll dp[MAX_ITEM][MAX_VAL];
ll weight[MAX_ITEM];
ll val[MAX_ITEM];
ll n, w;
void read();
void solve();
void clear();
int main()
{
#ifndef ONLINE_JUDGE
    file_IO;
#else
    fast_IO;
#endif

    solve();
}
void read()
{
    cin >> n >> w;
    lp(i, n)
    {
        cin >> weight[i] >> val[i];
    }
}
void clear()
{
    for (int i = 1; i < MAX_VAL; i++)
        dp[0][i] = INF;
}
void solve()
{
    read();
    clear();
    for (int i = 1; i <= n; i++)
    {
        for (int v = 0; v < MAX_VAL; v++)
        {
            dp[i][v] = dp[i - 1][v];
            if (v - val[i - 1] >= 0)
                dp[i][v] = min(dp[i][v], dp[i - 1][v - val[i - 1]] + weight[i - 1]);
        }
    }
    for (int i = MAX_VAL-1; i >= 0; i--)
    {
        
        if (dp[n][i] <= w)
        {
            cout << i << '\n';
            return;
        }
    }
}


Measured memory_bytes: 90404
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <string>
#include <vector>
#include <math.h>
#include <queue>
#include <deque>
#include <map>
const int MOD = 1e9+7;
typedef long long ll;
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> sa(n);
	for (int i = 0; i < n; i++){
		sa[i] = i+1 - a[i];
	}
	ll ans = 0;
	sort(sa.begin(), sa.end());
	for (int i = 0; i < n; i++){
		auto it1 = lower_bound(sa.begin(), sa.end(), i+1+a[i]);
		auto it2 = upper_bound(sa.begin(), sa.end(), i+1+a[i]);
		ans += it2 - it1;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 4844
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        // write your code here
        Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt(), K = scanner.nextInt();
        int res = 1;
        int cur = K - 1;
        while (cur < N - 1) {
            cur += K - 1;
            res ++;
        }
        System.out.println(res);
    }
}


Measured memory_bytes: 21332
#include<bits/stdc++.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) for(int i = 0; i < (b); i++)
#define all(a) (a).begin(), (a).end()
#define debug(x) cout << "debug " << x << endl;
const int INF = 2000000005;
const int X = 2000000000;
using namespace std;

//?????????????????°???????????????
int toNum(string str, bool minus){
    int num = 0;
    rep(i,str.size()){
        num *= 10;
        num += str[i] - '0';
    }
    if(minus) num*=-1;
    return num;
}

void checkMinus(int a[1005], string s[1001], int n){
    rep(i,n){
        if(s[i][0] == '-'){
            a[i] = toNum(s[i].substr(1,s[i].size() - 1), 1);
        }else if(s[i][0] == 'x') {
            a[i] = X;
        }else{
            a[i] = toNum(s[i], 0);
        }
    }
}

bool isDoubleX(int a[1001], int n){
    rep(i,n - 1){
        if(a[i] == X && a[i + 1] == X) return 1;
    }
    return 0;
}

bool isInpossible(int a[1001], int n){
    for(int i = 0; i < n; i+=2){
        if(a[i] == X || a[i + 1] == X || i + 1 >= n) continue;
        if(a[i] >= a[i + 1]) return 1;
    }
    for(int i = 1; i < n; i+=2){
        if(a[i] == X || a[i + 1] == X || i + 1 >= n) continue;
        if(a[i] <= a[i + 1]) return 1;
    }
    return 0;
}


int main(){
    int n;
    while(cin >> n, n){
        int a[1005];
        string s[1001];
        rep(i,1001) s[i] = {};
        int ans[2] = {-1 * INF,INF};

        rep(i,n) cin >> s[i];
        checkMinus(a, s, n);
        //debug(isInpossible(a,n))

        if(isDoubleX(a,n) || isInpossible(a,n)){
            cout << "none" << endl;
            continue;
        }else{
            rep(i,n){
                if(a[i] == X && i != 0 && i != n - 1){
                    if(i % 2) ans[0] = max(max(a[i - 1], a[i + 1]), ans[0]);
                    else ans[1] = min(min(a[i - 1], a[i + 1]), ans[1]);
                }else if(a[i] == X && i == 0){
                    ans[1] = min(ans[1], a[i + 1]);
                }else if(a[i] == X && i == n - 1){
                    if(i % 2) ans[0] = max(ans[0], a[i - 1]);
                    else ans[1] = min(ans[1], a[i - 1]);
                }
            }
            //cout << ans[0] << ' '  << ans[1] << endl;
            //if(a[0] == 1000000000 || a[1] == -10000000000) cout << "none" << endl;
            if(abs(ans[1] - ans[0]) == 2) cout << (ans[0] + ans[1]) / 2 << endl;
            else if(abs(ans[1] - ans[0]) > 2) cout << "ambiguous" << endl;
            else cout << "none" << endl;
        }
    }
}

Measured memory_bytes: 3156
Q,H,S,D = map(int,input().split())

N = int(input())

ans = 0
if D == min(D,S*2,H*4,Q*8):
    ans += (N // 2) * D
    N = N % 2

ans += N * min(S , H * 2,Q * 4)

print (ans)


Measured memory_bytes: 38384
#include <bits/stdc++.h>
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
int main() {
  char c[2][3];
  for(int i=0;i<2;i++) {
      cin >> c[i];
  }
  if(c[0][0]==c[1][2] && c[0][1]==c[1][1] && c[0][2]==c[1][0])
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
}

Measured memory_bytes: 256
import java.util.*;
import java.util.Map.*;

public class Main{
	static Scanner s=new Scanner(System.in);

	public static void main(String[] $){
		HashMap<Integer,Integer> o=new HashMap<>(),e=new HashMap<>();

		int n=s.nextInt();

		for(int i=0;i<n;++i)
			(i%2==0?e:o).merge(s.nextInt(),1,Integer::sum);

		Comparator<Entry<Integer,Integer>> c=Entry.<Integer,Integer>comparingByValue();
		Entry<Integer,Integer> O=o.entrySet().stream().max(c).get();
		Entry<Integer,Integer> E=e.entrySet().stream().max(c).get();

		int r=O.getValue()+E.getValue();
		if(O.getKey().equals(E.getKey())){
			o.remove(O.getKey());
			e.remove(E.getKey());
			Entry<Integer,Integer> O2=o.entrySet().stream().max(c).orElse(null);
			Entry<Integer,Integer> E2=e.entrySet().stream().max(c).orElse(null);
			r=Math.max(
					O.getValue()+(E2==null?0:E2.getValue()),
					E.getValue()+(O2==null?0:O2.getValue())
					);
		}
		System.out.println(n-r);
	}
}


Measured memory_bytes: 68576
#include<iostream>
using namespace std;
int main(void){
    int n;
    cin>>n;
    long long int arr[n];
    long long int ans=1;
    for(int i=0;i<n;i++){
        cin>>arr[i];
        if(arr[i]==0 || ans==0)
            ans=0;
        else if(ans!=-1){
            if(arr[i]<=1000000000000000000/ans)
                ans*=arr[i];
            else
                ans=-1;
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 4412