akhauriyash/Code-Regression huggingface dataset:
import java.util.Scanner;
public class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int kind = sc.nextInt();
        int[] a = new int[kind];
        int[] b = new int[kind];
        int[] c = new int[kind];
        int sum = 0;
        for (int i = 0; i < kind; i++) {
            a[i] = sc.nextInt();
        }
        for (int i = 0; i < kind; i++) {
            b[i] = sc.nextInt();
            sum += b[i];
        }
        for (int i = 0; i < kind - 1; i++) {
            c[i] = sc.nextInt();
        }
        for (int i = 0; i < kind - 1; i++) {
            if (a[i + 1] - a[i] == 1) {
                sum += c[a[i]-1];
            }
        }
        System.out.println(sum);
    }
}


Measured memory_bytes: 21968
#include<bits/stdc++.h>  
using namespace std;
int dp[100001];
int solve(vector< vector<int> > &a,int i)
{
    if(dp[i]!=-1)return dp[i];
    int x=0;
    for(int j=0;j<a[i].size();j++)
    {
        int z=solve(a,a[i][j]);
        if(x<z)x=z;
    }
    dp[i]=1+x;
    return dp[i];
} 
int main()
{
    memset(dp,-1,sizeof(dp));
    int n,m;
    cin>>n>>m;
    vector< vector<int> > a(n+1);
    for(int i=0;i<m;i++)
    {
        int x,y;
        cin>>x>>y;
        a[x].push_back(y);
    }
    int sum=0;
    for(int i=1;i<=n;i++)
    {
        if(sum<solve(a,i))sum=solve(a,i);
    }
    cout<<sum-1;
}


Measured memory_bytes: 8192
#include <iostream>
#include <cstdio>
#include <algorithm>

using namespace std;

int main(){
    long long x,ans = 100;
    cin>>x;
    for(int i = 1;i <= 3760;i++){
        ans = (long long)(ans*1.01);
        if(ans >= x) {
            cout<<i<<endl;
            break;
        }
    }
}


Measured memory_bytes: 3192
//start:
//finish:
#include<bits/stdc++.h>
#define MOD 1000000007
using namespace std;
typedef long long ll;
int n,m;
int f[3005][6005][2];
void add(int &x,int y){
	x=(x+y)%MOD;
}
int main(){
	scanf("%d%d",&n,&m);
	f[0][0][1]=1;
	for(int i=1;i<=n;i++)f[0][i][0]=1;
	for(int i=0;i<m;i++){
		for(int j=0;j<=n;j++){
			for(int t=0;t<=1;t++){
				if(!f[i][j][t])continue;
				int now=f[i][j][t];
				if(!j){
					add(f[i+1][j][1],now);
					add(f[i+1][j+1][1],now);
				}
				else if(j==n){
					add(f[i+1][j][t|(j==1)],now);
					add(f[i+1][j-1][t|(j==1)],now);
				}
				else{
					add(f[i+1][j][t],now);
					add(f[i+1][j+1][t],now);
					add(f[i+1][j][t|(j==1)],now);
					add(f[i+1][j-1][t|(j==1)],now);
				}
			}
		}
	}
	int ans=0;
	for(int i=0;i<=n;i++){
		add(ans,f[m][i][1]);
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 139520
o="RUD"
g="LUD"

s=input()

i=0
while i<len(s):
  #print(s[i],i%2)
  if i%2==0:
    if s[i] =="L":
      print("No")
      exit()
  else:
    if s[i]=="R":
      print("No")
      exit()
  i+=1
  
print("Yes")


Measured memory_bytes: 38256
#pragma warning disable

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.Serialization.Formatters.Binary;
using System.Text;
using System.Text.RegularExpressions;
using System.Diagnostics;
using System.Numerics;
using System.Collections;
using System.Timers;

static class MainClass
{
    public static void Main(string[] args)
    {
     
            var NM = Console.ReadLine().SplittedStringToInt32List();
            long N = NM[0];
            long M = NM[1];

            if (N <= 2 || M <= 2)
            {
                if (N == 1 && M == 1)
                {
                    Console.WriteLine(1);
                }
                else if (N == 1)
                {
                    Console.WriteLine(M - 2);
                }
                else if (N == 2)
                {
                    Console.WriteLine(0);
                }
                else if (M == 2)
                {
                    Console.WriteLine(0);
                }
                else
                {
                    Console.WriteLine(N - 2);
                }
            }
            else
            {
                Console.WriteLine(N * M - 2 * N - 2 * M + 4);
            }
        // var amariN = N % 3;
        //var grid = new bool[N, M];
        //var dx = new int[] { 0, 1, 1, 1, 0, -1, -1, -1 };
        //var dy = new int[] { 1, 1, 0, -1, -1, -1, 0, 1 };
        //for (int i = 0; i < N; i++)
        //{
        //    for (int j = 0; j < M; j++)
        //    {
        //        for (int k = 0; k < 8; k++)
        //        {
        //            var x = i + dx[k];
        //            var y = j + dy[k];
        //            if (x < 0 || y < 0 || x >= N || y >= M)
        //            {
        //                continue;
        //            }
        //            grid[x, y] = !grid[x, y];
        //        }
        //    }
        //}

        //for (int i = 0; i < N; i++)
        //{
        //    var sb = new StringBuilder();

        //    for (int j = 0; j < M; j++)
        //    {
        //        sb.Append(grid[i, j] ? "#" : ".");
        //    }
        //    Console.WriteLine(sb.ToString());
        //}


    

    Console.ReadLine();
    }

    


    #region ライブラリ
    public static long ToInt64(this string str) => long.Parse(str);
    public static int ToInt32(this string str) => int.Parse(str);
    public static BigInteger ToBigInteger(this string str) => BigInteger.Parse(str);
    public static List<string> SplittedStringToList(this string str) => str.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).ToList();
    public static List<int> SplittedStringToInt32List(this string str) => str.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(x => int.Parse(x)).ToList();
    public static List<BigInteger> SplittedStringToBigInteger(this string str) => str.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(x => BigInteger.Parse(x)).ToList();

    public const int INF = int.MaxValue / 2;
    #endregion
}


Measured memory_bytes: 11348
#include <iostream>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);++i)

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

  int happy[N][3];
  int dp[N+1][3];
  rep(i, N+1) rep(j, 3) dp[i][j] = 0;
  rep(i, N) rep(j, 3) cin >> happy[i][j];

  rep(i, N) {
    rep(j, 3) {
      dp[i+1][j] = max(dp[i][(j+1)%3] + happy[i][j], dp[i][(j+2)%3] + happy[i][j]);
    }
  }
  cout << max(dp[N][0], max(dp[N][1], dp[N][2])) << endl;
  return 0;
}


