akhauriyash/Code-Regression huggingface dataset:
import Control.Monad
import Data.Char
import Data.Maybe
import qualified Data.ByteString.Char8 as B
import qualified Data.Vector.Unboxed as VU

tuplify2 (x:y:_) = (x,y)
tuplify2 _ = undefined

readInt = fst . fromJust . B.readInt
readIntTuple = tuplify2 . map readInt . B.words
readIntList = map readInt . B.words

getInt = fmap readInt B.getLine
getIntList = fmap readIntList B.getLine
-- getIntNList n = map readIntList <$> replicateM (fromIntegral n) B.getLine

-- readLine n = VU.unfoldrN n B.readInt <$> B.getLine

toDouble x = fromInteger x :: Double

main = do
  _ <- getLine
  as <- getIntList
  putStrLn . unwords . map show . reverse $ as



Measured memory_bytes: 3552
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <typeinfo>
#include <numeric>
#include <functional>
#include <unordered_map>
#include <bitset>
#include <stack>
#include <assert.h>
#include <unordered_set>
#include <random>


using namespace std;
using ll = long long;
using ull = unsigned long long;

const ll INF = 1e18;
const ll MOD = 1e9 + 7;

#define REP(i, n) for(ll i = 0; i < n; i++)



















int main(){
    string s;
    cin >> s;
    cout << ((s[0] == s[1] && s[1] == s[2])? "No" : "Yes") << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	std::ios::sync_with_stdio(false);
	long long n,ans=0,temp;
	cin>>n;
	for(long long i=sqrt(n);i>=1;i--)
	{
		if(n%i==0)
		{
			temp=max(i,n/i);
			while(temp>0)
			{
				temp/=10;
				ans++;
			}
			break;
		}
	}
	cout<<ans<<endl;
	return 0;
}



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

int main(){
  int n;
  cin >>n;
  int ans = 0;
  rep(i,n){
    int l,r;
    cin >>r >>l;
    ans += l-r+1;
  }
  cout << ans << endl;
  return 0;
}

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

#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
using P = pair<int, int>;

int main() {
  long long N;
  long long a[200000];
  cin >> N;
  rep(i, N) {
    cin >> a[i];
  }
  long long xsum = a[0];
  rep(i, N-1) {
    xsum = xsum ^ a[i+1];
  }
  rep(i, N) {
    long long out = xsum ^ a[i];
    cout << out;
    if(i != N - 1) cout << " ";
  }
  cout << endl;
  return 0;
}

Measured memory_bytes: 5120
#include <iostream>
using namespace std;
int main(void){
    int l, i=0, x[5];
    while(cin>>l){
        x[i] = l;
        i++;
      	if(l==0){
          	cout<<i<<endl;
          	return 0;
        }
    }
  	return 0;
  	
}

Measured memory_bytes: 3620
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Main main = new Main();
        main.run();
    }
    
    // 変数一覧
    int n;

    public void run() {
        // 入力情報取得
        Scanner sc = new Scanner(System.in);
        n = sc.nextInt();
        sc.close();

        // 解答処理
        solve();
    }
    
    private void solve() {
        if(
            n%10 == 2 ||
            n%10 == 4 ||
            n%10 == 5 ||
            n%10 == 7 ||
            n%10 == 9        
        ) {
            System.out.println("hon");
        }
        if(
            n%10 == 0 ||
            n%10 == 1 ||
            n%10 == 6 ||
            n%10 == 8        
        ) {
            System.out.println("pon");
        }
        if(
            n%10 == 3        
        ) {
            System.out.println("bon");
        }
    }
}

Measured memory_bytes: 35796
import java.util.Scanner;
 
public class Main {
 
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long n = sc.nextLong();
        long a = sc.nextLong();
        long b = sc.nextLong();
 
        long c = n / (a+b);
        long d = n % (a+b);
 
        long e = Math.min(d, a);
        System.out.println(c * a + e);
    }
}

Measured memory_bytes: 22608
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define P pair<ll,ll>
#define FOR(I,A,B) for(ll I = (A); I < (B); ++I)
#define FORR(I,A,B) for(ll I = (B-1); I >= (A); --I)
#define REV(x) (reverse(x.begin(),x.end()))
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin()) //ai>=v  x is sorted
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin()) //ai>v  x is sorted
#define NUM(x,v) (POSU(x,v)-POSL(x,v))
const ll INF=1e18+7;
const ll MOD=1e9+7;
const ll N=100002;
ll gcd(ll a,ll b){if(a<b)swap(a,b);if(a%b==0)return b;else return gcd(b,a%b);}

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	ll n;
	cin >> n;
	vector<ll> a(n);
	ll sum=0;
	FOR(i,0,n)cin>>a[i];
	FOR(i,0,n)sum+=a[i];
	if(sum&1)sum++;
	sum /= 2;
	bitset<(int)4e6+5> dp;
	dp[0] = 1;
	for(auto x : a){
		dp |= dp<<x;
	}
	FOR(i,sum,4e6+5){
		if(dp[i]){
			cout<< i <<endl;
			return 0;
		}
	}
}

Measured memory_bytes: 1920
#define _CRT_SECURE_NO_WARNINGS
#define _SCL_SECURE_NO_WARNINGS
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <utility>
#include <algorithm>
#include <functional>
#include <cmath>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <iomanip>
#include <sstream>
#include <bitset>
#include <limits>
#include <numeric>
#include <valarray>
#include <fstream>

using namespace std;
typedef unsigned int uint;
typedef long long LL;
typedef unsigned long long ULL;
typedef pair<LL, LL> PP;
#define REP(i,a,n) for(LL i = (a); i < (LL)(n); ++i)
#define REM(i,a,n) for(LL i = ((n) - 1); i >= (a); --i)
#define FLOAT fixed << setprecision(16)
#define SPEEDUP {cin.tie(0); ios::sync_with_stdio(false);}
const int INF = 0x3FFFFFFF;
const LL INFLL = 0x3FFFFFFF3FFFFFFF;
const double INFD = 1.0e+308;
const string INFSTR = "\x7f";
const double EPS = 1.0e-9;

