akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
const ll mod=1e9+7;
int dy[]={1,-1,0,0};
int dx[]={0,0,1,-1};

int main(){
  ll N,M;
  cin>>N>>M;
  if(N>=M/2) cout<<M/2;
  else cout<<N+(M/2-N)/2<<endl;
  return 0;
}




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

using namespace std;

class Bank{
public:
	int id, r, t;
	Bank(int id, int r, int t) :id(id), r(r), t(t){}
};

int main(){
	while (true){
		int n;
		cin >> n;

		if (n == 0) break;

		int y;
		cin >> y;

		vector<Bank> vb;
		for (int i = 0; i < n; ++i) {
			int b, r, t;
			cin >> b >> r >> t;

			vb.push_back(Bank(b, r, t));
		}

		// ganpon * (1 + y * r/100)
		// ganpon * (1 + r/100)^y

		double maxi = 0;
		int ans = -1;

		for (int i = 0; i < vb.size(); ++i){
			double g = 100000;
			double r1 = g * (1. + y * vb[i].r / 100.);
			double r2 = g * pow(1 + vb[i].r / 100., y);
			if (vb[i].t == 1){
				if (maxi < r1){
					maxi = r1;
					ans = vb[i].id;
				}
			}
			else{
				if (maxi < r2){
					maxi = r2;
					ans = vb[i].id;
				}
			}
		}

		cout << ans << endl;
	}
}

// 1

Measured memory_bytes: 1204
#include<bits/stdc++.h>
using namespace std;
double A, B, H, M;
int main(){
  cin >> A >> B >> H >> M;
  double angle1 = (H + M/60) / 12.0 * 2 * M_PI;
  double angle2 = M / 60.0 * 2 * M_PI;
  double x1 = cos(angle1) * A;
  double y1 = sin(angle1) * A;
  double x2 = cos(angle2) * B;
  double y2 = sin(angle2) * B;
  //cout << angle1 / M_PI * 180 << " " << angle2 / M_PI * 180 << endl;
  //cout << x1 << " " << y1 << endl;
  //cout << x2 << " " << y2 << endl;
  cout << setprecision(20) <<sqrt((x1 - x2)*(x1 - x2)+(y1 - y2)*(y1 - y2));
}


Measured memory_bytes: 4088
import sys
import math
input = sys.stdin.readline
ins = lambda: input().rstrip()
ini = lambda: int(input().rstrip())
inm = lambda: map(int, input().split())
inl = lambda: list(map(int, input().split()))
out = lambda x: print('\n'.join(map(str, x)))

n = ini()
print("No" if n % 9 else "Yes")

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