Measured memory_bytes: 2560
s = gets.chomp.split("")
l = s.length - 1

ans = 0
for i in 0..(2**l-1)
    ss = s.clone
    exp = []
    while ss.size > 0
        exp << ss.shift
        exp << "+" if i % 2 == 1
        i = i >> 1
    end
    ans += eval exp.join
end
puts ans

Measured memory_bytes: 2044
import sys
from collections import deque
stdin = sys.stdin

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

s = input()
ans = 753
for i in range(len(s) - 2):
    num = int(s[i:i+3])
    ans = min(ans, abs(num-753))
print(ans)

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

#define int long long
#define vvi vector<vector<int>>
#define vec vector
#define pq priority_queue
#define all(v) (v).begin(), (v).end()
#define uniqueV(x) sort(x.begin(), x.end()); x.erase(unique(x.begin(), x.end()), x.end());
#define rep(i, n) for (int (i) = (0); (i) < (n); ++(i))
#define repp(i, m, n) for (int (i) = (m); (i) < (n); ++(i))
#define dbg(x) cerr << #x << ": " << x << endl;
#define dbg2(x, y) cerr<<"("<<#x<<", "<<#y<<") = "<<"("<<x<<", "<<y<<")"<<endl;
#define dbg3(x, y, z) cerr<<"("<<#x<<", "<<#y<<", "<<#z<<") = "<<"("<<x<<", "<<y<<", "<<z<<")"<<endl;
#define dbgB(value, size) cerr<<#value<<": "<<bitset<size>(value) << endl;
#define line() cerr << "---------------" << endl;

const int dx[] = {1, -1, 0, 0};
const int dy[] = {0, 0, -1, 1};
const double PI = 3.14159265358979323846;

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<typename T>
void print1(T begin, T end) {
  while (begin != end) {
    cout << (*begin) << " ";
    *begin++;
  }
  cout << endl;
}

template<typename T>
void print2(T Array, int height, int width) {
  for (int i = 0; i < height; i++) {
    for (int j = 0; j < width; j++) {
      cout << " " << Array[i][j];
    }
    cout << endl;
  }
}

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

signed main() {
  string s;
  cin >> s;

  int n = s.size();
  for (int i = 0; i < n; i++) {
    for (int j = 0; j <= n; j++) {
      string t = "";
      for (int k = 0; k < n; k++) {
        if (i <= k && k < j) {
          continue;
        } else {
          t += s[k];
        }
      }
      if (t == "keyence") {
        puts("YES");
        return 0;
      }
    }
  }

  puts("NO");

  return 0;
}

Measured memory_bytes: 256
/**
 * icpc??´?????????
* 2006??´ ?????? B??????
**/
import java.util.ArrayList;
import java.util.HashSet;
import java.io.*;

class Main{
	static String a;
	static String b;
	public static void main(String[] args) {
		try {
			run();
		}catch(IOException e) {
			System.out.println(e);
		}
	}
	
	static void run() throws IOException{
		int m;
		String str;
		HashSet<String> set = new HashSet<String>();
		
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		while(true) {
			m = Integer.parseInt(in.readLine()); //???????????£?????????
			
			for(int k=0;k<m;k++) {
				str = in.readLine();
				a = "";
				set.clear();
				
				for(int i=0;i<str.length()-1;i++) {
					a = a + str.charAt(i);
					b = "";
					for(int j=i+1;j<str.length();j++) {
						b = b + str.charAt(j);
						
					}
					
					//a??????
					set.add(a+b);
					set.add(re(a)+b);
					set.add(re(a)+re(b));
					set.add(a+re(b));
					
					//b??????
					set.add(b+a);
					set.add(re(b)+a);
					set.add(re(b)+re(a));
					set.add(b+re(a));
				}
				
				System.out.println(set.size());
			}
			break;
		}
	}
	
	static String re(String str) {
		StringBuffer sb = new StringBuffer(str);
		return sb.reverse().toString();
	}
}

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

int main() {
  int h,w,sx,sy,gx,gy;
  cin >> h >> w >> sx >> sy >> gx >> gy;
  sx--;sy--;gx--;gy--;
  vector<string>data(h);
  rep(i,0,h) cin >> data[i];
  vector<vector<int>>ans(h,vector<int>(w,1e9));
  queue<P>que;
  queue<P>fif;
  que.push(P(sx,sy));
  int c = 0;
  ans[sx][sy] = c;
  while(true){
    while(!que.empty()){
      int x = que.front().first,y = que.front().second;
      que.pop();
      if(x > 0) if(data[x-1][y] == '.' && ans[x-1][y] > c){
        ans[x-1][y] = c;
        que.push(P(x-1,y));
      }
      if(x < h-1) if(data[x+1][y] == '.' && ans[x+1][y] > c){
        ans[x+1][y] = c;
        que.push(P(x+1,y));
      }
      if(y > 0) if(data[x][y-1] == '.' && ans[x][y-1] > c){
        ans[x][y-1] = c;
        que.push(P(x,y-1));
      }
      if(y < w-1) if(data[x][y+1] == '.' && ans[x][y+1] > c){
        ans[x][y+1] = c;
        que.push(P(x,y+1));
      }
      rep(i,0,5) rep(j,0,5){
        int vx = x-2+i,vy = y-2+j;
        if((vx < 0 || vx >= h)||(vy < 0 || vy >= w)) continue;
        if(data[vx][vy] == '.' && ans[vx][vy] > c) fif.push(P(vx,vy));
      }
    }
    c++;
    while(!fif.empty()){
      int x = fif.front().first,y = fif.front().second;
      fif.pop();
      if(ans[x][y] > c){
        que.push(P(x,y));
        ans[x][y] = c;
      }
    }
    if(que.empty()){
      if(ans[gx][gy] == 1e9) cout << -1 << endl;
      else cout << ans[gx][gy] << endl;
      return 0;
    }
  }
}

Measured memory_bytes: 9812
import java.util.*;
     
class Main{
    public static void main(String[] args) {
        
        try(Scanner sc = new Scanner(System.in)){
            int s = Integer.parseInt(sc.next());
            int w = Integer.parseInt(sc.next());

            if(w >= s) System.out.println("unsafe");
            else System.out.println("safe");

        }catch(Exception e){
            e.printStackTrace();
        }        
    }
}