void YesNo(bool b) { cout << (b ? "Yes" : "No") << endl; }
void YESNO(bool b) { cout << (b ? "YES" : "NO") << endl; }
template <class T, class U>
istream& operator>>(istream& ist, pair<T, U>& right) { return ist >> right.first >> right.second; }
template <class T, class U>
ostream& operator<<(ostream& ost, const pair<T, U>& right) { return ost << right.first << ' ' << right.second; }
template <class T, class TCompatible, size_t N>
void Fill(T(&dest)[N], const TCompatible& val) { fill(dest, dest + N, val); }
template <class T, class TCompatible, size_t M, size_t N>
void Fill(T(&dest)[M][N], const TCompatible& val) { for (int i = 0; i < M; ++i) Fill(dest[i], val); }
template<class T>
T Compare(T left, T right) { return left > right ? 1 : (left < right ? -1 : 0); }
istream& Ignore(istream& ist) { string s; ist >> s; return ist; }
bool Inside(int i, int j, int h, int w) { return i >= 0 && i < h && j >= 0 && j < w; }
// all_of
// partial_sum, adjacent_difference

#ifdef ONLY_MY_ENVIR
#include "IntMod.h"
#include "Union_Find.h"
#include "Graph.h"
#include "Range.h"
#include "Global.h"
#include "Flow_Solver.h"
#include "Tree.h"
#include "Suffix_Array.h"
#include "Geometry.h"
#include "Matrix.h"
#endif

#ifdef __GNUC__
typedef __int128 LLL;
istream& operator>> (istream& ist, __int128& val) { LL tmp;  ist >> tmp; val = tmp; return ist; }
ostream& operator<< (ostream& ost, __int128 val) { LL tmp = val; ost << tmp; return ost; }
#endif

#if 1234567891
#include <array>
#include <random>
#include <unordered_set>
#include <unordered_map>
template<typename T>
using PriorityQ = priority_queue<T, vector<T>, greater<T> >;	// コスト小を優先
#endif


bool ikeru(int x, int y, int a, int b, int c) {
	int dx = abs(x - a);
	int dy = abs(y - b);
	if (dx + dy > c) return 0;
	return (dx + dy - c) % 2 == 0;
}

int main() {
	int x = 0, y = 0;
	int N;
	cin >> N;
	bool ok = 1;

	int prevc = 0;
	REP(i, 0, N) {
		int a, b, c;
		cin >> c >> a >> b;
		ok &= ikeru(x, y, a, b, c - prevc);
		x = a; y = b;
		prevc = c;
	}
	YesNo(ok);
	return 0;
}

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

#define ms(s, n) memset(s, n, sizeof(s))
#define FOR(i, a, b) for (int i = (a); i <= (b); i++)
#define FORd(i, a, b) for (int i = (a) ; i >= (b); i--)
#define FORall(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
#define sz(a) int((a).size())
#define present(t, x) (t.find(x) != t.end())
#define all(a) (a).begin(), (a).end()
#define uni(a) (a).erase(unique(all(a)), (a).end())
#define pb push_back
#define pf push_front
#define mp make_pair
#define fi first
#define se second
#define sp system("pause")
#define prec(n) fixed<<setprecision(n)
#define bit(n, i) (((n) >> (i)) & 1)
#define bitcount(n) __builtin_popcountll(n)
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pi;
typedef vector<int> vi;
typedef vector<pi> vii;
const int MOD = (int) 1e9 + 7;
const int INF = (int) 1e9;
const ll LINF = (ll) 1e18;
const ld PI = acos((ld) -1);
const ld EPS = 1e-9;
const int N = (int) 1e5 + 10;
void TimeExecution() {
    cout << "\n\n===>> Time Execution: " << clock() / (double)1000 << " sec(s).";
}
int t;
int dist[1001][1001];
int a[1001];
int b[1001];
int c[1001];
int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    /*
    #ifndef ONLINE_JUDGE
        freopen("in.txt", "r", stdin);
        freopen("out.txt", "w", stdout);
    #endif
    */
    FOR(i, 1, 1000)
        FOR(j, 1, 1000)
            if(i == j) continue;
            else dist[i][j] = INF;
    int n, m;
    cin >> n >> m;
    FOR(i, 1, m)
    {
        int u, v, z;
        cin >> u >> v >> z;
        a[i] = u;
        b[i] = v;
        c[i] = z;
        dist[u][v] = z;
        dist[v][u] = z;
    }
    FOR(k, 1, n)
        FOR(i, 1, n)
            FOR(j, 1, n)
                dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j]);
   // cout << dist[2][3];
    int ans = m;
    FOR(i, 1, m)
    {
        bool ok = 0;
        FOR(j, 1, n)
        {
            if(dist[j][a[i]] + c[i] == dist[j][b[i]])
            {
                ok = 1;
             //   cout << i << " " << j << endl;
                break;
            }
        }
        if(ok) ans--;
    }
    cout << ans;
    return 0;
}


Measured memory_bytes: 4224
package main

import (
	"fmt"
)

func main() {

	var s, t string
	var cnt int
	fmt.Scan(&s)
	fmt.Scan(&t)

	for i := 0; i < len(s); i++ {
		if s[i] != t[i] {
			cnt++
		}
	}

	fmt.Println(cnt)
}


Measured memory_bytes: 4500
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

n, m, x, y = na()
xxx = na()
yyy = na()
ans = "War"
for z in range(x+1, y+1):
    if max(xxx) < z <= min(yyy):
        ans = "No War"
        break
print(ans)

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

int main() {
  int K, N;
  cin >> K >> N;
  vector<int> A(N);
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }
  int max_dis = 0;
  for (int i = 1; i < N; i++) {
    max_dis = max(max_dis, A[i] - A[i - 1]);
  }
  max_dis = max(max_dis, K + A[0] - A[N - 1]);
  cout << K - max_dis << endl;
  return 0;
}

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

using namespace std;


#ifdef CLION

ifstream ifs("/home/kyuridenamida/CLionProjects/untitled4/input.txt");
#define cin ifs
#define scanf DONT_USE_SCANF
#endif

typedef long long ll;


int main() {
    int n;
    cin >> n;
    deque<int> Q;
    for (int i = 0; i < n; i++) {
        int x;
        cin >> x;
        Q.push_back(x);
    }
    sort(Q.begin(), Q.end());
    deque<int> V;
    V.push_back(Q.back());
    Q.pop_back();

    long long ans = 0;
    while (Q.size()) {
        vector<pair<int, pair<int, int>>> C;
        for (int i = 0; i < 2; i++) {
            for (int j = 0; j < 2; j++) {
                int q = i ? Q.front() : Q.back();
                int x = j ? V.front() : V.back();
                C.push_back({abs(q - x), {i, j}});
            }
        }
        sort(C.begin(), C.end());
        ans += C.back().first;
        int I = C.back().second.first;
        int J = C.back().second.second;
        int q = I ? Q.front() : Q.back();
        if (J) {
            V.push_front(q);
        } else {
            V.push_back(q);
        }
        if (I) {
            Q.pop_front();
        } else {
            Q.pop_back();
        }
    }
    cout << ans << endl;
}