int main() {
  int N, T, A, iter;
  cin >> N >> T >> A;
  vector<int> H(N);
  
  for(int i=0; i<N; i++){
    cin >> H.at(i);
  }
  
  int x, dif, difold=20000000, target;
  for(int i=0; i<N; i++){
    x = T*1000 - H.at(i) * 6;
    dif = abs(A*1000-x);
    if(dif < difold){
      target = i + 1;
      difold = dif;
    }
  }
  
  cout << target << endl;
  
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
struct point {
	double x, y;
} a[1010];
int n;
void solve() {
	scanf("%d", &n);
	for (int i = 1; i <= n; ++i) {
		scanf("%lf%lf", &a[i].x, &a[i].y);
	}
	double ans = 0;
	for (int i = 1; i <= n; ++i) {
		for (int j = i + 1; j <= n; ++j) {
			ans += sqrt((a[i].x - a[j].x) * (a[i].x - a[j].x) + (a[i].y - a[j].y) * (a[i].y - a[j].y)) * 2 / n;
		}
	}
	printf("%lf\n", ans);
}
int main() {
	solve();
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
  int e,gh,h,gj,j,g,i,t;
  while(1){
 scanf("%d",&e);
 if(e==0) break;
  gh=(1000-e)/500;
  h=((1000-e)%500)/100;
  gj=(((1000-e)%500)%100)/50;
  j=((((1000-e)%500)%100)%50)/10;
  g=(((((1000-e)%500)%100)%50)%10)/5;
  i=(((((1000-e)%500)%100)%50)%10)%5;
  t=gh+h+gj+j+g+i;
  printf("%d\n",t);
  }
  return 0;
}

Measured memory_bytes: 600
#include <iostream>
#include <string>
using namespace std;
string s;
int k;
int main(){
    cin >> k >> s;
    if(s.length() > k){
        for (int i = 0; i < k; ++i)
            cout << s[i];
        cout << "...";
    }
    else{
        cout << s;
    }
    return 0;
}

Measured memory_bytes: 3620
#include <algorithm>
#include <bits/stdc++.h>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;

#define rep(X, S, E) for (int(X) = (S); (X) < (E); ++(X))
#define rrep(X, S, E) for (int(X) = (E)-1; (X) >= (S); --(X))
#define itrep(X, Y) for (auto(X) = (Y).begin(); (X) != (Y).end(); (X)++)
#define all(X) (X).begin(), (X).end()
#define pb push_back
#define mp make_pair
#define fi first
#define sc second
#define print(x) cout << x << endl

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
const ll INF = 9 * 1e18;
const ll MOD = 1e9 + 7;

void solve(long long N, std::vector<long long> a) {
  ll ans = 0;
  while (true) {
    ll cnts = 0;
    rep(i, 0, N) { cnts += a[i] / N; }

    if (cnts == 0) {
      break;
    }

    ans += cnts;

    rep(i, 0, N) {
      ll acnts = a[i] / N;
      a[i] = a[i] - acnts * N + (cnts - acnts);
    }
  }
  print(ans);
}

int main() {
  long long N;
  scanf("%lld", &N);
  std::vector<long long> a(N);
  for (int i = 0; i < N; i++) {
    scanf("%lld", &a[i]);
  }
  solve(N, std::move(a));
  return 0;
}


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

using ll = long long;
using ull = unsigned long long;

const double PI = acos(-1);
const int inf = 2e9;
const ll INF = 2e18;
const ll MOD = 1e9+7;

#define sz(s) (s).size()
#define pb push_back
#define fi first
#define se second
#define REP(i,n) for (int i = 0; i<n; i++)
#define ALL(a) begin(a), end(a)

int main (void) {
    string s;
    cin >> s;
    int n = (s[0] - '0') * 10 + (s[1] - '0');
    int m = (s[2] - '0') * 10 + (s[3] - '0');
    bool nn = false;
    bool mm = false;
    if (n==0 || n >= 13) nn = true;
    if (m==0 || m >= 13) mm = true;
    string ans;
    if (nn) {
        //最初が月の可能性はない
        if (mm) {
            ans = "NA";
        }
        else {
            ans = "YYMM";
        }
    }
    else {
        if (mm) {
            ans = "MMYY";
        }
        else {
            ans = "AMBIGUOUS";
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int num[] = new int[6];
		for (int i = 0; i < 6; i++) {
			num[i] = sc.nextInt();
		}
		Dice d = new Dice(num);
		String order = sc.next();
		for (int i = 0; i < order.length(); i++) {
			switch (order.charAt(i)) {
			case 'W':
				d.rollWest();
				break;
			case 'N':
				d.rollNorth();
				break;
			case 'E':
				d.rollEast();
				break;
			case 'S':
				d.rollSouth();
				break;

			}
		}
		d.printLabel();
	}

}

class Dice {
	int num[];
	int temp;

	public Dice(int num[]) {
		this.num = num;
	}

	void rollWest() {
		temp = num[0];
		num[0] = num[2];
		num[2] = num[5];
		num[5] = num[3];
		num[3] = temp;
	}

	void rollNorth() {
		temp = num[0];
		num[0] = num[1];
		num[1] = num[5];
		num[5] = num[4];
		num[4] = temp;
	}

	void rollEast() {
		temp = num[0];
		num[0] = num[3];
		num[3] = num[5];
		num[5] = num[2];
		num[2] = temp;
	}

	void rollSouth() {
		temp = num[0];
		num[0] = num[4];
		num[4] = num[5];
		num[5] = num[1];
		num[1] = temp;
	}

	void printLabel() {
		System.out.println(num[0]);
	}

}

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

int main()
{
  long long ans = 0;
  long long B = 0, W = 0;
  string S;
  cin >> S;
  
  for (int i = 0; i < S.size(); i++)
  {
    if (S.at(i) == 'W')
    {
      ans += B;
      W++;
    }
    else B++;
  }
  
  cout << ans << endl;
}

Measured memory_bytes: 640
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <string>
#include <cmath>
#include <stack>
#include <vector>
#include <map>
#include <iostream>


using namespace std;

int main()
{
	double v;
	while (scanf("%lf", &v) != EOF)
		printf("%d\n", (int)(4.9*pow(v/9.8, 2)/5)+2);
	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
int main() {
	int n,k,ans=1;
	cin>>n>>k;
	for(int i=0;i<n;i++){
		if(ans*2<ans+k){
			ans*=2;
		}
		else{
			ans+=k;
		}
	}
	cout<<ans<<endl;
}

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

string S;
int a[10];
ll sum = 0;

int main() {
  cin >> S;
  int size = (int)S.size();
  for(int i = 0; i < size; ++i) {
    a[i] = S[i] - '0';
  }



  for(int bit = 0; bit < (1 << size-1); ++bit) {
    ll tmp = a[0];
    for(int i = 0; i < size-1; ++i) {
      if(bit & (1 << i)) {
        sum += tmp;
        tmp = a[i+1];
      } else {
        tmp *= 10;
        tmp += a[i+1];
        
      }
    }
    sum += tmp;
  }

  cout << sum << "\n";
}

Measured memory_bytes: 256
import numpy as np
N, K = map(int,input().split())
MOD = 10**9+7
div = list(range(1, int(np.sqrt(N))+1))
L1 = len(div)
div2 = [N//val for val in div]
div2.sort()
if div[-1] == div2[0]:
    div2.remove(div2[0])
L2 = len(div2)
L = L1+L2
ls = [1]*L1 + [0]*L2
tmp = div[-1]
for i,val in enumerate(div2):
    ls[i+L1] = val-tmp
    tmp = val
dp = [0]*L
dp = np.zeros((L), dtype='int64')
ls = np.array(ls, dtype='int64')
dp[:] = ls
r = np.zeros(L+1, dtype='int64')
r[:-1] = np.cumsum(dp, dtype='int64')[::-1]
for i in range(K-1):
    dp = (r[:-1]*ls)%MOD
    r[:-1] = np.cumsum(dp, dtype='int64')[::-1]
print(r[0]%MOD)


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

class Main
{
    public static void main(String args[])throws Exception
    {
        BufferedReader bu=new BufferedReader(new InputStreamReader(System.in));
        StringBuilder sb=new StringBuilder();
        String s[]=bu.readLine().split(" ");
        int a[]=new int[4],i; long max=Long.MIN_VALUE;
        for(i=0;i<4;i++)
        a[i]=Integer.parseInt(s[i]);
        for(i=0;i<2;i++)
        for(int j=2;j<4;j++)
        {
            long cur=1l*a[i]*a[j];
            max=Math.max(max,cur);
        }
        System.out.print(max);
    }
}


Measured memory_bytes: 32564
//c++ テンプレ
#include<bits/stdc++.h>
using namespace std;

typedef long long llint;
typedef long double ld;

#define inf 1e18
#define mod 1000000007
#define sort(v) sort(v.begin(),v.end())
#define reverse(v) reverse(v.begin(),v.end())

priority_queue<llint,vector<llint>,greater<llint> > que;
priority_queue<llint> Que;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }


void solve(){
    int n;
    cin >> n;
    vector<llint>x(n);
    vector<llint>t(n);
    for(int i=0;i<n;i++){
        cin >> x[i];
        t[i]=x[i];
    }
    sort(x);
    llint res1=x[n/2-1];
    llint res2=x[n/2];
    for(int i=0;i<n;i++){
        if(t[i]>=res2){
            cout << res1 << endl;
        }
        else{
            cout << res2 << endl;
        }
    }
}

int main(){
    solve();
    return 0;
}




Measured memory_bytes: 6372
#inport
import sys
import numpy as np
from collections import deque


#input
N,K = [int(x) for x in sys.stdin.readline().split()]
snu = np.zeros(N)

for _ in range(K):
    d = [int(x) for x in sys.stdin.readline().split()] 
    a = [int(x) for x in sys.stdin.readline().split()]
    n = np.size(a)
    for i in range(n):
        snu[a[i]-1] = snu[a[i]-1]+1

ju = np.count_nonzero(snu)
print(N-ju)


Measured memory_bytes: 27180
#include <iostream>

void solve() {
    int a, b, c, k;
    std::cin >> a >> b >> c >> k;

    int ans = 0;
    {
        int g = std::min(a, k);
        ans += g * 1;
        k -= g;
    }
    {
        int g = std::min(b, k);
        ans += g * 0;
        k -= g;
    }
    {
        int g = std::min(c, k);
        ans += g * (-1);
        k -= g;
    }

    std::cout << ans << std::endl;
}

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

    solve();

    return 0;
}


Measured memory_bytes: 3648
n=int(input())
st=[]
for i in range(n):
    x,l=map(int,input().split())
    st.append([x-l,x+l])
st.sort(key=lambda x:x[1])
now,ans=0,0
while now<n:
    t=st[now][1]
    while True:
        now+=1
        if now==n: break
        if st[now][0]>=t: break
    ans+=1
print(ans)

Measured memory_bytes: 25544
import java.util.Scanner;
 
public class Main{
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        double num1 = scan.nextDouble();
        double mny = 100;
        double risoku = 1.01;
            
        int cnt;    
        for(cnt=0;mny<num1;cnt++){
            long mny2 = (long)(mny*risoku);
            mny = mny2;
            }
        System.out.println(cnt);
        scan.close();
    }
}

Measured memory_bytes: 37200
#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
#define rep(i, n) for (ll i = 0; i < (int)(n); i++)
#define repR(i, n) for(ll i = n; i >= 0; i--)
#define For(i, m, n) for(ll i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()

using namespace std;

ll gcd(ll a, ll b){
    ll r = a % b;
    while(r!=0){
        a = b;
        b = r;
        r = a % b;
    }
    return b;
}

ll lcm(ll x, ll y)
{
    if(x == 0 || y == 0) {
        return -1;
    }
    
    return (x * y / gcd(x, y));
}

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

ll nCr(ll n, ll r) {
    if ( r * 2 > n ) r = n - r;
    ll dividend = 1;
    ll divisor  = 1;
    for ( ll i = 1; i <= r; ++i ) {
        dividend *= (n-i+1);
        divisor  *= i;
    }
    return dividend / divisor;
}

bool compare_by_b(pair<int, int> a, pair<int, int> b) {
    if(a.second != b.second){
        return a.second < b.second;
    }else{
        return a.first < b.first;
    }
}

ll mod = 1e9+7;

int main(){
    string s;
    cin >> s;
    
    if(s == "Sunny"){
        cout << "Cloudy";
    }else if(s == "Cloudy"){
        cout << "Rainy";
    }else if(s == "Rainy"){
        cout << "Sunny";
    }
    
    cout << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD = 1e9 + 7;
const int iinf = 1 << 28;
const long long llinf = 1ll << 60;
const double PI = 3.14159265;

vector<vector<int>> g(1e5+1);

int getnjumps(int a, int t, vector<int> &s, int prev, bool &found) {
    if (a == t) {
        found = true;
        s.push_back(t);
        return 0;
    }

    s.push_back(a);
    for (int j : g[a]) {
        if (j != prev) {
            int res = getnjumps(j, t, s, a, found);
            if (found) {
                return 1 + res;
            }
        }
    }

    s.pop_back();
    return 0;
}

int dfs(int v, int prev) {
    if (g[v].size() == 1) {
        return 0;
    }
    int ans = 0;
    for (int j : g[v]) {
        if (j != prev) {
            ans = max(ans, 1 + dfs(j, v));
        }
    }
    return ans;
}

int main() {
    int n, t, a; cin >> n >> t >> a;
    for (int i = 0; i < n; ++i) {
        int u, v; cin >> u >> v; g[u].push_back(v); g[v].push_back(u);
    }
    vector<int> s;
    bool found = false;
    int njumps = getnjumps(a, t, s, -1, found);
    int nnodes = njumps - 1;
    if (nnodes < 1) {
        cout << "0"; return 0;
    }
    if (nnodes == 1) {
        cout << "1"; return 0;
    }
    int ntjumps = nnodes >> 1;
    int ancestor = s[s.size() - 1 - ntjumps];
    int njumpstoleaf = 0;
    for (int j : g[ancestor]) {
        if (j != s[s.size() - 2 - ntjumps]) {
            njumpstoleaf = max(njumpstoleaf, 1 + dfs(j, ancestor));
        }
    }
    int ans = njumpstoleaf + (nnodes & 1) + ntjumps;
    cout << ans;

    return 0;
}


Measured memory_bytes: 10484
N = int(input())
S = [input() for _ in range(N)]
M = int(input())
T = [input() for _ in range(M)]
ans = 0
for i in range(N):
    if S.count(S[i]) > T.count(S[i]):
        ans = max(ans, S.count(S[i]) - T.count(S[i]))
print(ans)

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

map<long long, long long> primeFactorize(long long N) {
	map<long long, long long> ans;
	int p = 2;
	while (true) {
		//終了条件
		if (N == 1) {	//素因数分解が完了
			break;
		} else if (ans.find(p) == ans.end() && p > sqrt(N) + 1) {	//Nが素数
			ans[N] = 1;
			break;
		}

		//素因数分解
		if (N % p == 0) {
			N /= p;
			ans[p]++;
		} else {
			p++;
		}
	}
	return ans;
}

int main() {
	long long N;
	cin >> N;
	long long ans = 0;
	auto P = primeFactorize(N);
	for (auto it = P.begin(); it != P.end(); it++) {
		int i = 0;
		int e = (*it).second;
		while (e > 0) {
			e -= ++i;
		}
		if (e < 0) {
			i--;
		}
		ans += i;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3724
use proconio::input;
use std::ops::{
    ShrAssign,
    Sub,
    Div,
    Mul,
    Rem,
    BitAnd,
};


fn main() {
    input! {
        s: String,
    }
    let mut tmp = 0;

    let mut mod_seq: Vec<usize> = vec![0];
    for (i, v) in s.chars().rev().enumerate() {
        let v = v.to_digit(10).unwrap() as usize;
        tmp = (v * modpow(10, i, 2019) + tmp) % 2019;
        mod_seq.push(tmp);
    }

    let mut counter = vec![0; 2019];
    for &c in mod_seq.iter() {
        counter[c as usize] += 1;
    }

    let mut ans = 0;
    for c in counter.iter() {
        ans += c * (c - 1) / 2;
    }

    println!("{}", ans);
}


pub fn modpow<T>(mut a: T, mut n: T, m: T) -> T
    where T: Sub<Output=T> + Div<Output=T> + Mul<Output=T> + Rem<Output=T> + ShrAssign + PartialOrd + BitAnd<Output=T> + Copy + From<u8>
{
    let zero = T::from(0);

    let one = T::from(1);
    let mut res = one;

    while n > zero {
        if (n & one) == one {
            res = res * a % m;
        }
        a = a * a % m;
        n >>= one;
    }

    res
}



Measured memory_bytes: 4096
import java.util.*;
import java.lang.Math;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt(), x, i, j=3, ans = 0, ex = 0;
        for(i = 0; i < n; i++){
            x = sc.nextInt();
            //System.out.print(x);
            ex=0;
            if(x==2)ans++;
            else if(x>2&&x%2!=0){
                for(j=2; j<=Math.sqrt(x) ;j++){
                    if(x%j==0)ex++;
                }
                if(ex==0)ans++;
            }
            //System.out.println(" "+ans);
        }
        System.out.println(ans);
    }
}


Measured memory_bytes: 40824
#include <string>
#include <bits/stdc++.h>
#include <stdio.h>
#include<math.h>
#include <ctype.h>
#include <algorithm> // sort
#include <map> // pair
using namespace std;


int main() {
 long long int n;
  string s;
  cin >>s >> n;
 long long int count=0;
 long long int i=0;
  while(s.at(i)=='1'){
    i++;
    count++;
    if(i==s.size()){
      break;
    }
  }
  if(count>=n){
    cout << "1" << endl;
  }
  else{
    cout << s.at(i) << endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);
#define precise cout.precision(10); cout << fixed;
#define endl "\n"
#define int int64_t
#define ll long long


void solve() {
	int n,m;
	cin>>n>>m;
	cout<<((n==m)?"Yes":"No");
	cout<<endl;
}

int32_t main()
{
	fastio;
	precise;


	//int test;cin >> test;while (test--)
	 {solve();}
	return 0;
}


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

#define INF 1000000021
#define MOD 1000000007
#define pb push_back
#define sqr(a) (a)*(a)
#define M(a, b) make_pair(a,b)
#define T(a, b, c) make_pair(a, make_pair(b, c))
#define F first
#define S second
#define all(x) (x.begin(), x.end())
#define deb(x) cerr << #x << " = " << x << '\n'
#define N 222222

using namespace std;
//using namespace __gnu_pbds;

typedef long double ld;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
//typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;

const ld pi = 2 * acos(0.0);
template<class T> bool umin(T& a, T b){if(a>b){a=b;return 1;}return 0;}
template<class T> bool umax(T& a, T b){if(a<b){a=b;return 1;}return 0;}
template<class T, class TT> bool pal(T a, TT n){int k=0;for(int i=0;i<=n/2;i++){if(a[i]!=a[n-i-1]){k=1;break;}}return k?0:1;}

//int month[] = {0,31,28,31,30,31,30,31,31,30,31,30,31};

int main()
{
	string s;
	cin >> s;
	int n = s.size();
	string a = s.substr(0, (n-1)/2);
	string b = s.substr((n + 1)/2);
	if(pal(s, s.size()) && pal(a, a.size()) && pal(b, b.size()))
		cout << "Yes\n";
	else
		cout << "No\n";





	





	getchar();
	getchar();
	return 0;
	//ios::sync_with_stdio(false);
	//cin.tie(0);
}

Measured memory_bytes: 256
attrs = Array.new
while line = $stdin.gets
    attrs << line.chomp.split.map{|v| v.to_i }
end

attrs.flatten!
mod_paar = attrs.map{|v| [v, v.modulo(10)]}
mod_paar = mod_paar.sort{|a, b|
  b[1] <=> a[1] 
  }

time = 0

zero_count = 0
mod_paar.each do |paar| 
  if paar[1] == 0 then
    time += paar[0]
    zero_count += 1
  end
end

if zero_count > 0 then
  zero_count.times do mod_paar.pop end
end

for i in 0..(mod_paar.length - 1) do
  if i == (mod_paar.length - 1) then
    time += mod_paar[i][0]
  else
    tmp = ((mod_paar[i][0] / 10.0).ceil * 10)
    time += tmp
  end
end

puts time

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

int main() {
  int h, w; cin >> h >> w;
  char pixels[h + 1][w + 1];
  
  for (int i = 1; i <= h; ++i) {
    for (int j = 1; j <= w; ++j) {
      cin >> pixels[i][j];
    }
  }
  
  for (int i = 1; i <= 2 * h; ++i) {
    for (int j = 1; j <= w; ++j) {
      int height = ceil(i / 2.0);
      cout << pixels[height][j];
    }
    cout << endl;
  }
  
  return 0;
}

Measured memory_bytes: 3572
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin >> n;
  vector<int> S(n);
  for (int i = 0; i < n; i++){
    cin >> S[i];
  }
  int q;
  cin >> q;
  vector<int> T(q);
  for (int i = 0; i < q; i++){
    cin >> T[i];
  }
  int C = 0;
  for (int i = 0; i < q; i++){
    bool res = false;
    for (int j = 0; j < n; j++){
      if (S[j] == T[i]){
        res = true;
      }
    }
    if (res){
      C++;
    }
  }
  cout << C << endl;
}


Measured memory_bytes: 3136
#include <iostream>
#include <utility>
#include <stdint.h>

using namespace std;

int main()
{
  int N;
  cin >> N;

  unsigned A[N];
  uint64_t S = 0;
  
  for (int n=0; n<N; ++n) {
    cin >> A[n];
    S += A[n];
  }

  uint64_t M;

  M = S;
  for (int n=1; n<N; n+=2)
    M -= 2*A[n];
  cout << M << ' ';

  for (int n=1; n<N; ++n) {
    M = 2*A[n-1] - M;
    cout << M << ' ';
  }

  cout << endl;
  
  return 0;
}


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

int main(void){
	char a[4];
	int b,c,i;
	int d,e,f,g;
	
	scanf("%s",a);
	
	d = a[0] -'0';
	e = a[1] -'0';
	f = a[2] -'0';
	g = a[3] -'0';
	
	b = d*10 + e;
	c = f*10 + g;
	
	if(b>=0 && c>=0){
		if(b>0 && c>0 && c<=12 && b<=12) printf("AMBIGUOUS\n");
		else if(c<=12 && c>0) printf("YYMM\n");
		else if(b<=12 && b>0) printf("MMYY\n");
		else printf("NA\n");
	}
	return 0;
}
	

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
const int INF = (1<<30)-1;
const long long LINF = (1LL<<62)-1;
const long double PI = acos(-1.0L);
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, 1, 0, -1};
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

vector<long long> divisor(long long n) {
  vector<long long> res;
  for (long long i = 1; i * i <= n; i++) {
    if (n % i == 0) {
      res.push_back(i);
      if (n / i != i)
        res.push_back(n / i);
    }
  }
  return res;
}

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll n;
  cin >> n;
  auto div = divisor(n);
  ll ans = LINF;
  for (auto e : div)
    chmin(ans, e+n/e-2);
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 384
N = int(input())
W = list(map(int,input().split()))
cumsum_b,cumsum_e = [],[]

for i,w in enumerate(W):
  if i == 0:
    cumsum_b.append(w)
  else:
    cumsum_b.append(w+cumsum_b[i-1])
    
for i,w in enumerate(reversed(W)):
  if i == 0:
    cumsum_e.append(w)
  else:
    cumsum_e.append(w+cumsum_e[i-1])

answer = 10**9
for i in range(N-1):
  if answer > abs(cumsum_b[i]-cumsum_e[N-i-2]):
    answer = abs(cumsum_b[i]-cumsum_e[N-i-2])
print(answer)


Measured memory_bytes: 3064
def main():
    n = int(input())
    n %= 10
    if(n == 3):
        print("bon")
    elif(n == 0 or n == 1 or n == 6 or n == 8):
        print("pon")
    else:
        print("hon")


if __name__ == "__main__":
    main()

Measured memory_bytes: 9116
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
using pll = pair<ll, ll>;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define rrep(i, m, n) for(ll i = m; i > n; i--)
#define Rep(i, m, n) for(ll i = m; i < n; i++)
#define all(vec) vec.begin(), vec.end()
#define lmax(x, y) max<ll>(x, y)
#define lmin(x, y) min<ll>(x, y)
#define tmax(x, y, z) lmax((x), lmax((y), (z)))
#define tmin(x, y, z) lmin((x), lmin((y), (z)))
#define MINUS(a) memset(a, 0xff, sizeof(a))
#define ZERO(a) memset(a, 0, sizeof(a))
const ll INF = 1LL << 60;
const ll MM = 1000000000; const ll MOD = MM + 7; const ll MMM=9223372036854775807;//2^63 -1
#define ADD(a,b) a = (a + ll(b)) % MOD
#define MUL(a,b) a = (a * ll(b)) % MOD
ll GCD(ll x, ll y){ if(y == 0) return x; else return GCD(y, x % y);}
ll LCM(ll x, ll y){ return x / GCD(x, y) * y;}
template<class T> inline bool chmin(T& a, T b){ if(a > b){ a = b; return true;} return false;}
template<class T> inline bool chmax(T& a, T b){ if(a < b){ a = b; return true;} return false;}
template<typename A, size_t N, typename T> void FILL(A (&array)[N], const T &val){ fill( (T*)array, (T*)(array+N), val );}
// struct edge{ ll from, to, cost; };
// struct edge{ ll to, cost; };
// using Graph = vector<vector<ll>>;  // 重み無し
// using Graph = vector<edge>;  // 辺
// using Graph = vector<vector<edge>>;  // 重み付き
ll dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
ll ddx[8] = {1, 1, 0, -1, -1, -1, 0, 1}, ddy[8] = {0, 1, 1, 1, 0, -1, -1, -1};
//cout << fixed << setprecision(10);
// priority_queue<ll, vector<ll>, greater<ll>> pq;


int main(){
    ll sx, sy, tx, ty; cin >> sx >> sy >> tx >> ty;
    ll delx = tx - sx, dely = ty - sy;
    rep(i, dely) cout << 'U';
    rep(i, delx) cout << 'R';
    rep(i, dely) cout << 'D';
    rep(i, delx+1) cout << 'L';
    rep(i, dely+1) cout << 'U';
    rep(i, delx+1) cout << 'R';
    cout << 'D';
    cout << 'R';
    rep(i, dely+1) cout << 'D';
    rep(i, delx+1) cout << 'L';
    cout << 'U' << endl;
}


Measured memory_bytes: 3636
N, M = map(int, input().split())

L = [None] * M
R = [None] * M

for i in range(M):
    l, r = map(int, input().split())
    L[i] = l
    R[i] = r

L_max = max(L)
R_min = min(R)

if L_max > R_min:
    print(0)
else:
    print(R_min - L_max + 1)


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

using ll = long long;
using P = pair<ll, ll>;

const ll MOD = 1e9+7;
// const ll MOD = 998244353;
const ll INF = 1ll<<60;

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

int main(int argc, char **argv)
{
	ll N, K; cin >> N >> K;
	vector<ll> A(N); REP(i, N) cin >> A[i];
	ll MAX = 200010;
	vector<ll> imos(MAX+10, 0);

	REP(k, K)
	{
		
		REP(i, N)
		{
			ll l = i - A[i];
			ll r = i + A[i] + 1;
			imos[max(l, 0ll)]++;
			imos[min(r, MAX)]--;
		}
		
		REP(i, N)
			imos[i+1] += imos[i];

		if (A == imos) break;
		A = imos;
		imos.assign(MAX+10, 0);
	}

	REP(i, N)
		std::cout << A[i] << " ";
	std::cout << std::endl;
}


Measured memory_bytes: 7932
#include <cstdio>
#include <algorithm>

using namespace std;

long long N, M, K;

long long arr[2][200003] = { 0 };

int main() {
	scanf("%lld %lld %lld", &N, &M, &K);
	for (int i = 1; i <= N; i++) {
		scanf("%lld", &arr[0][i]);
		arr[0][i] += arr[0][i - 1];
	}
	for (int i = 1; i <= M; i++) {
		scanf("%lld", &arr[1][i]);
		arr[1][i] += arr[1][i - 1];
	}
	int ans = 0;
	for (int i = 0; i <= N; i++) {
		long long left = K - arr[0][i];
		if (left < 0) break;
		int v = upper_bound(arr[1], arr[1] + M + 1, left) - arr[1] - 1;
		const int tmpAns = i + v;
		if (ans < tmpAns) ans = tmpAns;
	}
	printf("%d", ans);
	return 0;
}

Measured memory_bytes: 6336
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int MOD = 1e9 + 7;
const int INF = 2e9;
#define pb push_back
#define mp make_pair
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 (a>b) { a=b; return 1; } return 0; }