Measured memory_bytes: 35724
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <string>
#include <stack>
#include <vector>
#include <iostream>
#include <stdlib.h>
using namespace std;

int main()
{
  int a[3];
  int ans=0;
  int flag = false;
  cin >> a[0] >> a[1] >> a[2];
  sort(a,a+3);

  while(a[0]%2 != 1 && a[1]%2 != 1 && a[2]%2 != 1){
    if(a[0] == a[2]){
      flag = true;
      break;
    }
    else{
      int x,y,z;
      x = (a[0] + a[1]) / 2;
      y = (a[0] + a[2]) / 2;
      z = (a[1] + a[2]) / 2;
      a[0] = x;
      a[1] = y;
      a[2] = z;
      ans++;
    }
  }

  if(flag)
    cout << -1 << endl;
  else
    cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define ll long long
#define rep(i,j,n) for(int i=j; i<n; i++)
#define INF 1000000000000000000 // If you use it, make sure not to put in "int" type variable ;(, use long long int
void optimizeIO() { ios_base::sync_with_stdio(false); cin.tie(NULL); }
const ll mod=1000000007;

int main()
{
    optimizeIO();
    int nT; nT=1;
	while(nT--)
	{
		int h,w,a,b; cin>>h>>w>>a>>b;
        int A[h][w];
        rep(i,0,h) rep(j,0,w) 
        {
            if(i<b) { A[i][j]=((j<a)?0:1); }
            else { A[i][j]=((j<a)?1:0); }
        }
        rep(i,0,h) { rep(j,0,w) cout<<A[i][j]; cout<<'\n'; }
	}
	return 0;
}

Measured memory_bytes: 5120
#include <iostream>
using namespace std;
 
int main(void) {
  int r, c;
  cin >> r >> c;
 
  int ss[r+1][c+1];
  for (int row=0; row<r+1; row++) {
    for (int col=0; col<c+1; col++) {
      ss[row][col] = 0;
    }
  }
 
  for (int row=0;row<r;row++) {
    for (int col=0;col<c;col++) {
      int val;
      cin >> val;
      ss[row][col] += val;;
      ss[row][c] += val;;
      ss[r][col] += val;;
      ss[r][c] += val;;
    }
  }
 
  for (int row=0;row<r+1;row++) {
    for (int col=0; col<c+1;col++) {
      if (col) cout << " ";
      cout << ss[row][col];
    }
    cout << endl;
  }
}

Measured memory_bytes: 1196
#include <bits/stdc++.h>
#define PI 3.1415926535897
using namespace std;
typedef long long ll;
const int INF = 1000000000;
const ll LINF = 1000000000000000000; //1e18
const double EPS = 1e-10;

int main(void)
{
    ll A;
    double B;
    cin >> A >> B;

    ll B100 = (ll)(B * 100 + 0.0001);
    ll ans = A * B100 / 100;
    cout << ans << endl;
    return (0);
}

Measured memory_bytes: 3696
//----AUTHOR:kkdrummer----/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
typedef    long long   ll;
typedef    long double   ld;
//typedef    unordered_set<ll>   usll;
//typedef    unordered_multiset<ll>   umsll;
typedef    multiset<ll>   msll;
typedef    set<ll>   sll;
typedef    vector<ll>   vll;
typedef    pair<ll,ll>   pll;
typedef    vector<pll>   vpll;
typedef    priority_queue<ll>   pqll;
typedef    vector<int>   vi;
typedef    set<int>   si;
typedef    multiset<int>   msi;
//typedef    unordered_multiset<int>   umsi;
//typedef    unordered_set<int>   usi;
typedef     pair<int,int>   pi;
typedef    vector<pi>   vpi;
typedef    set<pi>   spi;
typedef    priority_queue<int>   pqi;
typedef    tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>   ind_set;
typedef    tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update>   ind_setll;
#define    in   insert
#define    fi   first
#define    se   second
#define    pb   push_back
#define    mp   make_pair
#define    be   begin
#define    en   end
#define    itr   iterator
#define io ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define    mo   1000000007
#define    inf  9223372036854775807
#define    ninf   -inf
#define    ima   2147483647
#define    imi   -ima
#define    oncnt    __builtin_popcount
#define    zerobegin   __builtin_clz
#define    zeroend   __builtin_ctz
#define    parity   __builtin_parity
#define all(x) x.be(),x.en()
#define    eps   1e-9
#define    coutd   cout<<setprecision(10)<<fixed
#define    debg(x)  cout<<"#x = "<<x<<"\n";
const    ld   PI=3.14159265359;
inline ll modpow(ll x,ll n){if(n==0)return 1;if(n==1)return(x%mo);ll u=(modpow(x,n/2));u=(u*u)%mo;if(n%2!=0)u=(u*x%mo)%mo;return u;}
inline ll modinv(ll x){return modpow(x,mo-2);}
inline ll mmul(ll a,ll b){    if(a>=mo)a=a%mo;if(b>=mo)b=b%mo;if(a*b>=mo)return(a*b)%mo;return(a*b);}
inline ll madd(ll a, ll b){if(a>=mo)a=a%mo;if(b>=mo)b=b%mo;if(a+b>=mo)return(a+b)%mo;return(a+b);}
inline ll msub(ll a, ll b){if(a>=mo)a=a%mo;if(b>=mo)b=b%mo;return(((a-b)%mo+mo)%mo);}
inline ll mdiv(ll a,ll bb){if(a>=mo)a=a%mo;ll b=modinv(bb);if(b>=mo)b=b%mo;if(a*b>=mo)return(a*b)%mo;return(a*b);}
inline ll gcd(ll a,ll b){return __gcd(a,b);}



int main()
{
io
int testcases=1;//cin>>testcases;
while(testcases--)
{



ld w,h,x,y;
cin>>w>>h>>x>>y;
coutd<<((w*h)/2.00)<<" ";
if(w/2==x&&h/2==y)
cout<<1;
else
cout<<0;








}return 0;}

Measured memory_bytes: 256
#上底の長さ
a = input()
#下底の長さ
b = input()
#高さ
h = input()
#答え
ans = 0
#文字列を数値化しつつ
#(上底+下低)*高さ/2で台形の面積を求める
ans = (int(a) + int(b)) * int(h) / 2
#答えを出力
#小数点以下が表示されるのでround()で非表示にしている
print(round(ans))

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

int		main(void)
{
	vector<int> abc(3);
	for (int i = 0; i < 3; i++)
		cin >> abc.at(i);
	sort(abc.begin(),abc.end());
	cout << abc.at(0) + abc.at(1) << endl;
}

Measured memory_bytes: 256
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <algorithm>
#include <utility>
#include <functional>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <fstream>
#include <iomanip>
using namespace std;
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toStr(T x) { ostringstream sout; sout << x; return sout.str(); }
typedef vector<int> vi;
typedef vector<vi>  vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n) FOR(i,0,(n)-1)
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int INF = INT_MAX / 2;
const int MOD = 1000000007;
typedef vector<ll> vl;
typedef vector<vl> vvl;