Measured memory_bytes: 768
#include <iostream>
#include <cmath>
#include <vector>
#include <array>
#include <set>
#include <queue>

using namespace std;

const int N = 4;
const int N2 = N * N;

int MDT[N2][N2];

struct Puzzle {
    array<char, N2> board;
    int empty;
    int cost;
    int rank;

    bool operator < (const Puzzle& other) const {
        return cost + rank > other.cost + other.rank;
    }
};

int distance(const Puzzle& p) {
    int d = 0;
    for (int i = 0; i < N2; ++i) {
        if (p.board[i] == N2) continue;
        d += MDT[i][p.board[i] - 1];
    }
    return d;
}

const vector<array<int, 2>> dir = {
    {-1, 0}, // left
    {0, -1}, // up
    {1, 0},  // right
    {0, 1},  // down
};

int astar(Puzzle start) {
    auto puzzle_less = [](const Puzzle& a, const Puzzle& b) {
        for (int i = 0; i < N2; ++i) {
            if (a.board[i] != b.board[i])
                return a.board[i] < b.board[i];
        }
        return false;
    };

    Puzzle ans;
    set<Puzzle, decltype(puzzle_less)> visited(puzzle_less);
    priority_queue<Puzzle> Q;
    Q.push(start);
    while (!Q.empty()) {
        auto u = Q.top();
        Q.pop();
        if (u.rank == 0) {
            return u.cost;
        }
        visited.insert(u);

        auto sx = u.empty % N;
        auto sy = u.empty / N;
        for (auto& d : dir) {
            auto tx = sx + d[0];
            auto ty = sy + d[1];
            if (tx < 0 || ty < 0 || tx >= N || ty >= N) {
                continue;
            }
            auto v = u;

            auto k = tx + ty * N;
            swap(v.board[v.empty], v.board[k]);
            v.empty = k;
            v.rank = distance(v);
            if (visited.find(v) == visited.end()) {
                ++v.cost;
                Q.push(v);
            }
        }
    }
    return -1;
}

int main() {
    for (int i = 0; i < N2; ++i) {
        for (int j = 0; j < N2; ++j) {
            // iからjへのマンハッタン距離
            MDT[i][j] = abs(i / N - j / N) + abs(i % N - j % N);
        }
    }

    Puzzle start;
    for (int i = 0; i < N2; ++i) {
        int x;
        cin >> x;
        start.board[i] = x;
        if (x == 0) {
            start.board[i] = N2;
            start.empty = i;
        }
    }
    start.cost = 0;
    start.rank = distance(start);
    cout << astar(start) << endl;

    return 0;
}


Measured memory_bytes: 100596
import java.io.*;
import java.util.*;

public class Main {
    public static final long mod = (long)1e9+7;
    public static final long INF = Long.MAX_VALUE/10;
    public static final int inf = Integer.MAX_VALUE;

    static void solve(InputReader in, PrintWriter out){
        int n = in.ni();
        int[][] dp = new int[n][3];
        int[][] abc = new int[n][3];
        for (int i = 0; i < n; i++) {
            abc[i][0] = in.ni();
            abc[i][1] = in.ni();
            abc[i][2] = in.ni();
            Arrays.fill(dp[i], inf);
        }
        dp[0][0] = abc[0][0];
        dp[0][1] = abc[0][1];
        dp[0][2] = abc[0][2];
        for (int i = 1; i < n; i++) {
            dp[i][0] = Math.max(dp[i-1][1],dp[i-1][2])+abc[i][0];
            dp[i][1] = Math.max(dp[i-1][0],dp[i-1][2])+abc[i][1];
            dp[i][2] = Math.max(dp[i-1][1],dp[i-1][0])+abc[i][2];
        }
        out.println(Math.max(dp[n-1][0], Math.max(dp[n-1][1], dp[n-1][2])));
    }

    public static void main(String[] args) throws Exception{
        InputReader in = new InputReader(System.in);
        PrintWriter out = new PrintWriter(System.out);
        solve(in, out);
        out.close();
    }
    public static class InputReader{
        private BufferedReader br;
        private StringTokenizer st;
        public InputReader(InputStream is){
            br = new BufferedReader(new InputStreamReader(is));
            st = null;
        }
        public String ns(){
            if(st == null || !st.hasMoreTokens()){
                try{
                    st = new StringTokenizer(br.readLine());
                }catch (Exception e){
                    throw new RuntimeException(e);
                }
            }
            return st.nextToken();
        }
        public long nl(){
            return Long.parseLong(ns());
        }
        public int ni(){
            return Integer.parseInt(ns());
        }
        public Double nd(){
            return Double.parseDouble(ns());
        }
        public int[] ni(int n){
            int[] a = new int[n];
            for (int i = 0; i < n; i++) {
                a[i] = ni();
            }
            return a;
        }
        public long[] nl(int n){
            long[] a = new long[n];
            for (int i = 0; i < n; i++) {
                a[i] = nl();
            }
            return a;
        }
        public double[] nd(int n){
            double[] a = new double[n];
            for (int i = 0; i < n; i++) {
                a[i] = nd();
            }
            return a;
        }
    }
}

Measured memory_bytes: 54320
#include <iostream>
#include <vector>
#include <map>
using namespace std;
//              1  2  3  4  5  6  7  8  9  10 11
int arr[] = {0, 1, 3, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1};
map<int, int> m;

int main() {
    for(int i = 1; i <= 12; ++i) {
        m[i] = arr[i];
    }
    
    int a, b;
    cin >> a >> b;

    if(m[a] == m[b]) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    
    return 0;
}


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

double dp[3000][3000];
double l[3000];
int mod = pow(10,9) +7;
deque<vector<int>> d;

int main() {
  int a,b,c,k; 
  cin >> a >> b >> c >> k;
  int res = 0;
  if(k <= a){
    res = k ;
  }else if(a + b >= k){
    res = a;
  }else if(k > a+b and k<= a+b+c){
    res = a -(k -(a+b));
  }
  cout << res;
}


Measured memory_bytes: 3636
#include <array>
#include <iostream>
#include <map>
#include <vector>

//! @brief Regard Map of {key, count} to record count of key, initialize with 0 if key not found, then add
//! adding to key's count.
template <typename Map, typename Value = typename Map::mapped_type>
Value &
MapAddCount(Map &map, typename Map::key_type key, Value adding)
{
    auto [it, flag] = map.try_emplace(key, 0);
    (void)flag;
    auto &count = it->second;
    count += adding;
    return count;
}