int main(){
    int n, d, ans = 0;
    cin >> n >> d;
    vector<vector<ld>> x(n);
    for (int i = 0; i < n; i++){
        x[i].resize(d);
        for (int j = 0; j < d; j++){
            cin >> x[i][j];
        }
    }
    for (int i = 0; i<n; i++){
        for (int j = i+1; j<n; j++){
            ld a = 0;
            for (int k = 0; k < d; k++){
                a += (x[i][k] - x[j][k]) * (x[i][k] - x[j][k]);
            }
            a = sqrtl(a);
            if(a == (int)a){
                ans++;
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {

	private static final char LEFT = '(';
	private static final char RIGHT = ')';

	public static void main(String[] args) {
		new Main().execute();
	}

	public void execute() {
		Scanner sc = new Scanner(System.in);

		final int N = sc.nextInt();
		sc.nextLine();
		String s = sc.nextLine();

		int[] count = new int[N];

		count[0] = (s.charAt(0) == LEFT) ? 1 : -1;
		int min = Math.min(0, count[0]);
		
		for (int i = 1; i < N; i++) {
			switch (s.charAt(i)) {
			case LEFT:
				count[i] = count[i - 1] + 1;
				break;
			case RIGHT:
				count[i] = count[i - 1] - 1;
				break;
			default:
				throw new IllegalArgumentException();
			}
			if (count[i] < 0) {
				min = Math.min(count[i], min);
			}
		}
		StringBuilder str = new StringBuilder();

		for (int i = 0, bound = Math.abs(min); i < bound; i++) {
			str.append(LEFT);
		}
		str.append(s);

		for (int i = 0, bound = count[N - 1] + Math.abs(min); i < bound; i++) {
			str.append(RIGHT);
		}

		System.out.println(str.toString());
		sc.close();

	}
}

Measured memory_bytes: 21076
#include <bits/stdc++.h>
using namespace std;
#define ll long long int

void printVector(vector<int> v) {
    for (auto x : v) {
        cout << x << ' ';
    }
    cout << '\n';
}

void printArray(ll A[], int size) {
    for (int i = 0; i <= size - 1; i++) cout << A[i] << ' ';
}

int main() {
    ll n, a, b, c, d, e;
    cin >> n >> a >> b >> c >> d >> e;
    ll menor = min(min(min(min(a, b), c), d), e);
    cout << ((n + menor - 1) / menor) + 4 << '\n';
    return 0;
}

Measured memory_bytes: 3632
def prim(n):
    d[0] = 0
    while True:
        cost_min = 10**9
        u = -1
        for i in range(n):
            weight = d[i]
            if flag_list[i] < 2 and weight < cost_min:
                u = i
                cost_min = weight
        if u == -1:
            break
        flag_list[u] = 2
        for v in range(n):
            edge = m[u][v]
            if flag_list[v] < 2 and edge > -1:
                if d[v] > edge:
                    d[v] = edge
                    p[v] = u
                    flag_list[v] = 1
    cnt = 0
    for i in range(n):
        if p[i] != -1:
            cnt += m[i][p[i]]
    return cnt


if __name__ == "__main__":
    n = int(input())
    m = []
    for _ in range(n):
        in_list = list(map(int, input().split()))
        m.append(in_list)

    flag_list = [0]*n # 0: 未到達, 1: 処理中, 2: 完了
    d = [10**9]*n
    p = [-1]*n
    print(prim(n))



Measured memory_bytes: 5888
// abc135c: City Savers
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;

#define upto(i,s,e,d) for(int i=(s);i<(e);i+=(d))
#define in(x) cin>>(x)
#define oute(x) cout<<(x)<<endl

int main(){
  int n;in(n);
  vi a(n+1);upto(i,0,n+1,1) in(a[i]);

  ll c = 0;
  upto(i,0,n,1){
    int m,bi; in(bi);
    m = min(a[i],bi);
    bi -= m;
    c += m;
    m = min(a[i+1],bi);
    a[i+1] -= m;
    c += m;
  }
  oute(c);
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#include <iostream>
#include <vector>
#include <cstdlib>
#include <cmath>
#include <math.h>
#include <sstream>
#include <numeric>
#include <cctype>
#include <bitset>
#include <cassert>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i <= (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define SIZE 100005
#define INF 1000000000000000LL
using pint = pair<int,int>;
using vec = vector<int>;
using ll=long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }


int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;cin>>n;
  vll h(n);
  rep(i,n) cin>>h[i];

  int cnt=0,ans=0;
  for(int i=0; i<n-1; i++){
      if(h[i]>=h[i+1]){
        cnt++;
      }else{
        ans = max(ans,cnt);
        cnt=0;
      }
    }
    ans = max(ans,cnt);
  cout<<ans<<"\n";
}

Measured memory_bytes: 1024
program lucky7
      implicit none
      integer N,A(3)
      read(*,*) N
      A(0)=N/100
      A(1)=(N-A(0)*100)/10
      A(2)=N-A(0)*100-A(1)*10
      if(A(0)==7.or.A(1)==7.or.A(2)==7) then
         write(*,*) "Yes"
      else 
         write(*,*) "No"
      end if
      stop 
      end program lucky7


Measured memory_bytes: 2788
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;

typedef long long ll;
const int N = 110;
char res[N];
int g;

int main()
{
    ll n;
    scanf("%lld", &n);
    while(n) {
        res[g++] = (n - 1) % 26 + 'a';
        n--;
        n /= 26;
    }
    for(int i = g - 1; i >= 0; i--) printf("%c", res[i]);
    puts("");
    return 0;
}

Measured memory_bytes: 1664
#include <cstdlib>
#include <cstdio>
#include <iostream>
#include <vector>
#include <algorithm>
#include <iterator>
#include <utility>
#include <string>

using namespace std;

int main()
{
  int A, B; cin >> A >> B;
  if (B == 1) {
    cout << 0;
    return 0;
  }
  if (B <= A) {
    cout << 1;
    return 0;
  }
  for (int i = 1; ; ++i) {
    if ((A - 1) * (i - 1) + A >= B) {
      cout << i;
      return 0;
    }
  }
}

Measured memory_bytes: 256
import copy

def func(graph, array, n):
  ans = 0
  for v in graph[n]:
    if not array[v]:
      cp_array = copy.deepcopy(array)
      cp_array[v] = True
      
      if [True]*len(array) == cp_array:
        ans += 1
      else:
        ans += func(graph, cp_array, v)

  return ans

n,m = map(int, input().split())
graph = [[] for i in range(n)]

for i in range(m):
  a,b = map(int, input().split())
  a -= 1
  b -= 1
  graph[a].append(b)
  graph[b].append(a)
  
array = [False] * n
array[0] = True
print(func(graph, array, 0))

Measured memory_bytes: 3572
#include<iostream>
using namespace std;
int main(){
  int a[3][3];
  int c[3][3]={0};
  cin >> a[0][0] >> a[0][1] >> a[0][2];
  cin >> a[1][0] >> a[1][1] >> a[1][2];
  cin >> a[2][0] >> a[2][1] >> a[2][2];
  int n;
  cin >> n;
  int b[n];
  for(int i=0;i<n;i++){
    cin >> b[i];
    for(int j=0;j<3;j++){
      for(int k=0;k<3;k++){
      	if(b[i]==a[j][k])
          c[j][k]++;
      }
    }
  }
  for(int i=0;i<3;i++){
	if(c[i][0]&&c[i][1]&&c[i][2]){
      	cout << "Yes";
        return 0;
    }
    if(c[0][i]&&c[1][i]&&c[2][i]){
      	cout << "Yes";
        return 0;
    }
  }
    if(c[0][0]&&c[1][1]&&c[2][2]){
      	cout << "Yes";
        return 0;
    }
    if(c[2][0]&&c[1][1]&&c[0][2]){
      	cout << "Yes";
        return 0;
    }
  cout << "No";

  return 0;
}

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

int main(){
    long double N;
    cin >> N;
    unordered_map<long double,int> left_map;

    for(long double h=1;h<=100000;h++)left_map[4.0l/N - 1.0l/h] = h;
    for(long double n=1;n<=3500;n++){
        for(long double w=1;w<=3500;w++){
            long double right = 1.0l/n + 1.0l/w;
            if(left_map.count(right)){
                long double h = left_map[right];
                cout << h << " " <<  n << " " << w << endl;
                return 0;
            }
        }
    }

}

Measured memory_bytes: 9124
#[allow(unused_imports)]
use std::cmp::{Ordering};

#[allow(unused_imports)]
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};

#[allow(unused_imports)]
use std::io::{stdin, stdout, BufWriter, Write};

#[allow(unused_imports)]
use std::iter::FromIterator;

#[allow(unused_macros)]
macro_rules! min {
    ($x: expr) => ($x);
    ($x: expr, $($z: expr),+) => {{
        std::cmp::min($x, min!($($z),*))
    }}
}

#[allow(unused_macros)]
macro_rules! max {
    ($x: expr) => ($x);
    ($x: expr, $($z: expr),+) => {{
        std::cmp::max($x, max!($($z),*))
    }}
}

#[allow(unused_macros)]
macro_rules! get { 
    ([$t: ty]) => { 
        { 
            let mut line = String::new(); 
            stdin().read_line(&mut line).unwrap(); 
            line.split_whitespace().map(|t|t.parse::<$t>().unwrap()).collect::<Vec<_>>()
        }
    };
    ([$t: ty];$n: expr) => {
        (0..$n).map(|_|get!([$t])).collect::<Vec<_>>()
    };
    ($t: ty) => {
        {
            let mut line = String::new();
            stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t: ty),*) => {
        { 
            let mut line = String::new();
            stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            ($(iter.next().unwrap().parse::<$t>().unwrap(),)*)
        }
    };
    ($t: ty; $n: expr) => {
        (0..$n).map(|_|get!($t)).collect::<Vec<_>>()
    };
    ($($t: ty),*; $n: expr) => {
        (0..$n).map(|_|get!($($t),*)).collect::<Vec<_>>()
    };
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        #[cfg(debug_assertions)]
        writeln!(&mut std::io::stderr(), concat!("[DEBUG] ", $(stringify!($a), "={:?} "),*), $($a),*).unwrap();
    }
}

const BIG_STACK_SIZE: bool = true;

#[allow(dead_code)]
fn main() {
    use std::thread;
    if BIG_STACK_SIZE {
        thread::Builder::new()
            .stack_size(32 * 1024 * 1024)
            .name("solve".into())
            .spawn(solve)
            .unwrap()
            .join()
            .unwrap();
    } else {
        solve();
    }
}

fn solve() {
    let l = get!(String).chars().collect::<Vec<_>>();
    let mo = 1_000_000_007;
    let mut dp1 = vec![0usize; l.len()+1]; //<=L
    let mut dp2 = vec![0usize; l.len()+1]; 
    dp2[0] = 1;
    for i in 0..l.len() {
        if l[i] == '1' {
            dp1[i+1] = 3*dp1[i] + dp2[i];
            dp2[i+1] = 2*dp2[i];
        } else {
            dp1[i+1] = 3*dp1[i];
            dp2[i+1] = dp2[i];
        }
        dp1[i+1] %= mo;
        dp2[i+1] %= mo;
    }
    println!("{}", (dp1[l.len()]+dp2[l.len()]) % mo);
}


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

int main() {
  int n, count = 0;
  cin >> n;
  vector<int>p(n);
  for (int i = 0; i < n; i++) {
    cin >> p.at(i);
  }
  for (int i = 0; i < n-2; i++) {
    if (p.at(i)<p.at(i+1)&&p.at(i+1)<p.at(i+2)) {
      count++;
    }
    else if (p.at(i)>p.at(i+1)&&p.at(i+1)>p.at(i+2)) {
      count++;
    }
  }
  cout << count;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define forn(i,n) for(ll i=0;i<(n);i++)
#define maxx ((ll)1e6+5)
#define pb push_back
#define mp make_pair
using namespace std;
int main()
{
	int r;
	cin>>r;
	cout<<fixed<<setprecision(20)<<(2*M_PI*r);
  return 0;
}

Measured memory_bytes: 3800
#include<stdio.h>
#include<string.h>
int n,i;
char srx[101],sry[101];
int main()
{
    scanf("%d\n",&n);
    scanf("%s %s",srx,sry);
    for(i=0;i<n;++i)
    printf("%c%c",srx[i],sry[i]);
    return 0;
}

Measured memory_bytes: 128
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <cmath>
#include <iomanip>
#include <cassert>
using namespace std;

typedef pair<int, int> P;
#define rep(i, n) for (int i=0; i<(n); i++)
#define all(c) (c).begin(), (c).end()
#define uniq(c) c.erase(unique(all(c)), (c).end())
#define _1 first
#define _2 second
#define pb push_back
#define INF 1145141919
#define MOD 1000000007

int pos;
struct Node;
vector<Node> global;
struct Node {
  string pat;
  vector<P> xs;
  bool leaf;
  char chr;
  long long len;

  Node(char c) {
    leaf = true;
    chr = c;
    len = 1;
    pat=chr;
  }
  Node(string s) {
    pat = s;
    leaf = false;
    len = 0;

    int num = 0;
    rep(i, s.length()) {
      char c = s[i];
      if ('0' <= c && c <= '9') num = 10*num + (int)(c-'0');
      else {
        if (num > 0) {
          if (c == '(') {
            int state = 1;
            string t = "";
            i++;
            while (true) {
              if (s[i] == '(') state++;
              else if (s[i] == ')') {
                state--;
                if (state == 0) break;
              }
              t += s[i];
              i++;
            }
            global.pb(Node(t));
            xs.pb(P(global.size()-1, num));
            rep(_, num) {
              len += 1LL * global.back().len;
              if (len > pos) return;
            }
          }
          else {
            xs.pb(P(c-'A', num));
            len += num;
          }
          num = 0;
        }
        else {
          xs.pb(P(c-'A', 1));
          len += 1;
        }
      }
      if (len > pos) return;
    }
  }

  char get(int offset) {
    assert(offset < len);
    if (leaf) return chr;
    long long l = 0;
    for (P p : xs) {
      long long u = global[p._1].len * p._2;
      if (l+u > offset) {
        return global[p._1].get((offset - l) % global[p._1].len);
      }
      l+=u;
    }
    return '0';
  }
};

char parse(string s) {
  Node top(s);
  if (top.len <= pos) return '0';
  return top.get(pos);
}

signed main() {
  ios::sync_with_stdio(false); cin.tie(0);
  string s;
  rep(i, 26) global.pb(Node((char)('A'+i)));

  while (cin >> s >> pos) {
    if (s == "0") break;
    cout << parse(s) << "\n";
  }
  return 0;
}

Measured memory_bytes: 3248
import java.util.Scanner;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int i, tmp;
        for (i = 1; i <= n; i++) {
            if (i % 3 == 0) System.out.print(" "+i);
            else {
                tmp = i;
                while (tmp > 0) {
                    if (tmp % 10 == 3) {
                        System.out.print(" "+i);
                        break;
                    } else {
                        tmp /= 10;
                    }
                }
            }
        }
        System.out.println();
    }
}


