akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<map>
#include<cstdio>
#include<stack>
#include<queue>
#include<fstream>
#include<cstdio>

using namespace std;
#define ok1 printf("ok1\n");
#define ok2 printf("ok2\n");
#define M 1000000
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=(s);i<(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(g);(i)--)
#define all(a) (a).begin(),(a).end()
#define reall(a) (a).rbegin(),(a).rend()
#define pb push_back
#define MIN(a,b) a=min((a),(b))
#define MAX(a,b) a=max((a),(b))
#define SIZE(v) (int)v.size()


typedef vector<int> vi;
typedef vector<string> vs;
typedef long long ll;
typedef vector<ll> vll;

#ifdef TESTING
#define DEBUG fprintf(stderr,"====TESTING====\n")
#define VALUE(x) cerr << "The value of " << #x << " is " << x << endl
#define debug(...) fprintf(stderr, __VA_ARGS__)
#else
#define DEBUG 
#define VALUE(x)
#define debug(...)
#endif
/*
inline string IntToString(ll a) {
	char x[100];
	sprintf_s(x, "%lld", a); string s = x;
	return s;
}

inline ll StringToInt(string a) {
	char x[100]; ll res;
	strcpy_s(x, a.c_str()); sscanf_s(x, "%lld", &res);
	return res;
}
*/

inline string uppercase(string s) {
	int n = SIZE(s);
	rep(i, n) if (s[i] >= 'a' && s[i] <= 'z') s[i] = s[i] - 'a' + 'A';
	return s;
}

inline string lowercase(string s) {
	int n = SIZE(s);
	rep(i, n) if (s[i] >= 'A' && s[i] <= 'Z') s[i] = s[i] - 'A' + 'a';
	return s;
}


int main()
{
	int a;
	cin >> a;
	cout << a / 3<<endl;
	return 0;
}


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

using ll = long long;
using ull = unsigned long long;
using ld = long double;
#define REP(NAME, NUM) for (int NAME = 0; NAME < (NUM); ++NAME)
#define BREP(NAME, NUM) for (int NAME = (NUM)-1; NAME >= 0; --NAME)
#define ALL(NAME) (NAME).begin(), (NAME).end()
#define VEC(TYPE, A, NAME, INIT) vector<TYPE> NAME(A, INIT)
#define VEC2(TYPE, A, B, NAME, INIT) vector<vector<TYPE>> NAME(A, vector<TYPE>(B, (INIT)))

template <typename T>
T calcDigit(T input)
{
	return (T)( log2( (long double)( input ) ) + 1.l );
}

int main()
{
    ull n, k;
    cin >> n >>k;
    VEC(ull, n, a, 0);
    REP(i,n) cin >> a[i];
    
    ull d = calcDigit(k);
    bool isOK = false;
    BREP( i, d )
    {
        ull bit = 1ull << i;
        if( isOK || ( k & bit ) )
        {
            ull bn = 0;
            REP( i, n )
            {
                bn += ( a[i] & bit ) ? 1 : 0;
            }
            if( bn * 2ull < n )
            {
                REP( i, n )
                {
                    if( a[i] & bit ) a[i] -= bit;
                    else a[i] += bit;
                }
            }
            else isOK = true;
        }
    }

    ull ans = 0;
    REP(i,n) ans += a[i];
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1024
import sys
from collections import deque

read = sys.stdin.read
readline = sys.stdin.readline

H, W = map(int, readline().split())
s = tuple(map(str, read().split()))
INF = 10 ** 10
grid = [[INF] * W for _ in range(H)]
start = (0, 0)
queue = deque([start])
grid[0][0] = 0
while queue:
    x, y = queue.pop()
    for i, j in ((0, 1), (1, 0)):
        new_x = x + i
        new_y = y + j
        if new_x >= H or new_y >= W:
            continue
        else:
            if s[x][y] == '.' and s[new_x][new_y] == '#':
                cnt = grid[x][y] + 1
                if grid[new_x][new_y] > cnt:
                    grid[new_x][new_y] = cnt
                    queue.append((new_x, new_y))
            else:
                if grid[new_x][new_y] > grid[x][y]:
                    grid[new_x][new_y] = grid[x][y]
                    queue.append((new_x, new_y))

answer = grid[H - 1][W - 1]
if s[0][0] == '#':
    answer += 1
print(answer)


Measured memory_bytes: 3444
#include<stdio.h>
int main()
{
	char a[102][102],i,j,h,w;
	scanf("%d%d",&h,&w);
     for(i=1;i<=h;i++)
		 scanf("%s",&a[i][1]);
	 for(i=0;i<w+2;i++)
	 {
		 a[0][i]='#';
		 a[h+1][i]='#';
	 }
	 for(i=0;i<h+2;i++)
	 {
		 a[i][0]='#';
		 a[i][w+1]='#';
	 }
	 for(i=0;i<=h+1;i++)
	 {
		 for(j=0;j<=w+1;j++)
			 printf("%c",a[i][j]);
		 printf("\n");
	 }
	 return 0;
}

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

using namespace std;
using lli = int_fast64_t;
using ulli = uint_fast64_t;
#define debug(x) cerr << #x << " : " << x << endl
#define debugv(x) cerr << #x << " : {";for(auto value_of_x:x){ cerr << value_of_x << ", ";}cerr << endl
#define debugst(x) auto xt = x;cerr << #x << " : {";for(int i=0;i<x.size();i++){ cerr << xt.top() << ", ";xt.pop();}cerr << endl
#define debugvp(x) cerr << #x << " : {";for(auto value_of_x:x){ cerr << value_of_x.first << " : " << value_of_x.second << ", ";}cerr << endl
#define HYPP(x) hypot(x.first,x.second)

constexpr lli MOD = 1e9 + 7;
constexpr lli LIMIT = 1000000000000000000 * 5;
constexpr int tenfive = 100000;


int main() {
	int a, b, h;
	cin >> a >> b >> h;
	cout << (a + b) * h / 2 << endl;
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

void print(int n,int a[]){

  int i;
  for(i=0;i<n;i++){

    if(i) printf(" ");
    printf("%d",a[i]);

  }

  puts("");

}

int main(){

  int n,i;
  int a[1000];

  scanf("%d",&n);

  for(i=0;i<n;i++) scanf("%d",&a[i]);

  for(i=0;i<n;i++){

    int v=a[i];
    int j=i-1;

    for(;j>=0 && a[j]>v;j--) a[j+1]=a[j];

    a[j+1]=v;

    print(n,a);

  }

  return 0;

}



Measured memory_bytes: 2140
#include<stdio.h>
int main(){
    unsigned short x;
    unsigned short n;
    unsigned short i;
    scanf("%d", &n);
    for(i = 1;i <= n;i++){
        if(i % 3 == 0){
            printf(" %d", i);
            continue;
        }
        x = i;
        do{
            if(x % 10 == 3){
                printf(" %d", i);
                break;
            }
        x /= 10;
        }while(x);
    }
    printf("\n");
    return 0;
}


Measured memory_bytes: 2040
<?php

fscanf(STDIN, "%d", $n);

$nums = explode(' ',trim(fgets(STDIN)));

$max = $nums[0];
$sum = 0;
for ($i=1; $i < $n; $i++) { 
    if ($nums[$i] !== $max ){
        if ($nums[$i] > $max){
            $max = $nums[$i];
        } else {
            $sum += $max - $nums[$i];
        }
    }
}
echo $sum;


Measured memory_bytes: 31956
from sys import stdin

N = int(stdin.readline().rstrip())
S = stdin.readline().rstrip()

x = 0

maxv = 0

for i in range(N):
    if S[i] == 'I':
        x += 1
        if x > maxv:
            maxv = x
    if S[i] == 'D':
        x -= 1

print(maxv)


Measured memory_bytes: 2940
main=do
    [n,a,b]<-map read.words<$>getLine::IO[Int]
    print $ s n a b
s n a b
    | a>b = 0
    | a==b = 1
    | n==1 = 0
    | n==2 = 1
    | otherwise = b*(n-2)-a*(n-2)+1


Measured memory_bytes: 508
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#pragma GCC optimize("Ofast")
//*********************************************DO IT NOW****************************************************************
#include<bits/stdc++.h> 
#include<random>
#define int long long   
#define pp pair<int,int> 
#define ss second 
#define ff first 
#define pb push_back
#define mod 1000000007
#define pi 3.14159265359
#define mk(arr,n,type)  type *arr=new type[n];
#define sl s1.length();
#define yes cout<< "YES"<<endl
#define no  cout<< "NO"<<endl
#define all(v) (v).begin(),(v).end()
#define s(v)   sort(v,v+n)
#define  mt mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define read(a,n) for(int i=0;i<n;i++)cin>>a[i]
#define print(a,n) for(int i=0;i<n;i++)cout<<a[i]<<" "
#define for1(i,a,n)  for(int i=0;i<n;i++)
#define rep(i, c) for(int i = 0; i < (int)c; i++)
using namespace std;
//**********************************************DO IT NOW***************************************************************
void fastio()
{  
  #ifndef ONLINE_JUDGE
  freopen("INPUT.txt","r",stdin);
  freopen("OUTPUT.txt","w",stdout); 
  #endif
  ios_base :: sync_with_stdio(false); 
  cin.tie(NULL) ; 
  cout.tie(NULL);
}
int dp[101][1001],ans1=1e9,dp1[1000001];
int num[10];
int a[1000000];
signed main()
{   
    fastio();
    int t=1;
  // cin>>t;
    while(t--)
    {  
        int a,b,c;
        cin>>a>>b>>c;
        int x=(b*a);
        cout<<x/2;
    }
}
    
// 🍪 🍪 🍪


Measured memory_bytes: 3648
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#include <bits/stdc++.h>
#define int long long
#define endl '\n'
#define null nullptr
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(), x.rend()
#define pb push_back
#define mp make_pair
#define test int t; cin>>t; while(t--)
#define FAST                          \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL)

using namespace std;

typedef vector<int> vi;
typedef vector<pair<int,int>> vii;
typedef pair<int,int> pii;
typedef unordered_map<int,int> mp;

const int mod = 1e9+7;

int solve(vector<string> &a,int n){

    unordered_map<string,int> f;

    for(auto str : a){
        int freq[26] = {0};
        for(auto ch : str) freq[ch-'a']++;
        string t = "";
        for(int x=0;x<26;x++) t.pb(freq[x]+'0');
        f[t]++;
    }

    int ans = 0;
    auto itr = f.begin();
    for( ; itr != f.end() ; itr++){
        int val = itr->second;
        ans += (val*(val-1)/2);
    }

    return ans;
}

int32_t main(){
    FAST;
    int n;  cin >> n;
    vector<string> a(n);
    for(int x=0;x<n;x++)    cin >> a[x];

    cout << solve(a,n) << endl;

    return 0;
}


Measured memory_bytes: 19236
import java.util.Scanner;

//AtCoder Beginner Contest 055 C
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long s = sc.nextLong();
		long c = sc.nextLong();

		long result = 0;
		if (c <= s * 2) {
			result = (long) Math.floor(c / 2);
			c = c % 2;
		} else {
			result = s;
			c = c - s * 2;
			result = result + (long) Math.floor(c / 4);
		}

		System.out.println(result);
		sc.close();
	}
}