inline constexpr std::size_t BufferSize = 1024;

int
main()
{
    std::ios::sync_with_stdio(false);

    std::vector<int> bufferA;
    bufferA.resize(BufferSize, 0);
    std::vector<int> bufferB;
    bufferB.resize(BufferSize, 0);
    std::vector<int> bufferC;
    bufferC.resize(BufferSize, 0);

    std::vector<int> values;

    std::size_t valueCount;
    std::cin >> valueCount;

    auto usingValuesPtr = &bufferA;
    if (valueCount>BufferSize)
    {
        values.resize(valueCount);
        usingValuesPtr = &values;
    }
    auto &usingValues = *usingValuesPtr;

    for (std::size_t i = 0; i<valueCount; ++i)
    {
        std::cin >> usingValues[i];
    }

    std::size_t operationCount;
    std::cin >> operationCount;

    std::vector<int> oldValues;
    std::vector<int> newValues;

    auto usingOldValuesPtr = &bufferB;
    auto usingNewValuesPtr = &bufferC;
    if (operationCount>BufferSize)
    {
        oldValues.resize(operationCount);
        newValues.resize(operationCount);
        usingOldValuesPtr = &oldValues;
        usingNewValuesPtr = &newValues;
    }
    auto &usingOldValues = *usingOldValuesPtr;
    auto &usingNewValues = *usingNewValuesPtr;

    for (std::size_t i = 0; i<operationCount; ++i)
    {
        std::cin >> usingOldValues[i];
        std::cin >> usingNewValues[i];
    }

    long long sum = 0;
    std::map<int, int> valueCounts;
    for (auto &value : usingValues)
    {
        MapAddCount(valueCounts, value, 1);
        sum += value;
    }

    for (std::size_t i = 0; i<operationCount; ++i)
    {
        auto oldValue = usingOldValues[i];
        auto newValue = usingNewValues[i];

        auto findOldValue = valueCounts.find(oldValue);
        if (findOldValue==valueCounts.end())
        {
            std::cout << sum << "\n";
            continue;
        }

        sum -= static_cast<long long>(oldValue)*findOldValue->second;
        sum += static_cast<long long>(newValue)*findOldValue->second;

        MapAddCount(valueCounts, newValue, findOldValue->second);
        valueCounts.erase(oldValue);
        std::cout << sum << "\n";
    }
}


Measured memory_bytes: 7488
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int h,w,i=0,j,c=0;
    string s;
    cin >> s;
    if(s=="ABC")
    {
        cout << "ARC" << endl;
    }
    if(s=="ARC")
    {
        cout << "ABC" << endl;
    }

    return 0;

}


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

using namespace std;

int main()
{
string a;
string b;
int n;
	cin>>n;
	cin>>a;
	cin>>b;
	
	for(int i=0;i<n;i++)
	{
	cout<<a[i];
	cout<<b[i];
		
		
	}
	
	return 0;
}

Measured memory_bytes: 256
H,W = map(int, input().split())
matrix = []

for i in range(H):
    matrix.append(input())

newmat = []

for i in range(H):
    if matrix[i] == '.'*W:
        continue
    else:
        newmat.append(matrix[i])
        
printW = []
for x in range(W):
    for lin in newmat:
        if lin[x] == '#':
            printW.append(x)
            break
        
for lin in newmat:
    str = ''
    for w in printW:
        str += lin[w]
    print(str)

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

const int DIM = 1e5 + 5;

long long cnt[DIM];

int main( void ) {
    
    int n; long long k;
    cin >> n >> k;
    
    for( int i = 1; i <= n; i ++ ) {
        int x, y;
        cin >> x >> y;
        
        cnt[x] += y;
    }
    
    for( int i = 1; i <= 1e5; i ++ ) {
        if( k <= cnt[i] ) {
            cout << i << endl;
            break;
        }
        else
            k -= cnt[i];
    }
    
    return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define ms(a,b) memset(a,b,sizeof(a))
#define ll long long 
const int MAXN=1e5+10;

int main()
{
	ll n;
	cin>>n;
	ll Max=-1;
	for(ll i=1;i<=n;i++){
		if (i*i<=n)
			Max=i*i;
	}
	cout<<Max<<endl;
	return 0;
}

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

int main() {
  string s;
  cin >> s;
  int n = s.size();
  int ans = n;
  for (int i = 1; i < n; i ++) {
    if (s[i] != s[i - 1]) {
      ans = min(ans, max(i, n - i));
    }
  }

  cout << ans << endl;
}

Measured memory_bytes: 512
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        double r = sc.nextDouble();
        double pi = Math.PI;
        double area = r * r * pi;
        double length = 2 * r * pi;
        System.out.printf("%f %f", area, length);
    }
}


Measured memory_bytes: 28244
from itertools import combinations

n = int(input())
s = [input() for i in range(n)]

m = 0
a = 0
r = 0
c = 0
h = 0
for i in s:
    if i[0] == "M":
        m += 1
    if i[0] == "A":
        a += 1
    if i[0] == "R":
        r += 1
    if i[0] == "C":
        c += 1
    if i[0] == "H":
        h += 1

comb = (m, a, r, c, h)
ans = 0
for x, y, z in combinations(comb, 3):
    ans += x * y * z

print(ans)


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

using namespace std;

int main() {
    int a, b;
    cin >> a >> b;
    if (a >= b) swap(a, b);

    int diff = b - a;
    if (diff % 2 == 0) {
        cout << a + diff / 2 << endl;
    } else {
        cout << "IMPOSSIBLE" << endl;
    }
    return 0;
}

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

int n, a, cnt[100002], ans;