Measured memory_bytes: 28724
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>
#include <stack>
#include <functional>

#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; ++i)
#define repp(i, m, n) for(ll i = m, i##_len = (n); i < i##_len; ++i)
#define reprev(i, n) for(ll i = (n-1LL); i >= 0; --i)
#define all(x) (x).begin(), (x).end()
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; }
template <class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair <int,int> P;
typedef long double ld;

int main(void)
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	int h, w;
	cin >> h >> w;
	int c[h][w];
	rep (i, h) {
		rep (j, w) {
			cin >> c[i][j];
		}
	}
	int tmp;
	rep (i, h) {
		rep (j, w) {
			cin >> tmp;
			c[i][j] = abs(c[i][j] - tmp);
			// cout << c[i][j] << " ";
		}
		// cout << "\n";
	}
	int dp_max = (h + w) * 80;
	bool dp[h + 1][w + 1][dp_max] = {}; // 正の途中結果だけ残す
	vector<int> dp_list[h + 1][w + 1];
	rep (i, h + 1) {
		dp[i][0][0] = true;
		dp_list[i][0].push_back(0);
	}
	rep (j, w + 1) {
		dp[0][j][0] = true;
		dp_list[0][j].push_back(0);
	}
	rep (i, h) {
		rep (j, w) {
			// cout << i + 1 << " " << j + 1 << "\n";
			if (j > 0 || i == 0) {
				for (int x : dp_list[i + 1][j]) {
					if (!dp[i + 1][j + 1][x + c[i][j]]) {
						dp_list[i + 1][j + 1].push_back(x + c[i][j]);
						dp[i + 1][j + 1][x + c[i][j]] = true;
					}
				}
				// for (int y : dp_list[i + 1][j + 1]) cout << y << " "; cout << "\n"; 
				for (int x : dp_list[i + 1][j]) {
					if (!dp[i + 1][j + 1][abs(x - c[i][j])]) {
						dp_list[i + 1][j + 1].push_back(abs(x - c[i][j]));
						dp[i + 1][j + 1][abs(x - c[i][j])] = true;
					}
				}
				// for (int y : dp_list[i + 1][j + 1]) cout << y << " "; cout << "\n"; 
			}
			if (i > 0 || j == 0) {
				for (int x : dp_list[i][j + 1]) {
					if (!dp[i + 1][j + 1][x + c[i][j]]) {
						dp_list[i + 1][j + 1].push_back(x + c[i][j]);
						dp[i + 1][j + 1][x + c[i][j]] = true;
					}
				}
				// for (int y : dp_list[i + 1][j + 1]) cout << y << " "; cout << "\n"; 
				for (int x : dp_list[i][j + 1]) {
					if (!dp[i + 1][j + 1][abs(x - c[i][j])]) {
						dp_list[i + 1][j + 1].push_back(abs(x - c[i][j]));
						dp[i + 1][j + 1][abs(x - c[i][j])] = true;
					}
				}
				// for (int y : dp_list[i + 1][j + 1]) cout << y << " "; cout << "\n"; 
			}
			// for (int y : dp_list[i + 1][j + 1]) cout << y << " "; cout << "\n"; 

		}
	}
	int ans = 0;
	while (true) {
		if (dp[h][w][ans]) {
			cout << ans << endl;
			break;
		}
		ans++;
	}
	return 0;
}