int main() {
	int N, L;
	cin >> N >> L;
	vs str(N);
	REP(i, N) {
		cin >> str[i];
	}

	sort(ALL(str));
	REP(i, N) {
		cout << str[i];
	}
	cout << endl;

	return 0;
}

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

int main(){
#ifdef LOCAL
    freopen("./input.txt", "r", stdin);
#endif
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    
    int n,p;
    cin >> n >> p;
    string s;
    cin >> s;
    
    if(p == 2){
        ll ans = 0;
        for (int i = 0; i < n; i++){
            if((s[i] - '0')%2 == 0) ans += i+1;
        }
        cout << ans<< "\n";
    }else if(p == 5){
        ll ans = 0;
        for (int i = 0; i < n; i++){
            if((s[i] - '0')%5 == 0) ans += i+1;
        }
        cout << ans<< "\n";
    }else{
        int cur = 1;
        map<ll, int> cnt;
        ll sum = 0, ans = 0;
        cnt[0]++;
        for (int i = n-1; i >= 0; i--){
            sum  += cur * (s[i] - '0');
            sum %= p;
            ans += cnt[sum];
            cnt[sum] += 1;
            cur *= 10;
            cur %= p;
        }
        cout << ans << "\n";
        
    }
    
    return 0;
}


Measured memory_bytes: 1044
#include <bits/stdc++.h>
using namespace std;
#include <math.h>
#include <iomanip>
const int INF=1001001001;

int main() {
  int n;
  cin>>n;
  vector<int>a(n);
  for(int i=0;i<n;i++){
    cin>>a[i];
  }
  sort(a.rbegin(),a.rend());
  int m=a[0];
  double b=m/2;
  int MIN=1e9,ans=0;
  for(int i=1;i<n;i++){
    if(abs(a[i]-b)<MIN){MIN=abs(a[i]-b);ans=a[i];}
  }
  cout<<m<<" "<<ans<<endl;
  return 0;
}

Measured memory_bytes: 3720
N=int(input())
A=list(map(int,input().split()))
A=sorted(A,reverse=True)
ans=A[0]
N-=2
index=1
while(N>0):
    if(N>=2):
        ans+=2*A[index]
        index+=1
        N-=2
    elif(N==1):
        ans+=A[index]
        index+=1
        N-=1
print(ans)

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

using namespace std;

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

const ll LongINF=1e13+7;
const int INF=1e9+7;
const int dx[]={0,1,0,-1};
const int dy[]={1,0,-1,0};

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 <class T, class Y>T GCD(T a, Y b){if(a<b){int c=a;a=b;b=c;}if (a % b == 0){return b;}return GCD(b, a % b);}
template<class T,class Y>T LCM(T a,Y b){return (a*b)/GCD(a,b);}
void clear(queue<pair<int, int>> &q){queue<pair<int, int>> empty;swap(q, empty);} //queueの中身の型は適時変更を忘れない

using vi=vector<int>;
using vii=vector<vi>;

#define REP(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define rv reverse
#define ALL(a) (a).begin(),(a).end()
#define decimal(x) fixed<<setprecision(x)


int main(){
    const long double PI=3.14159265358979323846;
    long double R;
    cin>>R;
    cout<<decimal(5)<<2*R*PI<<endl;
    return 0;
}

//a=97,z=122

Measured memory_bytes: 3828
#define _USE_MATH_DEFINES
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cctype>
#include <climits>
#include <clocale>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

const int MOD = 1'000'000'007; 
const int INF = 1'000'000'000; //1e9
const int NIL = -1;
const long long LINF = 1'000'000'000'000'000'000; // 1e18
const long double EPS = 1E-10;

template<class T, class S> inline bool chmax(T &a, const S &b){
    if(a < b){
        a = b; return true;
    }
    return false;
}
template<class T, class S> inline bool chmin(T &a, const S &b){
    if(b < a){
        a = b; return true;
    }
    return false;
}






int main(){
    int K; std::cin >> K;
    std::string S; std::cin >> S;
    int l(S.length());
    for(int i(0), i_len(std::min(l, K)); i < i_len; ++i){
        std::cout << S[i];
    }
    if(K < l) std::cout << "...";
    std::cout << std::endl;
    return 0;
}


Measured memory_bytes: 3628
let () =
    let a, b, c = stdin.ReadLine () |>
                  (fun str -> str.Split()) |>
                  Array.map int |>
                  fun arr -> (arr.[0], arr.[1], arr.[2])
    (a = b + c || b = a + c || c = a + b) |>
    (function | true -> "Yes" | false -> "No") |>
    printfn "%s"