Measured memory_bytes: 23508
#include<iostream>
#include<cmath>
using namespace std;
int main() {
    int h, w;
    cin >> h >> w;
    int a[25][25];
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            cin >> a[i][j];
        }
    }
    int ans;
    int tmp = 0;
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            tmp = 0;
            for (int k = 0; k < h; k++) {
                for (int l = 0; l < w; l++) {
                    int x = a[k][l] * abs(k - i);
                    int y = a[k][l] * abs(l - j);
                    tmp += (x < y) ? x : y;
                }
            }
            if (i == 0 && j == 0) ans = tmp;
            else ans = (tmp < ans) ? tmp : ans;
        }
    }
    cout << ans << endl;
    return 0;
}



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

template <class T>
using lim = numeric_limits<T>;

const int N = 40;
const int AB = 10;

int dp[N+1][N*AB+1][N*AB+1];
int main() {
	ios_base::sync_with_stdio(false) ;
	cin.tie(0);
	
	int n, ma, mb;
	cin >> n >> ma >> mb;
	
	// initialize to max
	// memset doesn't work for some reason
	for (int i = 0; i <= n; i++){
		for (int j =  0; j <= N*AB; j++){
			for (int k = 0; k <= N*AB; k++){
				dp[i][j][k] = lim<int>::max();
			} 
		}
	}

	dp[0][0][0] = 0;
	for (int i = 0; i < n; i++){
		int ta, tb, tc;
		cin >> ta >> tb >> tc;
		for (int j = 0; j <= N*AB-ta; j++){
			for (int k = 0; k <= N*AB-tb; k++){
				if (dp[i][j][k] == lim<int>::max()) continue;
				dp[i+1][j][k] = min(dp[i+1][j][k],dp[i][j][k]);
				dp[i+1][j+ta][k+tb] = min(dp[i+1][j+ta][k+tb],dp[i][j][k]+tc);
			}
		} 
	}
	
	int ans = lim<int>::max();
	for (int j = 1; j <= N*AB; j++){
		for (int k = 1; k <= N*AB; k++){
			if (j*mb == k*ma) {
				ans = min(ans, dp[n][j][k]);
			}
		}
	}
	
	cout << (ans==lim<int>::max() ? -1 : ans) << endl;
} 


Measured memory_bytes: 25984
#!/usr/bin/env pypy3

import collections
import itertools


INF = 10 ** 8
UNDEF = -1