Measured memory_bytes: 178048
import java.util.Scanner;

//Identically Colored Panels Connection
public class Main{

	int h, w, t;
	int[][] o;
	int[][] tmp;
	int[] order;
	boolean[][] u;
	int max, c;
	int[][] move = {{-1,0},{0,1},{1,0},{0,-1}};

	void e(){
		for(int k=0;k<5;k++){
			if(tmp[0][0]==order[k])continue;
			flip(0, 0, tmp[0][0], order[k]);
		}
		c = 0;
		u = new boolean[h][w];
		v(0, 0);
	}

	void v(int i, int j){
		if(tmp[i][j]!=t)return;
		c++;
		u[i][j] = true;
		for(int k=0;k<4;k++){
			int ni = i+move[k][0];
			int nj = j+move[k][1];
			if(0<=ni&&ni<h&&0<=nj&&nj<w&&!u[ni][nj]){
				v(ni, nj);
			}
		}
	}

	void flip(int i, int j, int from, int to){
		if(tmp[i][j]!=from)return;
		tmp[i][j] = to;
		for(int k=0;k<4;k++){
			int ni = i+move[k][0];
			int nj = j+move[k][1];
			if(0<=ni&&ni<h&&0<=nj&&nj<w)flip(ni, nj, from, to);
		}
	}

	void run(){
		Scanner sc = new Scanner(System.in);
		while(true){
			h = sc.nextInt();
			w = sc.nextInt();
			t = sc.nextInt();
			if((h|w|t)==0)break;
			o = new int[h][w];
			tmp = new int[h][w];
			for(int i=0;i<h;i++)for(int j=0;j<w;j++)o[i][j]=sc.nextInt();
			max = 0;
			order = new int[5];
			for(int i=1;i<=6;i++){
				for(int j=1;j<=6;j++){
					for(int k=1;k<=6;k++){
						for(int l=1;l<=6;l++){
							order[0] = i;
							order[1] = j;
							order[2] = k;
							order[3] = l;
							order[4] = t;
							for(int x=0;x<h;x++)for(int y=0;y<w;y++)tmp[x][y]=o[x][y];
							e();
							max = Math.max(max, c);
						}
					}
				}
			}
			System.out.println(max);
		}
	}

	public static void main(String[] args) {
		new Main().run();
	}
}

Measured memory_bytes: 13000