Measured memory_bytes: 3668
#include<iostream>
#include<cstdio>
#include<set>
#include<algorithm>
#include<queue>
#include<cstring>
using namespace std;
const int N=105;
const int M=2e4+5;
const int E=M*400;
char s[N][N];
int id[N][N],ct;
int he[M],ver[E],nex[E],C[E],tot;
void add(int,int,int);
int d[M],q[M],l,r,S,T;
bool bfs();
int dinic(int,int);
int main(){
    int n,m;scanf("%d%d",&n,&m);
    for(int i=1;i<=n;i++) scanf("%s",s[i]+1);
    int x[2],y[2];
    for(int i=1;i<=n;i++)
    for(int j=1;j<=m;j++)if(s[i][j]=='S'){
        y[0]=i,x[0]=j;
    }else if(s[i][j]=='T') y[1]=i,x[1]=j;
    if(x[0]==x[1]||y[0]==y[1]){
            puts("-1");
            return 0;
    }
    else{
        tot=2;
        for(int i=1;i<=n;i++)
            for(int j=1;j<=m;j++){
                id[i][j]=++ct;
                if(s[i][j]!='.') add(id[i][j],id[i][j]+n*m,1),add(id[i][j]+n*m,id[i][j],0);
            }
        for(int i=1;i<=n;i++){
            for(int j=1;j<=m;j++){
                if(s[i][j]=='.') continue;
                for(int k=i+1;k<=n;k++)if(s[k][j]!='.'){
                    add(id[i][j]+ct,id[k][j],1);
                    add(id[k][j]+ct,id[i][j],1);
                }
                for(int k=j+1;k<=m;k++)if(s[i][k]!='.'){
                    add(id[i][j]+ct,id[i][k],1);
                    add(id[i][k]+ct,id[i][j],1);
                }
            }
        }
    }
    S=id[y[0]][x[0]]+ct,T=id[y[1]][x[1]];
    int maxflow=0,flow;
    while(bfs()) while((flow=dinic(S,1e9))) maxflow+=flow;
    printf("%d",maxflow);
}
int dinic(int u,int flow){
    if(u==T||flow==0) return flow;
    int rest=flow;
    for(int i=he[u];i;i=nex[i])if(C[i]){
        int v=ver[i];
        if(d[v]==d[u]+1){
            int k=dinic(v,min(rest,C[i]));
            if(!k) d[v]=0;
            C[i]-=k,C[i^1]+=k;
            rest-=k;
            if(!rest) return flow;
        }
    }
    return flow-rest;
}
bool bfs(){
    l=r=0;
    memset(d,0,sizeof(d));
    d[S]=1;
    q[r++]=S;
    while(l<r){
        int u=q[l++];
        for(int i=he[u];i;i=nex[i])if(C[i]){
            int v=ver[i];
            if(!d[v]){
                d[v]=d[u]+1;
                q[r++]=v;
                if(v==T) return 1;
            }
        }
    }
    return 0;
}
void add(int u,int v,int w){
    ver[tot]=v;nex[tot]=he[u];C[tot]=w;he[u]=tot++;
    //ver[tot]=u;nex[tot]=he[v];C[tot]=0;he[v]=tot++;
}


Measured memory_bytes: 29056
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vc = vector<char>;
using vs = vector<string>;
using vll = vector<long long>;
using vvi = vector<vector<int>>;
using vvc = vector<vector<char>>;
using vvll = vector<vector<long long>>;
template<class T> inline bool chmax(T &a, T b) { if (a<b) {a=b; return 1;} return 0;}
template<class T> inline bool chmin(T &a, T b) { if (b<a) {a=b; return 1;} return 0;}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int n;
    cin >> n;
    map<int, int> mp;
    rep(i, n) {
        int d;
        cin >> d;
        mp[d]++;
    }
    int m;
    cin >> m;
    rep(i, m) {
        int t;
        cin >> t;
        if (!mp.count(t) || mp[t] == 0) {
            cout << "NO" << endl;
            return 0;
        } else {
            mp[t]--;
        }
    }
    cout << "YES" << endl;
}

Measured memory_bytes: 9600
#include <iostream>
using namespace std;
 
int main(){
  int s;
 
  cin >> s;
  int h = s / 3600; s %= 3600;
  int m = s / 60; s %= 60; 
  cout << h << ":" << m << ":" << s << endl;
 
  return 0;
}

Measured memory_bytes: 3084
n = gets.chomp.to_i
array = []
n_route = Math.sqrt(n).to_i

(1..n_route).to_a.each do |i|
  if n % i == 0
    array << [i, n/i]
  end
end

pick = array.min_by{|a, b| a+b}

puts pick[0] + pick[1] - 2


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

int main () {
    int N;
    cin >> N;
    vector<int> a(3 * N);
    long long  ans = 0;
    for (int i = 0; i < 3 * N; i++) {
        cin >> a.at(i);
    }
    sort(a.begin(), a.end());
    reverse(a.begin(), a.end());
    for (int i = 1; i < 2 * N; i += 2) {
        ans += a.at(i);
    }
    cout << ans << endl;
}

Measured memory_bytes: 1408
#include<bits/stdc++.h>
using namespace std;
typedef  long long ll;
int main()
{
	ll a,b,k,x,i,s=0,y;
	cin>>a;
	while(1)
	{
		s=0;
		for(i=a-1;i>=2;i--)
		{
			if(a%i==0)
			{
				s=1;break;
			}
		}
		if(s==0)
		{
			break;
		}
		a++;
	}
	cout<<a;
	
}

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

const ll MOD = 1e9 + 7;
int H,W;

vector<vector<char>> board;
vector<vector<ll>> dp;

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

    cin >> H >> W;
    
    board.resize(H,vector<char>(W));
    dp.resize(H,vector<ll>(W,0));
    
    for(int i = 0; i < H; i++){
        for(int j = 0; j < W; j++){
            cin >> board[i][j];
        }
    }

    dp[0][0] = 1;
    
    for(int i = 0; i < H; i++){
        for(int j = 0; j < W; j++){
            if(i < H - 1 and board[i+1][j] == '.') dp[i+1][j] = (dp[i+1][j] + dp[i][j]) % MOD;
            if(j < W - 1 and board[i][j+1] == '.') dp[i][j+1] = (dp[i][j+1] + dp[i][j]) % MOD;
        }
    }
    
    cout << dp[H-1][W-1] << '\n';
    
}


Measured memory_bytes: 9088
#include<bits/stdc++.h>
using namespace std;
const double pi=M_PI;
int main(void)
{
  short A,B,H,M;
  cin>>A>>B>>H>>M;
  return printf("%.20lf",pow(A*A+B*B-2*A*B*cos(((H*60+M)/2.0-6*M)*pi/180.0),0.5)),0;
}