int main() {
    cin >> n;
    while(n--) {
        scanf(" %d", &a);
        if (a != 0) cnt[a-1]++;
        cnt[a]++;
        cnt[a+1]++;
    }
    for (int i = 0; i <= 100001; i++) {
        ans = max(ans, cnt[i]);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 640
n,k = map(int, input().split())
r,s,p = map(int, input().split())
t = input()

score = 0
result = ""
def judge(i):
    if i >= k and t[i] == t[i-k] and result[i-k] == "w":
        return False
    else:
        return True

for i in range(n):
    if judge(i):
        result += "w"
        if t[i] == "r":
            score += p
        elif t[i] == "s":
            score += r
        else:
            score += s
    else:
        result += "l"
print(score)



Measured memory_bytes: 3444
#include<bits/stdc++.h>
#define maxn 100005
using namespace std;
char s[maxn];
int main()
{
    int len,flag=1;
    scanf("%s",s+1);
    len=strlen(s+1);
    int head=1,tail=len;
    for(int i=1;i<=len;i++)
    {
        char n;
        if(s[tail]=='b')n='d';
        else if(s[tail]=='d')n='b';
        else if(s[tail]=='p')n='q';
        else if(s[tail]=='q')n='p';
        if(n!=s[head])
        {
            flag=0;
            break;
        }
        head++;
        tail--;
    }
    if(flag)
    printf("Yes");
    else
    printf("No");
    return 0;
}

Measured memory_bytes: 384
//#include "pch.h"
//#include "stdafx.h"
#include <iostream>
#include <queue>
#include <vector>
#include <algorithm>
#include <math.h>
#include <string>
#include <cstring>

using namespace std;

/*-----------------------------------------------------------------------------
　定義
 -------------------------------------------------------------------------------*/
#define REP(i, n) for (int (i) = 0 ; (i) < (int)(n) ; ++(i))
#define REPN(i, m, n) for (int (i) = m ; (i) < (int)(n) ; ++(i))
#define REP_REV(i, n) for (int (i) = (int)(n) - 1 ; (i) >= 0 ; --(i))
#define REPN_REV(i, m, n) for (int (i) = (int)(n) - 1 ; (i) >= m ; --(i))
#define INF				2e9
#define MOD				(1000 * 1000 * 1000 + 7)
#define MIN(a, b)		((a) < (b) ? a : b)
#define MAX(a, b)		((a) > (b) ? a : b)
#define IsOdd(x)		(((x)&0x01UL) == 0x01UL)		/* 奇数 */
#define IsEven(x)		(!IsOdd((x)))					/* 偶数 */
#define ArrayLength(x)	(sizeof(x) / sizeof(x[0]))
#define DWORD_MAX		(0xFFFFFFFF)

typedef short SWORD;
typedef unsigned short WORD;
typedef long SDWORD;
typedef unsigned long DWORD;
typedef long long int QWORD;
typedef pair<int, int> P;

#define N_MAX	(100000)
#define M_MAX	(1000)
#define H_MAX	(1000)
#define W_MAX	(1000)

/*-----------------------------------------------------------------------------
　処理
 -------------------------------------------------------------------------------*/
// メイン
int main()
{
	int N, M;
	cin >> N >> M;

	int minNoRes = 0, maxNoRes = N;
	REP(i, M) {
		int minNo, maxNo;
		cin >> minNo >> maxNo;
		minNoRes = MAX(minNoRes, minNo);
		maxNoRes = MIN(maxNoRes, maxNo);
	}

	if (minNoRes <= maxNoRes) {
		cout << maxNoRes - minNoRes + 1;
	} else {
		cout << 0;
	}
	cout << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <list>
#include <iomanip>
#include <string>
#include <cctype>
#include <cstdio>
#include <cmath>

using namespace std;

int main(){
  string c1="Z";
  string r;
  cin>>r;
  if(r>c1)
    cout<<"a"<<endl;
  else
    cout<<"A"<<endl;
}

Measured memory_bytes: 3564
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		long[] a = new long[n + 1];
		long[] b = new long[n + 1];
		
		Arrays.setAll(a, i -> sc.nextLong());
		for (int i = 0; i < n; i++) {
			b[i] = sc.nextLong();
		}
		
		long m = 0;
		for (int i = 0; i < n + 1; i++) {
//			System.out.println("i=" + i);
//			System.out.println("  a=" + a[i]);
//			System.out.println("  b=" + b[i]);
			m += Math.min(a[i], b[i]);
//			System.out.println("  m=" + m);
			
			if (i < n && b[i] > a[i]) {
				long dif = b[i] - a[i];
				m += Math.min(a[i + 1], dif);
				a[i + 1] = Math.max(a[i + 1] - dif, 0);
//				System.out.println("  dif=" + dif);
//				System.out.println("  m=" + m);
			}
		}
		
		System.out.println(m);
	}	
}


Measured memory_bytes: 94372
#include<iostream>
#include<string>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
	vector<int> A;
	vector<int> F;
	int s;
	cin >> s;
	A.push_back(s);
	int i;
	if (s == 4 || s == 2 || s == 1) {
		cout << 4;
	}
	else {
		for (i = 0; i < 1000000; i++) {
			if (A.at(i) % 2 == 0) {
				A.push_back(A.at(i) / 2);
			}
			else {
				A.push_back(A.at(i) * 3 + 1);
			}
			if (A.at(i + 1) == 4) {
				cout << i + 5;
				break;
			}
		}
	}
}

Measured memory_bytes: 256
a=list(input())
import copy
for i in range(2**3):
    b=[]
    c=copy.deepcopy(a)
    for j in range(3):
        if (i>>j)&1:
            b.append("+")
        else:
            b.append('-')
    c.insert(1,b[0])
    c.insert(3,b[1])
    c.insert(5,b[2])
    c=''.join(c)
    if eval(c)==7:
        print(c+"=7")
        exit()

Measured memory_bytes: 3444
#include <iostream>
#include <vector>
#include <queue>
#include <cstdlib>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define INF (1<<21)

struct EDGE{
	int to,cost,bit;
	EDGE(int a,int b,int c){to = a , cost = b , bit = c;}
};
bool operator < (const EDGE &a,const EDGE &b){
	return a.cost > b.cost;
}

int m,n,K,d;
int get(string s){
	if(s[0] == 'H')return n+m;
	if(s[0] == 'D')return n+m+1;
	if(s[0] == 'L')return m+atoi(s.substr(1).c_str())-1;
	if(s[0] == 'C')return atoi(s.substr(1).c_str())-1;
}
int main(){
	while(cin >> m >> n >> K >> d , m ){
		
		// Input
		vector<int> cake(m);
		rep(i,m)cin >> cake[i];
		
		vector< vector<EDGE> > E(n+m+2);
		rep(i,d){
			string a,b; int c;
			cin >> a >> b >> c;
			E[get(a)].push_back(EDGE(get(b),c*K,0));
			E[get(b)].push_back(EDGE(get(a),c*K,0));
		}
		
		
		// Dijkstra
		priority_queue<EDGE> Q;
		bool done[1<<6][108] = {0};
		int d[1<<6][108];
		rep(i,1<<6)rep(j,108)d[i][j] = INF;
		Q.push(EDGE(n+m,0,0));
		while(Q.size()){
			EDGE q = Q.top(); Q.pop();
			if(done[q.bit][q.to])continue;
			else done[q.bit][q.to] = true , d[q.bit][q.to] = q.cost;
			rep(i,E[q.to].size()){
				EDGE e = E[q.to][i];
				if(e.to < m && (q.bit & (1<<e.to)) ) continue;
				if(e.to < m){
					Q.push(EDGE(e.to , q.cost+e.cost , q.bit|(1<<e.to)));
				}else{
					Q.push(EDGE(e.to , q.cost+e.cost , q.bit));
				}
			}
		}
		//Output
		int ans = INF;
		rep(i,1<<m){
			int down = 0;
			rep(j,m) down += ( i & (1 << j) ? cake[j] : 0);
			ans = min(ans,d[i][n+m+1]-down);
		}
		cout << ans << endl;
	}
}