def floyd_warshall_undirected(num_vs, edges):
    n = num_vs
    dist = [[INF for _ in range(n)] for _ in range(n)]
    pred = [[UNDEF for _ in range(n)] for _ in range(n)]
    for u in range(n):
        dist[u][u] = 0
    for (u, v), c in edges.items():
        dist[u][v] = c
        dist[v][u] = c
        pred[u][v] = u
        pred[v][u] = v
    for t, u, v in itertools.product(range(n), repeat=3):
        nl = dist[u][t] + dist[t][v]
        if nl < dist[u][v]:
            dist[u][v] = nl
            pred[u][v] = pred[t][v]
    return dist, pred


def construct_shortest_path(s, t, pred):
    path = collections.deque()
    path.appendleft(t)
    while t != s:
        t = pred[s][t]
        path.appendleft(t)
    return list(path)


def main():
    n, m = (int(x) for x in input().split())
    edges = dict()
    used = dict()
    for _ in range(m):
        a, b, c = (int(x) for x in input().split())
        a -= 1
        b -= 1
        a, b = min(a, b), max(a, b)
        edges[(a, b)] = c
        used[(a, b)] = False
    _, pred = floyd_warshall_undirected(n, edges)
    for s in range(n):
        for t in range(s + 1, n):
            path = construct_shortest_path(s, t, pred)
            for u, v in zip(path[:-1], path[1:]):
                u, v = min(u, v), max(u, v)
                used[(u, v)] = True
    ans = m - sum(used.values())
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 44396
#include<bits/stdc++.h>
using namespace std;
#define int long long
//#define M 1000000007
//#define M 998244353
const int inf=4e18;
vector<vector<int> > tree;
vector<int> in,out;
int n,M;
void dfs1(int s,int e)
{
	in[s]=1;
	for(int u:tree[s])
	{
		if(u==e)
			continue;
		dfs1(u,s);
		in[s]=in[s]*(in[u]+1)%M;
	}
}
void dfs2(int s,int e)
{
	int sz;
	if(s==1)
		sz=tree[s].size();
	else
		sz=tree[s].size()-1;
	int pre[sz+2],suff[sz+2],kids[sz+1];
	pre[0]=1;suff[sz+1]=1;
	int k=1;
	for(int u:tree[s])
	{
		if(u!=e)
			kids[k++]=u;
	}
	for(int i=1;i<=sz;i++)
		pre[i]=pre[i-1]*(in[kids[i]]+1)%M;
	for(int i=sz;i>=1;i--)
		suff[i]=suff[i+1]*(in[kids[i]]+1)%M;
	k=1;
	for(int u:tree[s])
	{
		if(u==e)
			continue;
		out[u]=(out[s]*pre[k-1]%M*suff[k+1]%M+1)%M;
		dfs2(u,s);
		k++;
	}
}
int32_t main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);cout.tie(NULL);
	cin>>n>>M;
	tree.resize(n+1);
	in.resize(n+1);out.resize(n+1);
	for(int i=0;i<n-1;i++)
	{
		int x,y;cin>>x>>y;
		tree[x].emplace_back(y);
		tree[y].emplace_back(x);
	}
	dfs1(1,0);
	out[1]=1;
	dfs2(1,0);
	for(int i=1;i<=n;i++)
		cout<<in[i]*out[i]%M<<'\n';
}

Measured memory_bytes: 23296
import java.util.Map;
import java.util.Scanner;
import java.util.TreeMap;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class Main {
public static void main(String[] args) {
  Scanner in = new Scanner(System.in);
  Pattern pt = Pattern.compile("th(?:is|e|at)");
  char[] abc = "abcdefghijklmnopqrstuvwxyz".toCharArray();
  char[] bcd = "zabcdefghijklmnopqrstuvwxy".toCharArray();
  Map<Character, Character> caesarCipher = new TreeMap<Character, Character>();
  for (int i = 0; i < abc.length; i++) {
	caesarCipher.put(abc[i], bcd[i]);
  }
  Matcher mt;
  while (in.hasNext()) {
	final String q = in.nextLine();
	String result = q;
	mt = pt.matcher(result);
	StringBuilder sb = new StringBuilder(q.length());
	while (!mt.find()) {
	  for (int i = 0; i < result.length(); i++) {
		char charAt = result.charAt(i);
		if (caesarCipher.containsKey(charAt)) {
		  sb.append(caesarCipher.get(charAt));
		} else {
		  sb.append(charAt);
		}
	  }
	  result = sb.toString();
	  mt.reset(result);
	  sb.delete(0, sb.length());
	}
	System.out.println(result);
  }
}
}

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

int main(){
    int s;
    cin>>s;
    vector<int> a(s);
    for(int i=0;i<s;i++){
        cin>>a[i];
    }
    sort(a.begin(), a.end());
    int ans = a[s/2] - a[(s-1)/2];
    cout<<ans<<"\n";
    return 0;
}


Measured memory_bytes: 640
import math


def get_distance(x1, y1, x2, y2) -> float:
    return math.sqrt(pow(x2 - x1, 2) + pow(y2 - y1, 2))


def get_area(a, b, c) -> float:
    return a * b * math.sin(c * math.pi / 180) / 2


def get_length(a, b, c) -> float:
    return a + b + math.sqrt(pow(a, 2) + pow(b, 2) - 2 * a * b * math.cos(c * math.pi / 180))


def get_height(b, c) -> float:
    return b * math.sin(c * math.pi / 180)


a, b, c = map(float, input().split(' '))
print(get_area(a, b, c))
print(get_length(a, b, c))
print(get_height(b, c))



Measured memory_bytes: 5696
#include <iostream>
#include<map>
#include <algorithm>
#include <vector>
#include <string>
#include <utility>
#include <queue>
#define INF 1e9+7
#define rep(i,n) for(int i=0;i<n;i++)
#define NO cout<<"NO"<<endl;
#define YES cout << "YES"<<endl;
#define No cout << "No"<<endl;
#define Yes cout << "Yes"<<endl;
#define all(a) a.begin(),a.end()
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;

//(int)'a'は97 (int)'A'は65 (int)'1'は49
//おまじない