Measured memory_bytes: 4220
# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <tuple>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <bitset>
# include <complex>
# include <chrono>
# include <random>
# include <limits.h>
# include <unordered_map>
# include <unordered_set>
# include <deque>
# include <cstdio>
# include <cstring>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
constexpr long long MOD = 1000000000 + 7;
constexpr long long INF = 1e17 - 10;
const double PI = acos(-1);
typedef pair<LL, LL> Pll;
typedef pair<LL, LL> Vec2;
LL h, w, n, m, s, t, ans = 0, a[100000], b[100000], num = 1, sum = 0, dp[3200][3200] = {};
string str;
int main() {
	cin >> str;
	
	cout << "2018/01/" << str[8] << str[9] << endl;
	return 0;
}


Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		solver();
	}

	@SuppressWarnings("unchecked")
	static void solver() {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int w = sc.nextInt();
		int h = sc.nextInt();
		int[] x = new int[n];
		int[] y = new int[n];
		ArrayList<Integer>[] x_ord = new ArrayList[w];
		ArrayList<Integer>[] y_ord = new ArrayList[h];
		for (int i = 0; i < w; i++)
			x_ord[i] = new ArrayList<>();
		for (int i = 0; i < h; i++)
			y_ord[i] = new ArrayList<>();
		int x0 = 0, xw = 0, y0 = 0, yh = 0;
		for (int i = 0; i < n; i++) {
			x[i] = sc.nextInt() - 1;
			y[i] = sc.nextInt() - 1;
			if (x[i] == 0 && x0 == 0)
				x0++;
			else if (x[i] == w - 1 && xw == 0)
				xw++;
			if (y[i] == 0 && y0 == 0)
				y0++;
			else if (y[i] == h - 1 && yh == 0)
				yh++;
			x_ord[x[i]].add(i);
			y_ord[y[i]].add(i);
		}
		int d = Math.max(Math.max(x0, xw), Math.max(y0, yh));

		DJSet ds = new DJSet(n);
		for (int i = 0; i < w; i++) {
			while (!x_ord[i].isEmpty()) {
				for (int j = 0; j < x_ord[i].size(); j++) {
					ds.setUnion(x_ord[i].get(0), x_ord[i].get(j));
				}
				x_ord[i].clear();
			}
		}
		for (int i = 0; i < h; i++) {
			while (!y_ord[i].isEmpty()) {
				for (int j = 0; j < y_ord[i].size(); j++) {
					ds.setUnion(y_ord[i].get(0), y_ord[i].get(j));
				}
				y_ord[i].clear();
			}
		}
		int sum = n - ds.count();
		if (ds.count() == 1) {
			System.out.println(sum);
		} else {
			sum +=2 * ds.count() - 1 - d;
			System.out.println(sum);
		}

	}

	public static class DJSet {
		int n;// the number of vertices
		int[] d;

		DJSet(int n) {
			this.n = n;
			d = new int[n];
			Arrays.fill(d, -1);
		}

		int root(int x) {
			return d[x] < 0 ? x : root(d[x]);
		}

		boolean setUnion(int x, int y) {
			x = root(x);
			y = root(y);
			if (x != y) {
				if (x < y) {
					int d = x;
					x = y;
					y = d;
				}
				// x>y
				d[y] += d[x];
				d[x] = y;
			}
			return x != y;
		}

		boolean equiv(int x, int y) {
			return root(x) == root(y);
		}

		// the number of nodes of which graph contains x
		int size(int x) {
			return d[root(x)] * (-1);
		}

		// the number of connected graphs
		int count() {
			int ct = 0;
			for (int u : d) {
				if (u < 0)
					ct++;
			}
			return ct;
		}
	}
}

Measured memory_bytes: 85388
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>

using namespace std;

int N;

int main(){
    while(1){
        cin >> N;
        if(N == 0)break;

        vector<int> data;
        data.resize(N);
        string card;

        cin >> card;
        int field = 0;

        for(int i=0;i<100;i++){
            if(card[i] == 'M')data[i%N]++;
            else if(card[i] == 'S'){
                field += data[i%N] + 1;
                data[i%N] = 0;
            }
            else if(card[i] == 'L'){
                data[i%N] += field + 1;
                field = 0;
            }
        }
        sort(data.begin(),data.end());
        for(int i=0;i<N;i++)printf("%d ",data[i]);
        printf("%d",field);
        printf("\n");
    }
    return 0;
}

Measured memory_bytes: 1228
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Math;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            A();
        }

        static void A()
        {
            var N = ReadInt();
            var A = ReadSplitInt();

            var min = int.MaxValue;
            for (int i = 1; i < N; i++)
            {
                min = Min(Gcd(A[i], A[i - 1]), min);
            }
            Println(min);
        }

        static IEnumerable<int> Range(int start, int stop)
        {
            if (start < 0 || stop < 0 || start > stop || (start <= 0 && stop <= 0))
                return new List<int>();

            return Enumerable.Range(start, stop - start);
        }

        static bool IsDigit(string str)
        {
            var i = 0;
            return int.TryParse(str, out i);
        }

        static int DigitsSum(long num)
        {
            return num.ToString().Select(x => x.ToString()).Sum(int.Parse);
        }

        static int[] ToIntArray(string str)
        {
            return str.Select(x => x.ToString()).Select(int.Parse).ToArray();
        }

        static int Gcd(int a, int b) => b == 0 ? a : Gcd(b, a % b);

        static bool IsPrime(int x)
        {
            if (x <= 1 || (x != 2 && x % 2 == 0)) return false;
            if (x == 2) return true;

            for (int i = 3; i < x; i += 2)
                if (x % i == 0) return false;

            return true;
        }

        static string Read() => Console.ReadLine();
        static int ReadInt() => int.Parse(Read());
        static long ReadLong() => long.Parse(Read());

        static List<string> ReadSplit() => Read().Split().ToList();
        static List<int> ReadSplitInt() => Read().Split().Select(int.Parse).ToList();
        static List<long> ReadSplitLong() => Read().Split().Select(long.Parse).ToList();

        static void Print(object value) => Console.Write(value.ToString());
        static void Println(object value) => Console.WriteLine(value.ToString());

        static string Join<T>(IEnumerable<T> list) => string.Join("", list);
    }

    public static class MyExtensions
    {
        public static string Slice(this string str, int start = 0, int stop = 0)
        {
            if (start > str.Length || stop > str.Length || start < 0 || stop < 0)
                return "";

            if (stop == 0) stop = str.Length;
            return str.Substring(start, stop - start);
        }
    }
}


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

typedef long long ll;
#define all(x) (x).begin(),(x).end()