Measured memory_bytes: 1340
n = int(input())
h = list(map(int, input().split()))

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


Measured memory_bytes: 13928
import java.math.BigDecimal;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO ?????????????????????????????????????????????
		Scanner sc = new Scanner(System.in);
		String line = sc.nextLine();
		String[] x = line.split(" ");
		int a = Integer.parseInt(x[0]);
		int b = Integer.parseInt(x[1]);
		double fa = Integer.parseInt(x[0]);
		double fb = Integer.parseInt(x[1]);
		System.out.print(a / b + " ");
		System.out.print(a % b + " ");
		double f = fa / fb;
		BigDecimal B = new BigDecimal(f);
		BigDecimal F = B.setScale(9, BigDecimal.ROUND_HALF_UP);
		System.out.printf("%.8f",F);

	}

}

Measured memory_bytes: 26664
#include<iostream>
#include<string>
#include<vector>
using namespace std;
int main(){
  string a,b;
  int hit, blow;
  bool flag[4];
  while(cin >> a >> b){
    if(a[0] == '0' && b[0] == '0') return 0;
    for(int i=0; i<4; i++){
    }

    hit = 0; 
    blow = 0;
    for(int i=0; i<4; i++)
      flag[i] = false;

    for(int i=0; i<4; i++){
	if(a[i] == b[i]){
	  hit++;
	  flag[i] = true;
	}
	for(int j=0; j<4; j++){
	  if( a[i] == b[j] &&  flag[i] != true){
	    blow++;
	  }
	}
    }
    cout << hit << " " << blow << endl;
  }
}

Measured memory_bytes: 912
from collections import*
input=open(0).readline
n=int(input())
e=[[]for _ in range(n)]
for _ in range(n-1):
    a,b,c=map(int,input().split())
    e[a-1].append((b-1,c))
    e[b-1].append((a-1,c))
q,k=map(int,input().split())
d=[0]*n
f=[0]*n
f[k-1]=1
s=deque([(k-1,0)])
while s:
    t,c=s.pop()
    f[t]=1
    d[t]=c
    for i,v in e[t]:
        if not f[i]:
            s.append((i,v+c))
for _ in range(q):
    x,y=map(int,input().split())
    print(d[x-1]+d[y-1])

Measured memory_bytes: 47956
/*
Author: Babin Dutta
*/
 
#include <bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define ll long long int
#define pb push_back
#define mp make_pair
#define boost ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define f(i,n) for(int i=0;i<n;i++)
#define ff(i,a,b) for(int i=a;i<=b;i++)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define endl "\n"
#define inf 1e18
#define mm 998244353
 
ll power(ll x, ll y, ll p)
{
    ll res = 1;  
    x = x % p;  
    while (y > 0)
    {
        if (y & 1)
            res = (res*x) % p;
        y = y>>1; 
        x = (x*x) % p;  
    }
    return res;
}
ll modInverse(ll A,ll M)
{
    return power(A,M-2,M);
}

void solve(){
    ll a, b; cin>>a>>b;
    if(a*500 >= b) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}
 
int main(){
	#ifdef JUDGE
    freopen("input.txt", "rt", stdin);
    freopen("output.txt", "wt", stdout);
    #endif
	boost;
	int t=1; //cin>>t;
	for(int i=1;i<=t;i++) solve();
	return 0;
}

Measured memory_bytes: 3584
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

#define REP(i,s,n) for(int i=(int)(s);i<(int)(n);i++)

using namespace std;
typedef long long int ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef pair<int, int> PI;
const ll mod = 1e9 + 7;

void fail(void) {
  cout << "NO" << endl;
  exit(0);
}

int main(void){
  int n;
  cin >> n;
  VL a(n);
  ll tot = 0;
  REP(i, 0, n) {
    cin >> a[i];
    tot += a[i];
  }
  ll cum = (ll(n) * ll(n + 1)) / 2;
  if (tot % cum != 0) {
    fail();
  }
  ll cnt = tot / cum;
  REP(i, 0, n) {
    a[i] -= cnt * i;
  }
  ll ksum = a[0];
  REP(i, 0, n) {
    a[i] -= ksum;
  }
  if (0) {
    REP(i, 0, n) {
      cerr << "a[" << i << "]=" << a[i] << endl;
    }
  }
  REP(i, 0, n) {
    if (a[i] % n != 0) {
      fail();
    }
    if (i < n - 1) {
      if (a[i] < a[i + 1]) {
	fail();
      }
    }
  }
  cout << "YES" << endl;
}


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

#define ll long long
ll MOD = 1000000007;

using namespace std;

int main() {
    int n;
    cin >> n;
    ll ans = 0;
    vector<int> b(n - 1), a(n, INT_MAX);
    for (int i = 0; i < n - 1; i++) {
        cin >> b[i];
        a[i] = min(a[i], b[i]);
        a[i + 1] = min(a[i + 1], b[i]);
        ans += a[i];
    }
    cout << ans + a[n - 1];
    return 0;
}

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

using namespace std;



int main(void) {
	int N;
	long long K;
	cin >> N >> K;
	vector<int> a(N);
	for (int i = 0; i < N; i++) {
		cin >> a[i];
	}
	vector<int> s;
	vector<int> ord(N + 1, -1);
	int N1 = 1, N2 = 0;
	{
		int v = 1;
		while (ord[v] == -1) {
			ord[v] = s.size();
			s.push_back(v);
			v = a[v - 1];
		}
		N1 = ord[v];
		N2 = s.size();
	}
	if (K < N1) {
		cout << s[K] << endl;
	}
	else {
		K = K - N1;
		int x = K % (N2 - N1);
		cout << s[N1+x] << endl;
	}
	return 0;
}