int main(){
    
    int n;
    int m[20]={0};
    int ans=0,mm=0;
    cin >> n;
    rep(i,n){
        cin >> m[i];
    }
    
    rep(i,n){
        if(m[i]>=mm){
            ans++;
            mm=m[i];
        }
    }
    
    cout << ans<<endl;
    
    return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env python3
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf') ;mod = 10**9+7
mans = inf ;ans = 0 ;count = 0 ;pro = 1

a,b = map(int,input().split())
if a > 0:
  print("Positive")
elif a <= 0 and 0 <= b:
  print("Zero")
else:
  if (b-a) % 2 == 1:
    print("Positive")
  else:
    print("Negative")

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

int h, w;
int ch, cw;
int dh, dw;
vector<string> s;
int d[1010][1010]; // d[i][j] := (i, j)にいくまでに必要なワープ回数

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

int bfs(){

    memset(d, -1, sizeof(d));

    deque<P> que;
    que.push_front(P(ch, cw));
    d[ch][cw] = 0;

    while(!que.empty()){
        P p = que.front();
        que.pop_front();
        // 歩いていけるマス
        for(int i = 0; i < 4; i++){
            int ny = p.first + dy[i]; // (h, w) <-> (y, x)
            int nx = p.second + dx[i];
            if(ny < 0 || ny >= h || nx < 0 || nx >= w) continue;
            if(d[ny][nx] <= d[p.first][p.second] && d[ny][nx] > -1) continue; // <= 
            if(s[ny][nx] == '.'){
                d[ny][nx] = d[p.first][p.second];
                que.push_front(P(ny, nx));
            }
        }

        // ワープでいけるマス(もしかしたら後から歩いていけると判明するかも)
        for(int i = -2; i <= 2; i++){
            for(int j = -2; j <= 2; j++){
                if(i == 0 && j == 0) continue;
                if(i == 0 && (j == 1 || j == -1)) continue;
                if(j == 0 && (i == 1 || i == -1)) continue;
                int ny = p.first + i;
                int nx = p.second + j;
                if(ny < 0 || ny >= h || nx < 0 || nx >= w) continue;
                // if(d[ny][nx] < d[p.first][p.second] && d[ny][nx] > -1) continue;
                if(d[ny][nx] > -1) continue;
                if(s[ny][nx] == '.'){
                    d[ny][nx] = d[p.first][p.second] + 1;
                    que.push_back(P(ny, nx));
                }
            }
        }
    }
    return d[dh][dw];
}

int main(void){
    cin >> h >> w;
    cin >> ch >> cw; ch--; cw--;
    cin >> dh >> dw; dh--; dw--;

    s.resize(h);
    for(int i = 0; i < h; i++){
        cin >> s[i];
    }

    cout << bfs() << endl;
    return 0;
}

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

public class MainClass
{
	public const long Giri = 1000000007;
	public const long DpInf = 99999999999999;
	
	public static void Main(string[] args)
	{
		var s = Console.ReadLine().ToInt();
		var k = s /2;
		if(s%2!=0)k++;
		Console.WriteLine(k);
	}
	
	static long GCD(long a, long b)
	{
		var v = new[] { a, b };
		while (v[1] != 0) { v = new[] { v[1], v[0] % v[1] }; }
		return v[0];
	}
	public static string[] Input() { return Console.ReadLine().Split(); }
}

public static class Smarter
{
	public static int ToInt(this string str) { return int.Parse(str); }
	public static long ToLong(this string str) { return long.Parse(str); }
	public static int[] ToInt(this string[] str, int offset = 0)
	{
		var r = new int[str.Length];
		for(int i = 0; i < str.Length; i++) r[i] = str[i].ToInt() + offset;
		return r;
	}
}


Measured memory_bytes: 11092
#include<bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize ("-ffloat-store") // to restrict undesirable precision
#pragma GCC optimize ("-fno-defer-pop")// to pop argument of function as soon as it returns
#define all(a) a.begin(),a.end()
#define ll long long int
#define ld long double
ll power(ll a,ll b,ll m){ if(b==0) return 1; if(b==1) return a%m; ll t=power(a,b/2,m)%m; t=(t*t)%m; if(b&1) t=((t%m)*(a%m))%m; return t;}
ll modInverse(ll a, ll m) { return power(a, m-2, m); }
#define ps push_back
#define fs first
#define takeline cin.ignore();
#define sc second
#define N 3000005
#define endl "\n"
#define mod 1000000007
//((1.0l)*BIG MULTIPLY MAGIC?)
// string to integer stoi()
// string to long long stoll()
// string.substr(position,length);
// integer to string to_string();
//-----------------------------------------------
int main(){

	ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	
	ll a,b;
	cin>>a>>b;

	ll f,g,h;
	f=(a+b);
	g=(a-b);
	h=(a*b);
	cout<<max(f,max(g,h));
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
{
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    while(0<1){
        c-=b;
        if(c<=0){
            cout<<"Yes\n";
            break;
        }
        a-=d;
        if(a<=0){
            cout<<"No\n";
            break;
        }
    }
}

Measured memory_bytes: 3600
#include<iostream>
#include<vector>
#include<map>
using namespace std;

typedef long long ll;

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

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

const int MAX_DEPTH = 50;
int data[8];
int dx[4] = {-4,1,-1,4};

int abs(int x){
	if( x>0 )
		return x;
	return -x;
}

//評価関数(マンハッタン距離。枝刈用)
int check()
{
	int i,j;
	int s = 0;
	for( i = 1; i < 8; i++ ){
		for( j = 0; j < 8; j++ ){
			if( data[j] == i )
				break;
		}
		s += abs(j/4 - i/4) + abs(j%4 - i%4);
	}
	return s;
}

//実体(ちなみにtrueが返えるのは、最下層の呼び出し時であることがIDA()関数より保障される。)
//t,uは1手前に値をswapしたインデックスの番号
bool func( int depth,int maxdepth,int t,int u )
{
	int i,j;
	
	/*cout << depth << " " << maxdepth << " " << check() << endl;
	for( i = 0;i < 8;i++ ){
		cout << data[i] << " ";
	}
	cout << endl;*/
	
	//枝刈とか
	if( depth > maxdepth )
		return false;
	if( check() == 0 )
		return true;
	if( check() + depth > maxdepth )
		return false;
		
	for( i = 0;i < 8;i++ ){
		if( data[i] == 0 )
			break;
	}
	//0はi番目にある。4方向を考える
	for( j = 0;j < 4;j++ ){
		if( i+dx[j] < 0 || i+dx[j] > 7 || ( (i+dx[j])%4 - i%4 )*dx[j] < 0 )
			continue;
		if( (data[i] == t && data[i+dx[j]] == u) || (data[i] == u && data[i+dx[j]] == t) )
			continue;
		swap( data[ i ],data[ i+dx[j] ] );
		if( func( depth+1,maxdepth,data[ i ],data[ i+dx[j] ] ) )
			break;
		swap( data[ i ],data[ i+dx[j] ] );
	}
	if( j < 4 )
		return true;
	return false;
}

//詰将棋パターンを枝刈しているだけな、全探索に毛が生えた程度のIDA*。
int IDA(){
	int i;
	for( i = 0; i < MAX_DEPTH; i++ ){
		if( func( 0,i,0,0 ) )
			break;
	}
	return i;
}

int main(){
	int i;
	
	while( cin >> data[0] )
	{
		for( i = 1;i < 8;i++ )
			cin >> data[i];
				
		cout << IDA() << endl;
	}
	return 0;
}

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

const int64_t MOD = 1000000007;
typedef int64_t ll;
typedef uint64_t ull;

#define INF LLONG_MAX

#define FOR(i, start, end) for(uint64_t i=start; i<end; i++)
#define REP(i, n) FOR(i, 0, n)

// 最大公約数gcd
// 最小公倍数lcm=m*n/gcd
uint64_t gcd(uint64_t m, uint64_t n) {
  uint64_t temp;
  while (m % n != 0){
    temp = n;
    n = m % n;
    m = temp;
  }
  return n;
}

uint64_t lcm(uint64_t m, uint64_t n) {
  return (m*n)/gcd(m,n);
}

// vector<vector<uint64_t> > v(n+1, vector<uint64_t>(n+1, 0))
// v[n][k]に組み合わせ数が入る。
void comb(vector<vector <uint64_t> > &v){
  for(uint64_t i = 0;i <v.size(); i++){
    v[i][0]=1;
    v[i][i]=1;
  }
  for(uint64_t k = 1;k <v.size();k++){
    for(uint64_t j = 1;j<k;j++){
      v[k][j]=(v[k-1][j-1]+v[k-1][j]);
    }
  }
}

// 掛け算オーバーフロー判定
bool is_product_overflow(uint64_t a, uint64_t b) {

	uint64_t prod = a * b;
	
	return (prod / b != a);
}

//素因数分解
void primeFactorization(uint64_t a, list<uint64_t> &factors){ //素因数分解を出力するプログラム
  long i,sq;
  if(a%2==0){ //偶数の場合
    factors.push_back(2);
    primeFactorization(a/2,factors); //2で割った値で再帰
    return;
  }
  sq = sqrt(a);
  for(i=3;i<=sq;i+=2){ //3以上√a以下の奇数の場合
	if(a%i==0){
	  factors.push_back(i);
      primeFactorization(a/i,factors); //割れた値で再帰
      return;
	}
  }
  //偶数でも3以上√a以下の奇数の場合でも割り切れない場合
  if(a!=1){ //aが1でないなら、a自身は素数
    factors.push_back(a);
  }
}

// フェルマーの小定理
// mod. m での a の逆元 a^{-1} を計算する
// (a/b)%m = a*movinv(b,m)%m  
int64_t modinv(int64_t a, int64_t m) {
    int64_t b = m, u = 1, v = 0;
    while (b) {
        int64_t t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}

// 円周率
// M_PI

// #include <iomanip> // setprecisionを使用するのに必要
// cout << std::fixed << std::setprecision(15) << y << endl;

// 昇順
// priority_queue<int, vector<int>, greater<int> > queue;

signed main() {
  int h,w,d;
  
  vector< vector<int> > c(3,vector<int>(3));
  for(int i=0;i<3;i++){
    for(int j=0;j<3;j++){
      cin >> c[i][j];
    }
  }
  
  int colDiff[2] = {};
  int rowDiff[2] = {};
  for(int i=0;i<2;i++){
    colDiff[i] = c[0][i]-c[0][i+1];
    rowDiff[i] = c[i][0]-c[i+1][0];
  }

  for(int i=1;i<3;i++){
    for(int j=0;j<2;j++){
      // column
      if( (c[i][j]-c[i][j+1]!=colDiff[j])
        || (c[j][i]-c[j+1][i]!=rowDiff[j]) ){
        cout << "No" << endl;
        return 0;
      }
    }
  }
  cout << "Yes" << endl;
  
  // a1+b1 a1+b2 a1+b3
  // a2+b1 a2+b2 a3+b3
  
  return 0;
}



Measured memory_bytes: 3628
def iread():
    return int(input())


def sread():
    return input()


def aread(t="int"):
    if t == "int":
        ret = [int(i) for i in input().split()]
    elif t == "str":
        ret = list(input())
    return ret


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


def main():
    forecast = sread()
    wethar = sread()
    cnt = 0
    for i in range(3) :
        if forecast[i] == wethar[i]:
            cnt += 1
    print(cnt)
    

if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
N, M = map(int, input().split())
s_list = [list(map(int, input().split()))[1:] for i in range(M)]
p_list = list(map(int, input().split()))

ans = 0
def isAllOn(switches):
    for i in range(M):
        s = s_list[i]
        p = p_list[i]
        cnt = 0
        for idx in s:
            cnt += switches[idx-1]
        if cnt % 2 != p:
            return False
    return True


def bfs(stack):
    global ans
    global N
    if len(stack) == N:
        if isAllOn(stack):
            ans += 1
        return

    for i in [0, 1]:
        _stack = stack[::]
        _stack.append(i)
        bfs(_stack)

bfs([])
print(ans)

Measured memory_bytes: 43500
import math
from math import gcd
INF = float("inf")

import sys
input=sys.stdin.readline
sys.setrecursionlimit(500*500)
import itertools
from collections import Counter,deque

def main():
    n = int(input())
    l = list(map(int, input().split()))
    c = list(itertools.combinations(l, 3))
    cnt = 0
    for i in c:
        if i[0] == i[1] or i[1] == i[2] or i[0] == i[2]: # 辺の長さ同じ
            continue
        if i[0]+i[1]>i[2] and i[1]+i[2]>i[0] and i[2]+i[0]>i[1]:
            cnt += 1
    print(cnt)



if __name__=="__main__":
    main()


Measured memory_bytes: 88972
using System;

class Program{
	static void Main(string[] args){
    	int N = int.Parse(Console.ReadLine());
      
      	string[] type = new string[N];
      	double[] Price = new double[N];
      	
      double Value = 0;
      
      	for(int i = 0;i < N;i ++){
        	string[] input = Console.ReadLine().Split(' ');
          	//type[i] = input[1];
          	//Price[i] = int.Parse(input[0]);
          
          if(input[1] == "JPY")Value = Value + double.Parse(input[0]);
          else Value = Value + (double.Parse(input[0]) * 380000.0);
        }
      Console.WriteLine(Value);
      	
    }
}

Measured memory_bytes: 13140
n = int(input())
w = [input() for _ in range(n)]

for i in range(1, n):
    for j in range(i):
        if w[j] == w[i]:
            print('No')
            exit()
    if w[i][0] != w[i-1][-1]:
        print('No')
        exit()
print('Yes')

Measured memory_bytes: 3060
N, M = map(int, input().split())
g = [[] for i in range(N)]
for i in range(M):
	a, b = map(int, input().split())
	g[a-1].append(b-1)
	g[b-1].append(a-1)

ans = 0
passed = [0]
n = 0
s = [[n,passed]]
while s:
	n, passed = s.pop()
	if len(passed) == N:
		ans += 1
	else:
		for i in g[n]:
			if i not in passed:
				s.append([i, passed + [i]])
print(ans)

Measured memory_bytes: 3064
from itertools import product
N = int(input())
a = list(map(int,input().split()))
#L, R, d=map(int,input().split())
#C = []
# for i in range(N):
#    C.append((input().replace(".","0").replace("#","1")))
# S=list(map(int,input().split()))
# B=list(map(int,input().split()))
count = 0
for i in range(N):
    if (i+1) %2 != 0 and a[i] %2 !=0:
        count+=1

print(count)




Measured memory_bytes: 9036
S = str(input())

if len(S)%2 == 0:
    mid = int(len(S)/2)
else:
    mid = int(len(S)/2) + 1

left = S[:mid][::-1]
right = S[-mid:]

count = 0
for i in range(mid):
    if left[i] != right[i]:
        count = count + 1

print(count)

Measured memory_bytes: 3064
import java.util.*; import java.io.*; import java.math.*;
public class Main{
	static void solve(){//Here is the main function
		int N = nextInt();
		if(N % 2 == 0){
			myout(N / 2 - 1);
		}else{
			myout(N / 2);
		}
	}
	//Method addition frame start



	//Method addition frame end

	//Don't have to see. start------------------------------------------
	static class InputIterator{
		ArrayList<String> inputLine = new ArrayList<String>(1024);
		int index = 0; int max; String read;
		InputIterator(){
			BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
			try{
				while((read = br.readLine()) != null){
					inputLine.add(read);
				}
			}catch(IOException e){}
			max = inputLine.size();
		}
		boolean hasNext(){return (index < max);}
		String next(){
			if(hasNext()){
				return inputLine.get(index++);
			}else{
				throw new IndexOutOfBoundsException("There is no more input");
			}
		}
	}
	static HashMap<Integer, String> CONVSTR = new HashMap<Integer, String>();
	static InputIterator ii = new InputIterator();//This class cannot be used in reactive problem.
	static PrintWriter out = new PrintWriter(System.out);
	static void flush(){out.flush();}
	static void myout(Object t){out.println(t);}
	static void myerr(Object t){System.err.print("debug:");System.err.println(t);}
	static String next(){return ii.next();}
	static boolean hasNext(){return ii.hasNext();}
	static int nextInt(){return Integer.parseInt(next());}
	static long nextLong(){return Long.parseLong(next());}
	static double nextDouble(){return Double.parseDouble(next());}
	static ArrayList<String> nextStrArray(){return myconv(next(), 8);}
	static ArrayList<String> nextCharArray(){return myconv(next(), 0);}
	static ArrayList<Integer> nextIntArray(){
		ArrayList<String> input = nextStrArray(); ArrayList<Integer> ret = new ArrayList<Integer>(input.size());
		for(int i = 0; i < input.size(); i++){
			ret.add(Integer.parseInt(input.get(i)));
		}
		return ret;
	}
	static ArrayList<Long> nextLongArray(){
		ArrayList<String> input = nextStrArray(); ArrayList<Long> ret = new ArrayList<Long>(input.size());
		for(int i = 0; i < input.size(); i++){
			ret.add(Long.parseLong(input.get(i)));
		}
		return ret;
	}
	@SuppressWarnings("unchecked")
	static String myconv(Object list, int no){//only join
		String joinString = CONVSTR.get(no);
		if(list instanceof String[]){
			return String.join(joinString, (String[])list);
		}else if(list instanceof ArrayList){
			return String.join(joinString, (ArrayList)list);
		}else{
			throw new ClassCastException("Don't join");
		}
	}
	static ArrayList<String> myconv(String str, int no){//only split
		String splitString = CONVSTR.get(no);
		return new ArrayList<String>(Arrays.asList(str.split(splitString)));
	}
	public static void main(String[] args){
		CONVSTR.put(8, " "); CONVSTR.put(9, "\n"); CONVSTR.put(0, "");
		solve();flush();
	}
	//Don't have to see. end------------------------------------------
}


Measured memory_bytes: 32996
#include <iostream>
#include <cstdio>
#include <queue>
#include <deque>
using namespace std;
int n,k,f1[1000][1000],f2[1000][1000],a[1000];bool b1[1000][1000],b2[1000][1000];
void readdata()
{
    cin>>n>>k;
    for (int i=1;i<=n;i++) cin>>a[i];
}

void calleft()
{
    b1[0][0]=true;
    f1[0][0]=0;
    for (int i=1;i<=n;i++)
    {
        for (int j=1;j<=k;j++)
        {
            if (b1[i-1][j-1])
            {
                f1[i][j]=max(f1[i][j],f1[i-1][j-1]+a[i]);
                b1[i][j]=true;
            }
            if (j>1)
            {
                if (b1[i-1][j-2])
                {
                    f1[i][j]=max(f1[i][j],f1[i-1][j-2]);
                    b1[i][j]=true;
                }
            }
        }
    }
}

void calright()
{
    b2[n+1][0]=true;
    f2[n+1][0]=0;
    for (int i=n;i>=1;i--)
    {
        for (int j=1;j<=k;j++)
        {
            if (b2[i+1][j-1])
            {
                f2[i][j]=max(f2[i][j],f2[i+1][j-1]+a[i]);
                b2[i][j]=true;
            }
            if (j>1)
            {
                if (b2[i+1][j-2])
                {
                    f2[i][j]=max(f2[i][j],f2[i+1][j-2]);
                    b2[i][j]=true;
                }
            }
        }
    }
}

void genner()
{
    for (int i=0;i<=n+1;i++)
    {
        for (int j=0;j<=k;j++)
        {
            f1[i][j]=-1e9;
            f2[i][j]=-1e9;
        }
    }
}

void solve()
{
    genner();
    calright();
    calleft();
    int max1=0;
    for (int i=0;i<=n;i++)
    {
        for (int h1=0;h1<=k;h1++)
        {
            for (int j=n+1;j>i;j--)
            {
                for (int h2=0;h2<=k-h1;h2++)
                {
                    max1=max(max1,f1[i][h1]+f2[j][h2]);
                }
            }
        }
    }
    cout<<max1;
}

int main()
{
    //freopen("a.inp","r",stdin);
   // freopen("a.out","w",stdout);
    readdata();
    solve();
    return 0;
}


Measured memory_bytes: 4480
while True:
	h,w = map(int,input().split())
	if h==0 and w==0:
		break
	for i in range(h):
		if i%2==0:
			for j in range(w):
				if j%2==0:
					print('#',end='')
				else:
					print('.',end='')
			print()
		else:
			for j in range(w):
				if j%2==0:
					print('.',end='')
				else:
					print('#',end='')
			print()
	print()


Measured memory_bytes: 7008
N = int(input())
A=[]
A.append(1)
for i in range(1,7):
    A.append(6**i)
for i in range(1,6):
    A.append(9**i)
A.sort()
dp=[10*5+5]*(N+1)
dp[0]=0
for i in range(1,N+1):
    for s in range(len(A)):
        if i-A[s]>=0:
            dp[i]=min(dp[i-A[s]]+1,dp[i])
print(dp[N])


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

int main(){
  int n;  cin >> n;
  string s;  cin >> s;
  
  int ans = 0;
  for(int i=0; i<1e3; i++){
    int tens = 100, pin = i, pos = 0;
    bool ok = false;
    do{
      while(pos<n && (int)s[pos]-(int)'0'!=(pin/tens%10))  pos++;
      if(pos >= n)  break;
      tens /= 10;
      if(tens == 0)  ok = true;
      pos++;
    }while(tens);
    if(ok)  ans++;
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3684
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod = 1e9+7;
const int maxn = 2e3+5;
int a[maxn];
int main()
{
    int x,y;
    while(cin>>x>>y)
    {
        if(x < y)cout<<0<<endl;
        else cout<<10<<endl;
    }
}




















Measured memory_bytes: 256
input()
seq = list(map(int, input().rstrip("\n").split()))

iter_ = iter(seq)
ans1 = 0
for i, num in enumerate(iter_):
    if i == 0:
        sum_ = num
        if sum_ > 0:
            pass
        else:
            ans1 += abs(sum_ - 1)
            sum_ = 1
    else:
        sum_ += num
        if i % 2:
            if sum_ < 0:
                pass
            else:
                ans1 += abs(sum_ + 1)
                sum_ = -1
        else:
            if sum_ > 0:
                pass
            else:
                ans1 += abs(sum_ - 1)
                sum_ = 1

iter_ = iter(seq)
ans2 = 0
for i, num in enumerate(iter_):
    if i == 0:
        sum_ = num
        if sum_ < 0:
            pass
        else:
            ans2 += abs(sum_ + 1)
            sum_ = -1
    else:
        sum_ += num
        if i % 2:
            if sum_ > 0:
                pass
            else:
                ans2 += abs(sum_ - 1)
                sum_ = 1
        else:
            if sum_ < 0:
                pass
            else:
                ans2 += abs(sum_ + 1)
                sum_ = -1

print(min(ans1, ans2))


Measured memory_bytes: 14332
#include <bits/stdc++.h>
#define ll long long int
#define ld long double
#define f first
#define s second
#define pb push_back
#define eb emplace_back
#define mk make_pair
#define mt make_tuple
#define MOD 998244353
#define fo(i,a,b) for(i=a;i<b;i++)
#define foe(i,a,b) for(i=a;i<=b;i++)
#define all(x) x.begin(), x.end()
#define vi vector<int>
#define vl vector <long long int>
#define pii pair <int,int>
#define pll pair <long long int, long long int>
#define vpii vector< pair<int,int> >
#define vpll vector < pair <long long int,long long int> >
#define boost ios::sync_with_stdio(false); cin.tie(0)
using namespace std;
const int inf = 1e9 + 5;
const ll inf64 = 1e18 + 5;

int main()
{
	boost;
	ll n, x, m, i;
	cin >> n >> x >> m;
	
	unordered_map <ll, ll> mp;
	mp[x] = 0;
	
	vector <ll> v;
	v.pb(x);
	
	ll ind = -1;
	fo(i, 1, n) {
		x = (1LL * x * x) % m;
		if(mp.find(x) != mp.end()) {
			ind = mp[x];
			break;
		}
		mp[x] = i;
		v.pb(x);
	}
	if(ind == -1) cout << accumulate(all(v), 0ll);
	else {
		ll ans = accumulate(all(v), 0ll);
		ll rem = n - v.size();
		ll num = v.size() - mp[x];
		
		ll sum = accumulate(v.begin() + ind, v.end(), 0ll);
		ans += sum * (rem / num);
		
		if(rem % num) ans += accumulate(v.begin() + ind, v.begin() + ind + rem % num, 0ll);
		cout << ans;
	}
}


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

using namespace std;

typedef long long ll;

int main()
{
    int a , b , c , d;
    string str;
    cin >> str;

    a = str[0]-'0';
    a = a*10 + str[1]-'0';

    b = str[2]-'0';
    b=  b*10 + str[3]-'0';

    // cout << a << "  "   << b << endl;

    if( (a <= 0 || a > 12) && (b >= 1 && b <= 12) )
    {
        printf("YYMM\n");
    }
    else if ( (b <= 0 || b > 12) && (a >= 1 && a <= 12) )
    {
        printf("MMYY\n");
    }
    else if( (a >= 1 && a <= 12) && (b >= 1 && b <= 12) )
    {
        printf("AMBIGUOUS\n");
    }
    else
    {
        printf("NA\n");
    }



    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int fact(int n)
{
  if(n==0)return 1;
  return n*fact(n-1);
}
int main()
  {
    int n;
    cin>>n;
    vector<int>a,b;
    int j,k;
    for(int i=0;i<n;i++)
    {
        cin>>j;
        a.push_back(j);
    }
    for(int i=0;i<n;i++)
    {
        cin>>j;
        b.push_back(j);
    }
    int i,p[n],q[n];
    int f=0;
    for(i=0;i<n;i++)
    {
        for(j=i-1;j>=0;j--)
        {
            if(a[j]<a[i])
            f++;
        }
        p[i]=f;
        f=0;
    }
    f=0;
    for(i=0;i<n;i++)
    {
        for(j=i-1;j>=0;j--)
        {
            if(b[j]<b[i])
            f++;
        }
        q[i]=f;
        f=0;
    }
    
    int c=0,d=0;
    for( i=0;i<n;i++)
    {
     
        c+=(a[i]-p[i]-1)*(fact(n-i-1));
      
    }
    for( i=0;i<n;i++)
    {
      
        d+=(b[i]-q[i]-1)*(fact(n-i-1));
      
    }
    cout<<abs(c-d)<<endl;
    
    
  }
  

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

class Main
{
	public static void main(String[] args) throws IOException
	{
		Scan in = new Scan();
		Print out = new Print();
		int r = in.scanInt();
		out.println(2*Math.PI*r);
		out.close();
	}
}

class Scan
{
	private byte[] buf=new byte[1024];
	private int index;
	private InputStream in;
	private int total;
	public Scan()
	{
		in=System.in;
	}
	public int scan()throws IOException
	{
		if(total<0)
			throw new InputMismatchException();
		if(index>=total)
		{
			index=0;
			total=in.read(buf);
			if(total<=0)
				return -1;
		}
		return buf[index++];
	}
	public int scanInt()throws IOException
	{
		int integer=0;
		int n=scan();
		while(isWhiteSpace(n))
			n=scan();
		int neg=1;
		if(n=='-')
		{
			neg=-1;
			n=scan();
		}
		while(!isWhiteSpace(n))
		{
			if(n>='0'&&n<='9')
			{
				integer*=10;
				integer+=n-'0';
				n=scan();
			}
			else throw new InputMismatchException();
		}
		return neg*integer;
	}
	public double scanDouble()throws IOException
	{
		double doub=0;
		int n=scan();
		while(isWhiteSpace(n))
			n=scan();
		int neg=1;
		if(n=='-')
		{
			neg=-1;
			n=scan();
		}
		while(!isWhiteSpace(n)&&n!='.')
		{
			if(n>='0'&&n<='9')
			{
				doub*=10;
				doub+=n-'0';
				n=scan();
			}
			else throw new InputMismatchException();
		}
		if(n=='.')
		{
			n=scan();
			double temp=1;
			while(!isWhiteSpace(n))
			{
				if(n>='0'&&n<='9')
				{
					temp/=10;
					doub+=(n-'0')*temp;
					n=scan();
				}
				else throw new InputMismatchException();
			}
		}
		return doub*neg;
	}
	public String scanString()throws IOException
	{
		StringBuilder sb=new StringBuilder();
		int n=scan();
		while(isWhiteSpace(n))
			n=scan();
		while(!isWhiteSpace(n))
		{
			sb.append((char)n);
			n=scan();
		}
		return sb.toString();
	}
	private boolean isWhiteSpace(int n)
	{
		if(n==' '||n=='\n'||n=='\r'||n=='\t'||n==-1)
			return true;
		return false;
	}
}

class Print
{
	private final BufferedWriter bw;
	public Print()
	{
		this.bw=new BufferedWriter(new OutputStreamWriter(System.out));
	}
	public void print(Object object)throws IOException
	{
		bw.append(""+object);
	}
	public void println(Object object)throws IOException
	{
		print(object);
		bw.append("\n");
	}
	public void println()throws IOException
	{
		bw.append("\n");
	}
	public void close()throws IOException
	{
		bw.close();
	}
}

Measured memory_bytes: 36900
(function main() {
  let line = require('fs').readFileSync('/dev/stdin', 'utf8').trim().split('');
  let height_list = [0];
  let current_height = 0;

  // 初めの上昇と平坦を除去
  while (line.length > 0 && line[0] !== '\\') line.shift();
  // 終わりの下降と平坦を除去
  while (line.length > 0 && line[line.length - 1] !== '/') line.pop();

  line.forEach(function(e, i){
      if (e === '\\') current_height -= 1
      else if (e === '_') current_height += 0
      else current_height += 1
      height_list.push(current_height);
  });

  let sum = 0;
  let holes = [];
  for (;height_list.length > 1;) {
    let h = makeHole(height_list);
    if (h > 0) {
      sum += h;
      holes.push(h);
    }
  }

  console.log(sum);
  console.log(holes.length && holes.length + ' ' + holes.join(' '));
})();

function makeHole(list) {
    begin = list.shift();
    if (begin <= list.reduce((a, b) => Math.max(a, b), -100000)) {
    let area = 0;
      while (true) {
      if (list.length == 0 || begin <= list[0]) break;
        area += begin - list.shift();
      }
      return area;
    } else {
      return 0;
    }
}



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

using namespace std;

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int a,b,c,x;
    int cnt = 0;
    cin >> a >> b >> c >> x;
    for (int i = 0; i <= a; ++i)
    {
        for (int j = 0; j <= b; ++j)
        {
            for (int k = 0; k <= c; ++k)
            {
                if ((500 * i + 100 * j + 50 * k) == x) ++cnt;
            }
    
        }
    
    }
    cout << cnt << endl;

    return 0;
}

Measured memory_bytes: 256
#include"iostream"
#include"stdio.h"
#include"string"

using namespace std;

char s[100][100];

int main()
{
    int H, W;
    scanf("%d%d", &H, &W);
    for(int i = 1; i <= H; i++)
        scanf("%s" ,s[i] + 1);
    bool flag = true;
    for(int i = 1; i <= H; i++)
        for(int j = 1; j <= W; j++)
            if(s[i][j] == '#')
            {
                if(s[i - 1][j] != '#' && s[i][j - 1] != '#' && s[i + 1][j] !='#' && s[i][j + 1] != '#')
                    flag = false;
            }
    if(flag) cout << "Yes"<< endl;
    else cout << "No"<< endl;
    return 0;
}

Measured memory_bytes: 256
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def X(): return list(input())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
count = 0
ans = "No"

A,B,C = I()
K = i()

while True:
    if B > A or K == 0:
        break
    else:
        B *= 2
        K -= 1
while True:
    if C > B or K == 0:
        break
    else:
        C *= 2
        K -= 1
if A < B and B < C:
    ans = "Yes"
print(ans)





Measured memory_bytes: 9220
#include<iostream>
#include<string.h>
#include<string>
#include<cstdio>
#include<algorithm>
#include<stack>
#include<queue>
#include<vector>
#include<cmath>
#include<utility>
#include<set>
#define ll long long int
#define ld long double
#define INF 1000000000
#define EPS 0.0000000001
#define rep(i,n) for(i=0;i<n;i++)
using namespace std;
typedef pair<int, int> pii;

int main()
{
  int n;
  while(1){ 
    cin>>n;
    if(n==0)break;
    string str;
    int len[45];
    int i,j;
    int ans;

    rep(i,n){
      cin>>str;
      len[i]=str.size();
    }
    rep(i,n){
      int tanku[5]={5,7,5,7,7};
      int now=0;
      for(j=i;j<n;j++){
	if(len[j]>tanku[now])break;
	if(len[j]==tanku[now])now++;
	else tanku[now]-=len[j];
	if(now==5) goto ANS;
      }
    }
  ANS:cout<<i+1<<endl;
  }

}

Measured memory_bytes: 3216
#include <stdio.h>

#define M 998244353
#define N 300000

char S[N];
int C[3]={0}, CP[N/3][3]={0}, PB[N]={0};
int b, B[N], H0, H1, H2, BP, ST[8]={0};

int main(){
  int n, i, p;
  int j, pos0=0, pos1=0, pos2=0, fill;
  long long int pat=1LL;

  scanf("%d", &n);
  scanf("%s", S);
  fill=0;
  for (i=0; i<3*n; i++){
    if (S[i]=='B') b=1;
    if (S[i]=='G') b=2;
    if (S[i]=='R') b=4;
//    printf("%d", b[i]);

/*
    if (C[2]<C[1]) { CP[2][pos2]=i; C[2]++; pos2++; }
    else if (C[1]<C[0]) { CP[1][pos1]=i; C[1]++; pos1++; } 
    else { CP[0][pos0]=i; C[0]++; pos0++; } 
*/

    H0=pos0; H1=pos1; H2=pos2;

    for (p=ST[b]; p<n; p++){
      if ((B[p]&b)==0) { 
        if (B[p]==0) { CP[p][0]=i; BP=0; pos0++; }
        else if ((B[p]==1) || (B[p]==2) || (B[p]==4)) { 
          CP[p][1]=i; BP=1; pos1++; 
        } else { CP[p][2]=i; BP=2; pos2++; }
        B[p]|=b; ST[b]=p+1;
        if (B[p]==7) { fill++; break; }
        break;
      }
    }
    //printf("%d %d %d < %d\n", H[i][0], H[i][1], H[i][2], BP);
    if (BP==0) { pat=(pat*(n-H0))%M; }
    else if (BP==1) { pat=(pat*(H1-H0))%M; }
    else pat=(pat*(H2-H1))%M; 
//    printf("%lld\n", pat);

/*
    if (C[0]!=n) { CP[0][pos0]=i; C[0]++; pos0++; }
    else if (C[1]!=n) { CP[1][pos1]=i; C[1]++; pos1++; } 
    else { CP[2][pos2]=i; C[2]++; pos2++; } 
*/
/*
    if (C[2]<C[1]) { CP[2][pos2]=i; C[2]++; pos2++; }
    else if (C[1]<C[0]) { CP[1][pos1]=i; C[1]++; pos1++; } 
    else { CP[0][pos0]=i; C[0]++; pos0++; } 
*/
  }
  printf("%lld\n", pat);


  return 0;
}


Measured memory_bytes: 2048