int main(){
    
    double N,M,D;cin>>N>>M>>D;
    if(D!=0) cout<<setprecision(15)<<(N-D)*2*(M-1)/N/N<<endl;
    else cout<<setprecision(15)<<(N-D)*(M-1)/N/N<<endl;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
long long  N=0;
long long sn=0;

long long findSumOfDigits(long long n) {
  long long sum = 0;
  while (n > 0) { // n が 0 になるまで
    sum += n % 10;
    n /= 10;
  }
  return sum;
}

int main(){
  cin >> N;
  sn = findSumOfDigits(N);
    if(N%sn==0){
      cout << "Yes"  << endl;
    }else {
      cout << "No"  << endl;
    }
  return 0;
}

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

using namespace std;

#define DUMP(x) std::cout << (#x) << " = " << (x) << "\n"
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define REP(i, k, n) for (int i = (k); i < (int)(n); ++ i)
#define ALL(r) r.begin(), r.end()
#define YES puts("YES")
#define Yes puts("Yes")
#define NO puts("NO")
#define No puts("No")
#define IMP puts("IMPOSSIBLE")
#define Imp puts("Impossible")
#define pb push_back

template<typename T> T DUP(T x, T y) { return (x + y - 1) / y; };

using ll = int64_t;
using vint = vector<int32_t>;
using vvint = vector<vint>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vstr = vector<string>;
using pint = pair<int32_t, int32_t>;
using setint = unordered_set<int32_t>;
using setstr = unordered_set<string>;
using qint = queue<int32_t>;

constexpr std::int32_t INF = 1001001001;

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;
}

template <typename A, size_t N, typename T>
void arrayFill(A(&array)[N], const T& val) {
    std::fill((T*)array, (T*)(array + N), val);
}

double dp[3005][3005];
void Main() {
    arrayFill(dp, 0);
    int n;
    cin >> n;
    vector<double> p(n);
    rep(i, n)cin >> p[i];
    dp[0][0] = 1;

    rep(i, n) {
        rep(j, n) {
            dp[i + 1][j] += dp[i][j] * (1 - p[i]);
            dp[i + 1][j + 1] += dp[i][j] * p[i];
        }
    }

    double ans = 0;
    for(int i = DUP(n, 2); i <= n; ++i){
        ans += dp[n][i];
    }
    cout << ans << endl;

}

int main() {
    std::cin.tie(nullptr);
    std::ios_base::sync_with_stdio(false);
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}


Measured memory_bytes: 70784
fun main() {
    val builder = StringBuilder()

    val min = -3_000_000

    val (n, k, c) = readInputLine().split(" ").map { it.toInt() }

    val s = readInputLine().toCharArray()

    var prev = min
    var cnt = 0

    val front = IntArray(k)

    for ((i, work) in s.withIndex()) {
        if (work == 'o' && i - prev > c) {
            prev = i
            front[cnt] = i + 1
            cnt++
            if (cnt == k) {
                break
            }
        }
    }

    prev = min
    cnt = 0

    val back = IntArray(k)

    for ((i, work) in s.reversed().withIndex()) {
        if (work == 'o' && i - prev > c) {
            prev = i
            back[k - 1 - cnt] = n - i
            cnt++
            if (cnt == k) {
                break
            }
        }
    }

    for (i in 0 until k) {
        if (front[i] == back[i]) {
            builder.appendln(front[i])
        }
    }

    print(builder.toString())
}

fun readInputLine(): String {
    return readLine()!!
}


Measured memory_bytes: 52624
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int N = 2e5 + 10;
#define fi first
#define se second
#define pb push_back
#define mp make_pair
int n,m,S;
struct uzi{
	int t,a,b;
};
struct wzh{
	int a,b;
	LL d;
	bool operator < (const wzh &t) const {
		return d>t.d;
	}
};
int c[N],d[N];
LL dis[55][55];
vector<uzi>v[N];
LL dp[55][51*51];
void dfs(int s){
	priority_queue<wzh>q;
  int mx=n*50;
	memset(dp,0x3f3f3f3f,sizeof dp);
  S=min(S,mx);
	dp[1][S]=0;
	q.push({1,S,0ll});
	while(!q.empty()){
		auto x=q.top();
		q.pop();
		for(auto k:v[x.a]){
			int less=x.b-k.a;
			LL dis=x.d+k.b,up=0;
			int fl=0;
			while(less<=mx){
				if(less>=0){
					if(dp[k.t][less]>dis+up){
						dp[k.t][less]=dis+up;
						q.push({k.t,less,dp[k.t][less]});
					}
        }
				up+=d[x.a];
				less+=c[x.a];
				if(less>mx&&!fl){
					less=mx;
					fl=1;
				}
			}
		}
	}
}
int main(){
  ios::sync_with_stdio(false);
  cin>>n>>m>>S;
  for(int i=1;i<=m;i++){
  	int s,t,a,b;
  	cin>>s>>t>>a>>b;
  	v[s].pb({t,a,b});
  	v[t].pb({s,a,b});
  }
  for(int i=1;i<=n;i++){
  	cin>>c[i]>>d[i];
  }
  dfs(1);
  for(int i=2;i<=n;i++){
  	LL ans=1e18;
  	for(int j=0;j<=50*50;j++){
  		ans=min(ans,dp[i][j]);
  	}
  	cout<<ans<<'\n';
  }
 	return 0;
}

Measured memory_bytes: 42124
class InputLine
  def self.to_s
    gets.chomp
  end

  def self.to_i
    InputLine.to_s.to_i
  end
  
  def self.to_f
    InputLine.to_s.to_f
  end

  def self.to_sa
    InputLine.to_s.split(' ')
  end

  def self.to_ia
    InputLine.to_sa.map(&:to_i)
  end
  
  def self.to_fa
    InputLine.to_sa.map(&:to_f)
  end
end

def main(argv)
  s = InputLine.to_s

  puts (((s[2] == s[3]) && (s[4] == s[5])) ? 'Yes' : 'No')
end

if self.to_s == 'main' then
  main(ARGV)
end

Measured memory_bytes: 1788
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n=sc.nextInt(),m=sc.nextInt(),s=0,buff=-1;
		int[] c = new int[5];
		for(int i=0;i<5;i++) {
			c[i]=-1;
		};
		for(int i=0;i<m;i++) {
			s=sc.nextInt();
			buff=sc.nextInt();
			if(c[s-1]!=-1&&c[s-1]!=buff) {
				System.out.println(-1);
				System.exit(0);
			}
			c[s-1]=buff;
		}
		StringBuilder res= new StringBuilder();
		if(c[0]==0 && n!=1) {
			System.out.println(-1);
			System.exit(0);
		}
		for(int i=0;i<n;i++) {
			if(c[i]==-1&&i==0&&n!=1) {
				res.append("1");
			}else if(c[i]==-1) {
				res.append(0);
			}else {
				res.append(c[i]);
			}
		}
		System.out.println(res.toString());
	}
}



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


 
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
  
  int n;
  cin >> n;
  double v[n];
  int tmp=0;
  
  for(int i=0;i<n;i++){
    cin >> v[i];
  }
  
    for (int i=0; i<n; ++i) {
    for (int j=i+1; j<n; ++j) {
      if (v[i] > v[j]) {
        tmp =  v[i];
        v[i] = v[j];
        v[j] = tmp;
      }
    }
  }
  
  double v0=v[0];
  for(int i=1;i<n;i++){
  	v0=(v0+v[i])/2;
  }
  
  
  cout << v0 << endl;
  
  
  

}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
 
 
public class Main {
    public static void main(String[] args) throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        String str2[] = br.readLine().split(" ");
        long sum = 0;
        int tmp = 0;
        int max = -1000000;
        int min = 1000000;
        for(int i = 0; i < n; i++){
            tmp = Integer.parseInt(str2[i]);
            if(tmp > max) max = tmp;
            if(tmp < min) min = tmp;
            sum += tmp;
        }
        System.out.println(min+" "+max+" "+sum);
    }
}