Measured memory_bytes: 5392
#include<vector>
#include<iostream>
#include<string>
#include<algorithm>
#include<math.h>
#include<map>
#include<functional>
#include<queue>
#include<stack>
#include<string.h>
#include<list>
#define MOD 1000000007LL
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
int main() {
    ll N;
    cin>>N;
    for(ll h=1;h<=3500;h++){
        for(ll n=1;n<=3500;n++){
            ll a=N*h*n;
            ll b=4*h*n-N*(n+h);
            if(b==0){
                continue;
            }
            if(a%b==0){
                ll w=a/b;
                if(w>0){
                    cout<<h<<" "<<n<<" "<<w<<endl;
                    return 0;
                }
            }
        }
    }
}


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

int main() {
  int n;
  	cin>>n;
  int sum=0;
  for(int i=0;i<n;i++){
	int a,b;
    	cin>>a>>b;
    sum+=b-a+1;
  }
  cout<<sum<<endl;
}

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

string s;
int n;
int a[maxn];

int main() {
	cin >> s;
	n = s.size() + 1;
	memset(a, -1, sizeof a);
	if (s[0] == '<') {
		a[0] = 0;
	}
	if (s[n - 2] == '>') {
		a[n - 1] = 0;
	}
	for (int i = 0; i + 1 < s.size(); i++) {
		if (s[i] == '>' && s[i + 1] == '<') {
			a[i + 1] = 0;
		}
	}

	for (int i = 0; i < n; i++) {
		if (a[i] == 0) {
			int j = i - 1;
			while (j >= 0 && s[j] == '>') {
				a[j] = max(a[j], a[j + 1] + 1);
				j--;
			}
			j = i + 1;
			while (j < n && s[j - 1] == '<') {
				a[j] = max(a[j], a[j - 1] + 1);
				j++;
			}
		}
	}

	for (int i = 0; i < n; i++) {
		// cout << a[i] << ' ';
	}
	// cout << endl;

	long long ret = 0;
	for (int i = 0; i < n; i++) {
		ret += a[i];
	}
	cout << ret << endl;
	return 0;
}

Measured memory_bytes: 2948
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cstdlib>
#include<climits>
#define REP(i,m,n) for(int i = m; i < n; i++)
#define rep(i,n) REP(i,0,n)
template<class T> void chmax(T& a, T b) { if (a < b) { a = b; } }
template<class T> void chmin(T& a, T b) { if (a > b) { a = b; } }
using namespace std;

int main(void) {
	int n, m;
	cin >> n >> m;

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

	vector<int> b(m);
	rep(i, m) cin >> b[i];

	rep(i, n) {
		int c = 0;
		for (int j = 0; j < m; j++) {
			c += A[i][j]*b[j];
		}
		cout << c << endl;
	}
}


Measured memory_bytes: 3196
#include<iostream>
using namespace std;
int main(){
  int n,k;
  char s[10000];
  cin>>n;
  for(int i=0;i<n;i++)
    cin>>s[i];
  cin>>k;
  for(int i=0;i<n;i++){
    if(s[k-1]==s[i])
      cout<<s[i];
    else
      cout<<"*";
  }
  cout<<endl;
  return 0;
}

Measured memory_bytes: 256
package main

import (
	"fmt"
)

func main() {
	r := 0
	d := 0
	x := 0

	fmt.Scanf("%d %d %d", &r, &d, &x)

	for i := 0; i < 10; i++ {
		x = (r * x) - d
		fmt.Printf("%d\n", x)
	}
}


Measured memory_bytes: 512
#include <algorithm>
#include <bitset>
#include <cctype>
#include <chrono>
#include <cmath>
#include <cstdio>
#include <ctime>
#include <deque>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <string>
#include <tuple>
#include <unordered_map>
#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;
/*----------------------------------------*/

int main() {
  cin.tie(0); ios::sync_with_stdio(false);
  // freopen("input.txt", "r", stdin);

  string s; cin >> s;
  int b = 0;
  long long ans = 0;
  REP(i, s.length()) {
    if (s[i] == 'B') ++b;
    else ans += b;
  }
  cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 720
import java.io.BufferedInputStream;
import java.math.BigInteger;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner in =new Scanner(new BufferedInputStream(System.in));
		while(in.hasNext())
		{
			BigInteger a = in.nextBigInteger(),b = in.nextBigInteger();
			System.out.println(a.add(b));
		}
		in.close();
	}

}


Measured memory_bytes: 75600
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define y1 zzz
#define fi first
#define se second
#define PII pair<int,int>
#define PII2 pair<int,PII >
#define PII3 pair<PII,int >
#define PII4 pair<PII,PII >
#define all(x) (x).begin(),(x).end()
#define pb push_back
int a[100010],n;
void solve()
{
    cin>>n;
    for(int i=1;i<=n;i++)cin>>a[i];
    for(int i=1;i<=n;i++)
        if(a[i]&1)
        {
            cout<<"first";
            return;
        }
    cout<<"second";
}
int32_t main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
    //freopen("XORQUERY.inp","r",stdin);
    //freopen("XORQUERY.out","w",stdout);
    //int test;cin>>test;while(test--)
    solve();
    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;
typedef long long ll;
using namespace std;
const ll mod=998244353;
template <class T>inline T lcm(T a,T b){return (a*b/__gcd(a,b));}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin>>n;
    int m=n/2;
    double ans=(double)m/(double)n;
    doublecout(1-ans);
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#define ll long long int
#define ld long double
#define pi acos(-1)
#define pb push_back
using namespace std;

int main()
{
    ll i,j,a,k,b,c,n,t,m,p,q,d,e,f,y,g,z,h,r,l,x;
    ld aa,bb,ee,dd,ff,kk,gg;
   vector<ll > v,s,vv;
//    map<ll, ll > ta,pa,sa,ma;
//    map<ll,vector<ll>  > me;
//    priority_queue<ll > aq,tq,pq,nq,mq,xq;
  string st,et,ft,pt,ct;
//    deque<ll> de,ne;
//    set<ll> li;
    ios_base::sync_with_stdio(false);
//    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);
    cin>>n;
    c = 0;
    for(i=0;i<n;i++){
        cin>>a;
        v.pb(a);
    }
    for(i=1;i<n;i++){
        if(v[i-1]>v[i]){
            c = c+v[i-1]-v[i];
            v[i] = v[i-1];
        }
    }
    cout<<c<<endl;
}


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

int main() {
  int A, B, C, D;
  cin >> A >> B >> C >> D;
  
  int L = A + B;
  int R = C + D;
  
  if (L > R) {
    cout << "Left" << endl;
  }
  else if (L == R) {
    cout << "Balanced" << endl;
  }
  else {
    cout << "Right" << endl;
  }
}


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

#define REP(i,n) for(int (i)=0;(i)<(n);(i)++)
#define REP2(i,s,n) for(int (i)=(s);(i)<(n);(i)++)


int main(){
	int n;
	int i,j;
	int temp;
	int dx[4] = {-1,0,0,1};
	int dy[4] = {0,-1,1,0};

	scanf("%d",&n);

	int a[n];
	int all = 1;
	int bad = 1;
	REP(i,n){
		scanf("%d",a+i);
		all *= 3;
		if(a[i]%2==0){
			bad *=2;
		}
	}

	printf("%d\n",all-bad);

	return 0;
}

Measured memory_bytes: 256
<?php

//文字列の入力
fscanf(STDIN,"%s",$n);
fscanf(STDIN,"%s",$s);

$mojis =str_split($s);
$a = "";
$count = 0;

foreach ($mojis as $moji){
    if ($a !== $moji) $count++;
        $a = $moji;
}

echo $count;



Measured memory_bytes: 21132
dict = {}

N = int(input())

for i in range(N):
    s = str(input())
    if  (s in dict.keys())== False:
        dict.setdefault(s,1)
    else:
        dict[s] += 1

M = int(input())

for j in range(M):
    t = str(input())
    if (t in dict.keys())== False:
        dict.setdefault(s,-1)
    else:
        dict[t] -= 1

        
m = 0
for k in dict:
    m = max(dict[k],m)

print(m)

Measured memory_bytes: 3064
#include<iostream>
#include<math.h>
#include<algorithm>
#include<stdint.h>
#include<vector>
#include<deque>
#include<stack>
#include<string>
#include<cstring>
#include<time.h>
#include<array>
#include<iomanip>
#include<list>
#include<set>
#include<unordered_map>
#include<unordered_set>
#include<random>
#include<bitset>
#include <queue>
#include <map>


using namespace std;
using ll = long long;
using ull = unsigned long long;
using uint = unsigned int;
using ldouble = long double;


//BDD,ZDD,kdtree, bdtree,bicalc, bolonoy, doloney,chinesemod,segmenttree,daikusutora, saidairyuu, 2bugurahu, heirokenshutu, topologicalsort, kyourenketuseibun


#define PRI(s) cout << s << endl
#define PRIY PRI("Yes")
#define PRIN PRI("No")


int main() {
	string s, t;
	cin >> s >> t;
	int a, b;
	cin >> a >> b;
	string u;
	cin >> u;
	if (s == u) a--;
	else b--;
	PRI(a << " " << b);
	return 0;
}

Measured memory_bytes: 3600
s = input()

cnt = 0
max_cnt = 0

for i in range(len(s)):
    if s[i] == 'A' or s[i] == 'C' or s[i] == 'G' or s[i] == 'T':
        j = i
        cnt = 0
        while j < len(s) and (s[j] == 'A' or s[j] == 'C' or s[j] == 'G' or s[j] == 'T'):
            cnt += 1
            j += 1
        max_cnt = max(max_cnt, cnt)

print(max_cnt)

Measured memory_bytes: 3064
import sys
input = lambda : sys.stdin.readline().rstrip()

n, m = map(int, input().split())
s = []
for _ in range(m):
    k, *a = map(int, input().split())
    s.append(a)
p = list(map(int, input().split()))

ans = 0

for i in range(2**n):
    i_bin = bin(i)[2:].zfill(n)
    flag = 1
    for j in range(m):
        cnt = 0
        for k in s[j]:
            if i_bin[k - 1] == "1":
                cnt += 1
        if cnt % 2 != p[j]:
            flag = 0
            break
    if flag:
        ans += 1

print(ans)



Measured memory_bytes: 40816
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define FOR(i,x,n) for(int i=x; i<(n); i++)
#define ALL(n) begin(n),end(n)
#define MOD (1000000007)
#define INF (1e9)
#define INFL (1e18)

typedef long long ll;
typedef unsigned int ui;
typedef unsigned long long ull;
template<class T>using arr=vector<vector<T>>;
template<class T>int popcount(T &a){int c=0; rep(i, 8*(int)sizeof(a)){if((a>>i)&1) c++;} return c;}
template<class T>void pr(T x){cout << x << endl;}
template<class T>void prvec(vector<T>& a){rep(i, a.size()-1){cout << a[i] << " ";} pr(a[a.size()-1]);}
template<class T>void prarr(arr<T>& a){rep(i, a.size()) if(a[i].empty()) pr(""); else prvec(a[i]);}
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

int main()
{
    string s; cin >> s;
    int k; cin >> k;
    int keta = s.size();

    if(k > keta){
        pr(0);
        return 0;
    }

    int d[101][4]={};
    FOR(i, 1, 101){
        FOR(j, 1, 4){
            if(j==1) d[i][j] = 9;
            else{
                int sec, thi;
                if(j > i) continue;
                if(j==2) d[i][j] = 9 * (i-1) * 9;
                if(j==3) d[i][j] = 9 * (i-1) * (i-2) * 9 * 9 / 2;
            }
        }
    }

    int ans = 0;
    FOR(i, 1, keta) ans += d[i][k];

    int a, b, c;
    a = s[0] - '0';
    if(keta>=2) b = s[1] - '0';
    if(keta>=3) c = s[2] - '0';

    if(k==1){
        ans += a;
        pr(ans);
        return 0;
    }

    if(k==2){
        if(b>0) ans += a * (keta-2) * 9;
        else {
            if(c>0) ans += a * (keta-3) * 9;
            ans += (a-1) * 9;;
            ans += c;
        }
        ans += (a-1) * 9 + b;
        pr(ans);
        return 0;
    }

    if(k==3){
        if(b>0 && c>0) ans += a * (keta-2) * (keta-3) * 9 * 9 / 2;

        int sec = 0;
        if(b>0) {
            sec += (a-1) * 9 * 9;
            sec += b * 9;
            sec *= keta-3;
            ans += sec;
        }

        sec = 0;
        sec += (a-1) * 9 * 9;
        if(b>0) sec += (b-1) * 9;
        sec += c;
        ans += sec;

        if(b==0 && c==0){
            int t = keta;
            FOR(i, 2, t){
                if(s[i]!='0'){
                    a = s[i] - '0';
                    b = s[i+1] - '0';
                    keta = keta - i;
                    FOR(j, 1, keta) ans += d[j][2];
                    if(b>0) ans += a * (keta-2) * 9;
                    ans += (a-1) * 9 + b;
                    break;
                } 
            }
        }

        pr(ans);
        return 0;
    }

    return 0;}

Measured memory_bytes: 3632