Measured memory_bytes: 28448
#include<bits/stdc++.h>
#include<iostream>
#include<string>
#include<cmath>
#include<cstdio>
#include<cctype>
#include<cstring>
#include<iomanip>
#include<cstdlib>
#include<ctime>
#include<set>
#include<map>
#include<utility>
#include<queue>
#include<vector>
#include<stack>
#include<sstream>
#include<algorithm>
/************************************************/
#define rep(i,n) for(int i=0;i<n;i++)
#define m_p make_pair
#define pb push_back
#define fr first
#define se second
#define forn(i,a,n) for(int i=a;i<n;i++)
#define foreach(i,c) for(__typeof(c.begin())i=(c.begin());i!=(c).end();i++)
#define pii pair<int,int>
#define vi vector<int>
#define ll long long
#define sz(s) s.size()
#define all(s) s.begin(),s.end()
#define zero(x) memset(x,0,sizeof(x))
#define vii vector<pair<int,int> >
#define mpis map<int,string>
#define mpii map<int,int>
#define mpsi map<string,int>
#define re return
#define mod 1000000007
/************************************************/
using namespace std;

long long get(){
	char c=getchar();
	long long x=0LL;
	while(c<'0'||c>'9')
	c=getchar();
	while(c>='0'&&c<='9'){
		x*=10LL;
		x+=(c-'0');
		c=getchar();
	}
	return x;
}
int a,b,c;
int main(){
	ios::sync_with_stdio(0);
	cin>>a>>b>>c;
	int num=0;
	if(a==b){
		if(a==c){
			cout<<"No";
		}else{
			cout<<"Yes";
		}
	}else{
		if(b==c)
		cout<<"Yes";
		else{
			if(a==c)
			cout<<"Yes";
			else
			cout<<"No";
		}
		
	}
	re 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <string>
#include <sstream>
#include <stack>
#include <algorithm>
#include <cmath>
#include <queue>
#include <map>
#include <set>
#include <cstdlib>
#include <bitset>
#include <tuple>
#include <assert.h>
#include <deque>
#include <bitset>
#include <iomanip>
#include <limits>
#include <chrono>
#include <random>
#include <array>
#include <unordered_map>
#include <functional>
#include <complex>

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

const long long MAX = 5100000;
const long long INF = 1LL << 60;
const int inf = 1 << 28;
//const long long mod = 1000000007LL;
//const long long mod = 998244353LL;

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


int main()
{
	/*
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	*/
	vector<char> right = { 'y','u','i','o','p','h','j','k','l','n','m' };
	sort(right.begin(), right.end());
	while (1) {
		string s; cin >> s; if (s == "#") break;
		string t;
		for (ll i = 0; i < s.size(); i++) {
			if (binary_search(right.begin(), right.end(), s[i])) t += '1';
			else t += '0';
		}
		t.erase(unique(t.begin(), t.end()), t.end());
		printf("%lld\n", (ll)t.size() - 1);
	}
	return 0;
	/*
		おまじないを使ったらscanfとprintf関連注意！！！！！！！！！！！！
	*/
}


Measured memory_bytes: 3292
//#include <bits/stdc++.h>
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <stdio.h>
#include <queue>
#include <deque>
#include <set>
#include <stack>
#include <time.h>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> Pii;
typedef pair<int, ll> Pil;
typedef pair<ll, ll> Pll;
typedef pair<ll, int> Pli;

#define fi first
#define se second
#define mp make_pair
 
const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll MOD3 = 1812447359;
const ll INF = 1ll << 60;
const double PI = 2 * asin(1);

void yes() {printf("yes\n");}
void no() {printf("no\n");}
void Yes() {printf("Yes\n");}
void No() {printf("No\n");}
void YES() {printf("YES\n");}
void NO() {printf("NO\n");}

int main(){
	int K; cin >> K;
	string S; cin >> S;
	if (S.length() <= K) cout << S << endl;
	else{
		for (int i = 0; i < K; i++) cout << S[i];
		cout << "..." << endl;
	}

  return 0;
}


Measured memory_bytes: 3600
(async () => {
  process.stdin.setEncoding('utf8');
  let text = '';
  for await (const chunk of process.stdin) text += chunk;

  const lines = text.toString().split('\n');
  const tmpArray = lines[0].split(' ');
  const start = parseInt(tmpArray[0], 10);
  const end = parseInt(tmpArray[1], 10);
  const num = parseInt(tmpArray[2], 10);
  const target = new Array(end - start + 1).fill(null).map((_, i) => i + start)

  const result = target.filter(v => v % num === 0);
  console.log(result.length);
})();



Measured memory_bytes: 30036
#include<bits/stdc++.h>
#define _LIBCPP_DEBUG 0
using namespace std;
typedef long long int ll;
ll MOD = 1e9 + 7;
int INF = 1 << 30;
    
int main(void){


    int N; cin>>N;

    set<string> st;

    for (int i = 0; i < N; ++i) {
        string tmp; cin>>tmp;
        st.insert(tmp);
    }



    cout<<st.size()<<endl;

}

Measured memory_bytes: 19176
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); ++i)
using namespace std;
int main() {
  int n,x;
  cin >> n >> x;
  int sum=0;
  int l=10000;
  int cnt=n;
  rep(i,n) {
    int m;
    cin >> m;
    sum+=m;
    l=min(l,m);
  }
  int y=(x-sum)/l;
  cnt+=y;
  cout << cnt << endl;
  return 0;
}

Measured memory_bytes: 256