akhauriyash/Code-Regression huggingface dataset:
#include<algorithm>
#include<cassert>
#include<cfloat>
#include<climits>
#include<cmath>
#include<cstring>
#include<deque>
#include<functional>
#include<iomanip>
#include<iostream>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<unordered_map>
#include<unordered_set>
#include<utility>
#include<vector>

using namespace std;

using lint = long long;
using P = pair<int, int>;
using LLP = pair<long long, long long>;

#define REP(i, x, n) for(int i = (x), i##_len = int(n) ; i < i##_len ; ++i)
#define rep(i, n) for(int i = 0, i##_len = int(n) ; i < i##_len ; ++i)
#define reps(i, n) for(int i = 1, i##_len = int(n) ; i <= i##_len ; ++i)
#define rrep(i, n) for(int i = int(n) - 1 ; i >= 0 ; --i)
#define rreps(i, n) for(int i = int(n) ; i > 0 ; --i)
#define SORT(x) sort((x).begin(), (x).end())
#define SORT_INV(x) sort((x).rbegin(), (x).rend())
#define TWINS(x) cout << ((x) ? "Yay!" : ":(") << endl

constexpr int IINF = (1 << 30) - 1;
constexpr long long LLINF = 1LL << 61;
constexpr double EPS = 1e-8;

constexpr int dx4[] = {1, 0, -1, 0}, dy4[] = {0, 1, 0, -1};
constexpr int dx8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dy8[] = {0, -1, -1, -1, 0, 1, 1, 1};

template<typename T>
bool chmax(T& a, T b, bool equal = false){
    if(a < b || equal && a == b){
        a = b;
        return true;
    }
    return false;
}

template<typename T>
bool chmin(T& a, T b, bool equal = false){
    if(b < a || equal && a == b){
        a = b;
        return true;
    }
    return false;
}

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

    int n;
    cin >> n;

    string s;
    cin >> s;

    int x = 0;
    int ans = x;
    rep(i, n){
        if(s[i] == 'I'){
            ++x;
        }else{
            --x;
        }
        chmax(ans, x);
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(),(x).rend()
#define IDX(vec, element_iter) distance((vec).begin(), element_iter)
#define pb push_back
#define mp make_pair
#define INF9 1000000000 //10^9
#define MOD 1000000007 //10^9+7
#define fi first
#define sc second
using ll=long long;
using pii=pair<ll,ll>;
using vi=vector<int>;
using vll=vector<ll>;
using vb=vector<bool>;

int main() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout<<fixed<<setprecision(20);
    
    int n,k;cin >> n >> k;
    vll h(n);rep(i,n) cin >> h[i];
    sort(ALL(h));
    ll ans = 10000000000;
    rep(i,n-k+1){
        ans = min(ans,h[i+k-1]-h[i]);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1024
from bisect import bisect_left
inpl = lambda: list(map(int,input().split()))
N = int(input())
P = inpl()
Q = inpl()

a = 1
b = 1
M = 1
for i in range(N-2,-1,-1):
    M *= N-1-i
    a += (bisect_left(sorted(P[i:]),P[i]))*M
    b += (bisect_left(sorted(Q[i:]),Q[i]))*M
print(abs(b-a))

Measured memory_bytes: 38384
#include <bits/stdc++.h>
using namespace std;
static const int N=1000;

int lsc(string X, string Y){
    int c[N+1][N+1];
    int m=X.size();
    int n=Y.size();
    int maxl=0;
    X=' '+ X;
    Y=' '+ Y;
    
    for (int i=0; i<=m; i++) c[i][0]=0;
    for (int i=1; i<=n; i++) c[0][i]=0;
    
    for (int i=1; i<=m; i++){
        for (int j=1; j<=n; j++){
            if(X[i]==Y[j]){
                c[i][j]=c[i-1][j-1]+1;
            }else{
                c[i][j]=max(c[i-1][j],c[i][j-1]);
            }
            maxl=max(maxl,c[i][j]);    
        }
        
    }
    return maxl;
    
}

int main(){
    string s1,s2;
    int n; cin >> n;
    for (int i=0; i<n; i++){
        cin >> s1 >> s2;
        cout << lsc(s1,s2) << endl;
    }
    return 0;
}


Measured memory_bytes: 7068
#include <stdio.h>
int main(void){
	int a[10],b[10],d[10],e[10],c,i,j,x,cnt=0;
	scanf("%d",&x);
	for(i=1;i<=6;i++){
		scanf("%d",&e[i]);
		d[i] = e[i];}
	for(j=0;j<x;j++){
	for(i=1;i<=6;i++){
		scanf("%d",&b[i]);
		a[i] = b[i];}
	for(i=1;i<=5;i++){
		if(a[i]>a[i+1]){
			c = a[i+1];
			a[i+1] = a[i];
			a[i] = c;}
		if(d[i]>d[i+1]){
			c = d[i+1];
			d[i+1] = d[i];
			d[i] = c;}}
	for(i=1;i<=6;i++){
		if(a[i] == d[i])
			cnt++;}
	if((cnt==6) && (a[1]==a[2]) && (a[2]==a[3]) && (a[3]==a[4]) && (a[4]==a[5])){
		printf("No\n");
		return 0;}
	cnt=0;
	for(i=0;i<4;i++){	/*tate idou*/
		if(b[1] == e[1])
			break;
		c = b[1];
		b[1] = b[2];
		b[2] = b[6];
		b[6] = b[5];
		b[5] = c;}
	for(i=0;i<4;i++){	/*tate(1ga yokoniarutoki) idou*/
		if(b[1] == e[1])
			break;
		c = b[1];
		b[1] = b[3];
		b[3] = b[6];
		b[6] = b[4];
		b[4] = c;}
	for(i=0;i<4;i++){	/*yoko idou*/
		if(b[2] == e[2])
			break;
		c = b[2];
		b[2] = b[3];
		b[3] = b[5];
		b[5] = b[4];
		b[4] = c;}
	for(i=1;i<=6;i++){
		if(b[i] == e[i])
			cnt++;}
	if(cnt==6){
		printf("No\n");
		return 0;}
	cnt=0;
	}
	printf("Yes\n");	
	return 0;
}			
	

Measured memory_bytes: 580
def flog2():
	import sys
	def input():return sys.stdin.readline()
	n,k=[int(i) for i in input().split()]
	h=[int(i) for i in input().split()]
	dp=[float('inf')]*n
	dp[0]=0
	for i in range(1,n):
		dp[i]=min([dp[j]+abs(h[i]-h[j]) for j in range(max(0,i-k),i)])
	print(dp[-1])
	
if __name__ == "__main__":
	flog2()

Measured memory_bytes: 14108
// FindingMissingCards.cc
// 太郎が花子と一緒にトランプ遊びをしようとしたところ、
// 52枚あるはずのカードが n 枚のカードしか手元にありません。
// これらの n 枚のカードを入力として、足りないカードを出力するプログラムを作成して下さい。
//
// 太郎が最初に持っていたトランプはジョーカーを除く52枚のカードです。
//
// 52枚のカードは、スペード、ハート、クラブ、ダイヤの４つの絵柄に分かれており、
// 各絵柄には13のランクがあります。
// 【入力】
// 最初の行に太郎が持っているカードの枚数 n (n ≤ 52)が与えられます。
//
// 続いて n 組のカードがそれぞれ１行に与えられます。
// 各組は１つの空白で区切られた文字と整数です。文字はカードの絵柄を表し、
// スペードが'S'、ハートが'H'、クラブが'C'、ダイヤが'D'で表されています。
// 整数はそのカードのランク(1 ～ 13)を表しています。
// 【出力】
// 足りないカードをそれぞれ1行に出力して下さい。
// 各カードは入力と同様に１つの空白で区切られた文字と整数です。
// 出力するカードの順番は以下のとおりとします：
// 
// 絵柄がスペード、ハート、クラブ、ダイヤの順番で優先的に出力する。
// 絵柄が同じ場合は、ランクが小さい順に出力する。
// 【例】
// 入力：
// 47
// S 10
// S 11
// S 12
// S 13
// H 1
// H 2
// S 6
// S 7
// S 8
// S 9
// H 6
// H 8
// H 9
// H 10
// H 11
// H 4
// H 5
// S 2
// S 3
// S 4
// S 5
// H 12
// H 13
// C 1
// C 2
// D 1
// D 2
// D 3
// D 4
// D 5
// D 6
// D 7
// C 3
// C 4
// C 5
// C 6
// C 7
// C 8
// C 9
// C 10
// C 11
// C 13
// D 9
// D 10
// D 11
// D 12
// D 13
// 出力：
// S 1
// H 3
// H 7
// C 12
// D 8
#include<iostream>
using namespace std;

int main( void) {
  int n;
  int cards[4][13];	// 行は絵柄、列はランク
			// 絵柄：0=S（スペード）,1=H（ハート）,2=C（クラブ）,3=D（ダイヤ）

  char S;
  int suit, rank;

  // カードを記憶する配列を初期化する。
  for ( int i = 0; i < 4; i++) {
    for ( int j = 0; j < 13; j++) {
      cards[i][j] = 0;
    }
  }

  // 太郎が持っているカードを入力から受け取る。
  cin >> n;	// 入力されるカードの枚数
  for ( int i = 0; i < n; i++) {
    cin >> S >> rank;

    if ( S == 'S') suit = 0;
    else if ( S == 'H') suit = 1;
    else if ( S == 'C') suit = 2;
    else suit = 3;

    cards[suit][rank-1] = 1;
  }

  // 太郎が持っていないカードを出力する。
  for ( int i = 0; i < 4; i++) {
    for ( int j = 0; j < 13; j++) {
      if ( cards[i][j] == 0) {
	if ( i == 0) S = 'S';
	else if ( i == 1) S = 'H';
	else if ( i == 2) S = 'C';
	else S = 'D';

	cout << S << " " << j+1 << endl;
      }
    }
  }

  return 0;
}



Measured memory_bytes: 3096
#include <bits/stdc++.h>
#define FOR0(i, n) for (int i = 0; i < n; i++)
#define FOR1(i, n) for (int i = 1; i <= n; i++)
#define FORl(i, l, n) for (int i = l; i < n; i++)
using namespace std;
#define pi pair<ll, ll>
#define pb push_back
#define ll long long
#define ld long double
#define ff first
#define ss second
#define mp make_pair
#define mst0(x) memset(x, 0, sizeof(x));
#define vi vector<ll>
#define sync                      \
	ios_base::sync_with_stdio(0); \
	cin.tie(0);                   \
	cout.tie(0);
#define endl '\n'
#define sp << " " <<
#define intmax 1e14
ll mod = 1e9 + 7;

ll power(ll num, ll g, ll mod)
{
	if (g == 0)
		return 1;
	if (g % 2 == 1)
		return (num * power((num * num) % mod, g / 2, mod)) % mod;
	return power((num * num) % mod, g / 2, mod);
}

int main() {
    string s, t;
    cin >> s >> t;
    int n = s.size();
    int ans = 0;
    for (int i = 0; i < n; i++){
        if (s[i]!=t[i]) ans++;
    }
    cout << ans;
}

Measured memory_bytes: 3916
n=int(input())
a=list(map(int,input().split()))

dict={}

for i in range(n):
    if not a[i] in dict:
        dict[a[i]]=0
    dict[a[i]]+=1


a=sorted(dict.items(), key=lambda x:x[0])
one=0
two=0
for i in range(len(a)):
    if a[i][1]>3:
            one=a[i][0]
            two=one

    elif a[i][1]>1:
        two=one
        one=a[i][0]
    
print(one*two)

Measured memory_bytes: 72600
using System;

class Program
{
	public struct HonSt
	{
		public int c;
		public int[] a;

		public HonSt(int n)
		{
			a = new int[n];
			c = 0;
		}
	}

	static int[] choice = new int[12];
	static int choiceCnt;

	static void Main(string[] args)
	{
		int i, j, k;

		string[] strInput = Console.ReadLine().Split(' ');
		int n = int.Parse(strInput[0]);
		int m = int.Parse(strInput[1]);
		int x = int.Parse(strInput[2]);

		HonSt[] hon = new HonSt[n];


		for (i = 0; i < n; i++)
		{
			hon[i] = new HonSt(m);
			strInput = Console.ReadLine().Split(' ');
			hon[i].c = int.Parse(strInput[0]);
			for (j = 0; j < m; j++)
			{
				hon[i].a[j] = int.Parse(strInput[j+1]);
			}
		}

		int result = -1;
		int kumiawase = (int)Math.Pow(2, n);
		int c_sum;
		int[] a_sum = new int[m];
		int tassei;
		for(i = 1; i < kumiawase; i++)
		{
			num2choice(i);

			c_sum = 0;
			for(j = 0; j < m; j++)
			{
				a_sum[j] = 0;
			}

			//総当たりでAの合計計算
			for(j = 0; j < n; j++)
			{
				if(choice[j] == 1)
				{
					c_sum += hon[j].c;
					for(k = 0; k < m; k++)
					{
						a_sum[k] += hon[j].a[k];
					}
				}
			}

			//目標達成チェック
			tassei = 1;
			for (j = 0; j < m; j++)
			{
				if(a_sum[j] < x)
				{
					tassei = 0;
					break;
				}
			}
			if(tassei == 1)
			{
				if(result == -1 || c_sum < result)
				{
					result = c_sum;
				}
			}

		}

		Console.WriteLine(result);
		return;
	}

	static void num2choice(int num)
	{
		int i;
		choiceCnt = 0;

		for (i = 0; i < 12; i++)
		{
			if ((num & 0x1) != 0)
			{
				choice[i] = 1;
				choiceCnt++;
			}
			else
			{
				choice[i] = 0;
			}
			num = num >> 1;
		}
	}

}

Measured memory_bytes: 27880
def main():
    
    
    S = input()
    T = input()
    
    t = T[-1]
    
    if S + t == T:
        print('Yes')
    else:
        print('No')
    
    
    # A = list(map(int, input().split(' ')))
    
    # if S == '':
    #     print('')
    # else:
    #     print('')
    

main()

Measured memory_bytes: 61632
import sys

sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    n, k = map(int, input().split())
    S = input().strip()

    cnt = 0
    for i in range(1, n):
        if S[i - 1] == S[i]:
            cnt += 1

    res = min(cnt + k * 2, n - 1)
    print(res)


def resolve2():
    n, k = map(int, input().split())
    S = input().strip()

    score = 0
    diff = 0
    for i in range(1, n):
        if S[i - 1] == S[i]:
            score += 1
        else:
            diff += 1

    print(min(score + min(diff, k) * 2, n - 1))


if __name__ == '__main__':
    resolve2()


Measured memory_bytes: 3316
#include <iostream>
#include <algorithm>
#include<cmath>
#include<cstring>
#include<cstdio>
#include<cstdlib>
#include<vector>
#include<iomanip>
#include<ctime>
#include<set>
#include<map>
#include<queue>
#include<stack>
#define sqr(x) ((x)*(x))
#define fz1(i,n) for ((i)=1;(i)<=(n);(i)++)
#define fd1(i,n) for ((i)=(n);(i)>=1;(i)--)
#define fz0g(i,n) for ((i)=0;(i)<=(n);(i)++)
#define fd0g(i,n) for ((i)=(n);(i)>=0;(i)--)
#define fz0k(i,n) for ((i)=0;(i)<(n);(i)++)
#define fd0k(i,n) for ((i)=(long long)((n)-1);(i)>=0;(i)--)
#define fz(i,x,y) for ((i)=(x);(i)<=(y);(i)++)
#define fd(i,y,x) for ((i)=(y);(i)>=(x);(i)--)
#define fzin fz1(i,n)
#define fzim fz1(i,m)
#define fzjn fz1(j,n)
#define fzjm fz1(j,m)
#define ff(c,itr) for (__typeof((c).begin()) itr=(c).begin();itr!=(c).end();itr++)
#define rdst(st,len){static char ss[len];scanf(" %s",ss);(st)=ss;}
#define inc(x,y) {x+=(y);if(x>=mod)x-=mod;}
#define dec(x,y) {x-=(y);if(x<0)x+=mod;}
using namespace std;
long long ans;
int n,m,i,j,col[100005],vis[100005],c1,c2,c3,ce,cv,b;
vector<int> bi[100005];
vector<int> nbi[100005];
void dfs(int x)
{
	cv++;vis[x]=1;if(col[x]==1)c1++;if(col[x]==2)c2++;if(col[x]==3)c3++;
	int t;if(col[x]==1)t=2;if(col[x]==2)t=3;if(col[x]==3)t=1;ff(bi[x],it){
		ce++;if(col[*it]!=t&&col[*it])b=0;col[*it]=t;if(!vis[*it])dfs(*it);
	}
	if(col[x]==1)t=3;if(col[x]==2)t=1;if(col[x]==3)t=2;ff(nbi[x],it){
		if(col[*it]!=t&&col[*it])b=0;col[*it]=t;if(!vis[*it])dfs(*it);
	}
}
int main()
{
	scanf("%d%d",&n,&m);
	fz1(i,m){
		int x,y;
		scanf("%d%d",&x,&y);
		bi[x].push_back(y);
		nbi[y].push_back(x);
	}
	fz1(i,n){
		if(!vis[i]){
			c1=c2=c3=ce=cv=0;b=1;col[i]=1;dfs(i);
			if(!b)ans+=1ll*cv*cv;else if(c1&&c2&&c3) ans+=1ll*c1*c2+1ll*c2*c3+1ll*c3*c1;else ans+=ce;
		}
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 16640
#include<iostream>
#include<cstring>
using namespace std;

int main()
{
	char s[1200];
	int len;
	cin.getline(s,1200);
	len = strlen(s); 
	for(int i=0;i<len;i++)
	{
		if(s[i]>=65&&s[i]<=90)
			s[i] += 32;
		else if(s[i]>=97&&s[i]<=122)
			s[i] -= 32;
	}
	cout<<s<<endl;
	return 0;
}



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

int main() {
	int n;
	cin>>n;
	int arr[n];
	int brr[n];
	for(int i=0;i<n;i++){
	    cin>>arr[i];
	    brr[i]=arr[i];
	}
	sort(arr,arr+n);
	int cnt=0;
	for(int i=0;i<n;i++){
	    if(brr[i]!=arr[i])cnt++;
	}
	if(cnt<=2){
	    cout<<"YES";
	}
	else cout<<"NO";
	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;
import java.util.List;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.Arrays;
import java.util.Collections;
import java.util.*;
class Main{
  public static void main(String[] args){
    Scanner scan = new Scanner(System.in);
    long A = scan.nextLong();
    long B = scan.nextLong();
    long K = scan.nextLong();
    if (K < A) {
      System.out.println(A - K +" "+ B);
    }
    else if (A + B >= K){
      long C = B + A - K;
      System.out.println(0 +" "+ C);
    }
    else{
      System.out.println(0 + " " + 0);
    }
  }
}


Measured memory_bytes: 22868
while n = gets.to_i
    break if n == 0
    puts gets.chomp
    ss = []
    colon = [0] * (n-1)
    (n - 1).times do |i|
        s = gets.chomp
        s.gsub!(/\.(\w)/, '+\1')
        colon[i] = s.count('.')
        s.gsub!(/\./, ' ')
        ss << s
    end
    max = colon.max
    pos = [-1] * (max + 1)
    (n - 2).times do |idx|
        if colon[idx] > colon[idx + 1]
            (pos[colon[idx + 1]]+1..idx).each do |i|
                ss[i][colon[idx + 1]] = '|'
            end
        end
        pos[colon[idx]] = idx
    end
    ss.each {|s| puts s}
end

Measured memory_bytes: 14172
#include <iostream>
#include <stdio.h>
#include <string.h>
#define MAX_N 105

using namespace std;

int n,m,w,b,W,B,cw=1,cb=0;
int a[MAX_N][MAX_N];

void print()
{
	printf("%d %d\n",n,m);
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=m;j++)
		{
			printf("%c",(a[i][j]^(B<W)) ? '#' : '.');
		}
		printf("\n");
	}
	// for(int i=1;i<=n;i++) printf("-");
	// printf("\n");
}

inline int get_side(int x,int y)
{
	return a[x-1][y]+a[x+1][y]+a[x][y-1]+a[x][y+1];
}

int main()
{
	scanf("%d%d",&w,&b);
	n=m=100,W=w,B=b;
	if(w>b) swap(w,b);
	int x,y;
	for(int i=1;i<=n && cw<w;i++)
	{
		for(int j=1+(!(i&1));j<=m && cw<w;j+=2)
		{
			a[i][j]=1,cb++,x=i,y=j+1;
			if(i>1) cw++;
		}
	}
	// print();
	if(cb>b)
	{
		// cout<<"cb > b"<<endl;
		for(int j=1+(x&1);j<=m && cb>b;j+=2)
		{
			a[x][j]=1,cb-=get_side(x,j)-1;
			if(j==y) x--,j--;
		}
	}
	// print();
	if(cb<b)
	{
		// cout<<"cb < b"<<endl;
		for(int i=n;i>=1 && cb<b;i-=2)
		{
			for(int j=1;j<=m && cb<b;j+=2)
			{
				a[i][j]=1,cb++;
			}
		}
	}
	print();
}


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

using namespace std;
typedef long long ll;

int main()
{
    ios_base::sync_with_stdio(0);

    ll x, y;
    cin >> x >> y;
    if (abs (x - y) <= 1)
        cout << "Brown\n";
    else
        cout << "Alice\n";
}

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

int main() {
	long long N, K,ans=0;
	cin >> N >> K;
	while (N != 0) {
		N /= K;
		ans++;
	}
	cout << ans << endl;
}





Measured memory_bytes: 256
// -----------------------------------
// Author     : MatsuTaku
// Country    : Japan
// Created    : 05/10/20 23:28:18
// -----------------------------------

#include <bits/stdc++.h>

using namespace std;
using ll = long long;

struct Dbl {
  int n,logn;
  vector<vector<int>> tab;
  Dbl(int size, ll k) {
    n = size;
    logn = 0;
    while (1ull<<logn <= k) ++logn;
    tab.resize(logn, vector<int>(n));
  }
  void build() {
    for (int m = 1; m < logn; m++) {
      for (int i  = 0; i < n; i++) {
        int hnxt = tab[m-1][i];
        if (hnxt == -1) continue;
        tab[m][i] = tab[m-1][hnxt];
      }
    }
  }
  int query(int s, ll k) const {
    for (int m = 0; m < logn and s != -1; m++) {
      if ((1ull<<m & k) == 0) continue;
      s = tab[m][s];
    }
    return s;
  }
};

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

  ll n,k; cin>>n>>k;
  vector<int> A(n);
  for (auto& a:A) cin>>a;
  Dbl dbl(n, k);
  for (int i = 0; i < n; i++)
    dbl.tab[0][i] = A[i]-1;
  dbl.build();
  cout << dbl.query(0, k)+1 << endl;

  return 0;
}


Measured memory_bytes: 51720
while True:
    H, W = map(int, input().split())
    if H == 0 and W == 0:
        break
    for h in range(H):
        for w in range(W):
            if h % 2 == 0:
                print('#.'[w % 2], end='')
            if h % 2 != 0:
                print('.#'[w % 2], end='')
        print()
    print()



Measured memory_bytes: 7000
#include <bits/stdc++.h>
#include <boost/range/irange.hpp>
using namespace std::literals;
using namespace std;

namespace xmaho
{
inline namespace input
{
template<typename T>
T get_value(std::istream& is = std::cin);
template<typename C>
C get_container(std::istream& is = std::cin, typename C::size_type length = std::numeric_limits<typename C::size_type>::max());
}
}
using namespace xmaho;

int main()
{
  double r;
  cin >> r;
  cout << 2. * r * 3.14159 << endl;
  return 0;
}

class initalization
{
  class custom_numpunct: public std::numpunct<char>
  {
  public:
    using numpunct::numpunct;
  protected:
    std::string do_truename() const override { return "Yes"; }
    std::string do_falsename() const override { return "No"; }
  };

public:
  initalization()
  {
    std::ios_base::sync_with_stdio(false);
    std::cin.tie(nullptr);
    std::cout.imbue(std::locale(std::cout.getloc(), new custom_numpunct{}));
    std::cout << std::boolalpha << std::fixed << std::setprecision(15);
  }
} initalize;

template<typename T>
T xmaho::input::get_value(std::istream& is)
{ T v {}; is >> v; return v; }

template<typename C>
C xmaho::input::get_container(std::istream& is, typename C::size_type length)
{
  C v {};
  if (length != std::numeric_limits<typename C::size_type>::max())
    v.reserve(length);
  typename C::value_type e {};
  for (auto i {length}; i != 0 && is >> e; --i)
    v.push_back(std::move_if_noexcept(e));
  return v;
}


Measured memory_bytes: 3784
#pragma GCC optimize("O3")
#pragma GCC target("sse4")

#include <bits/stdc++.h>

// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;

using namespace std;

typedef long long ll;
typedef long double ld;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;

const int MXN = 2e5, IINF = 1e9 + 10, INF = 1e18 + IINF + 10, MOD = 1000000007;
const ld PI = 4.0 * atanl(1.0), PREC = .000001;
const char nl = '\n';

#define FOR(i, a, b) for (int i = a; i < (b); i++)
#define F0R(i, a) for (int i = 0; i < (a); i++)
#define FORd(i, a, b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i, a) for (int i = (a)-1; i >= 0; i--)
#define trav(a, x) for (auto& a : x)
#define uid(a, b) uniform_int_distribution<int>(a, b)(rng)

#define f first
#define s second
#define pb push_back
#define mp make_pair
#define all(x) x.begin(), x.end()
#define rall(x) x.end(), x.begin()
#define lb lower_bound
#define ub upper_bound
#define sz(x) (int)(x).size()
#define ins insert

int n, m, t, a[MXN];

void fast() { ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0); }

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

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

int main() {
  fast();
  cin >> n >> t;
  FOR(i, 0, n) cin >> a[i];
  int s = t;
  FOR(i, 0, n - 1) { s += min(t, a[i + 1] - a[i]); }
  cout << s;

  return 0;
}



Measured memory_bytes: 4316
/*2019/07/29 */
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
#define MOD 1000000007
typedef long long int ll;
void llswap(ll *x,ll *y){ll temp;temp=*x;*x=*y;*y=temp;}
void swap(int *x,int *y){int tmp;tmp=*x;*x=*y;*y=tmp;}
int rmax(int x,int y){return x>y?x:y;}
int rmin(int x,int y){return x>y?y:x;}
ll llrmax(ll x,ll y){return x>y?x:y;}
ll llrmin(ll x,ll y){return x>y?y:x;}
int asc(const void *a,const void *b){return *(int*)a-*(int*)b;}
int desc(const void *a,const void *b){return *(int*)b-*(int*)a;}
/*
int asc_t(const void *a,const void *b){return ((user_t*)a)->score - ((user_t*)b)->score;}
int desc_t(const void *a,const void *b){return ((user_t*)b)->score - ((user_t*)a)->score;}
*/

int main(){
    int n;
    int v[200];

    scanf("%d",&n);
    for(int i=0;i<n;i++){
        scanf("%d",&v[i]);
    }
    qsort(v,n,sizeof(int),asc);

    double tmp=v[0];
    for(int i=1;i<n;i++){
        tmp=(tmp+v[i])/2.0;
    }
    printf("%.8lf\n",tmp);
    return 0;
}

Measured memory_bytes: 128
#include <cstdio>
#include <iostream>
#include <vector>
#include <algorithm>
#include <math.h>
#include <string>
#include <list>

#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 all(c) c.begin(),c.end()

using namespace std;

int N, M, K, W,X;

int main() {
	int A, B,T,res = 1001;
	
	cin >> N >> T;
	vector <int> c(N), t(N);

	rep(i, N) {
		cin >> c[i] >> t[i];
		if (t[i] <= T) res = min(res, c[i]);
	}

	if (res != 1001) cout << res;
	else cout << "TLE";



}

Measured memory_bytes: 256
#include<stdio.h>

int i=0;

int atoi(char c){
  if('0' <= c && c <= '9') return (c-'0');
  return -1;
}

void push(int f[],int x){
  f[++i] = x; 
}

int pop(int f[]){
  return f[i--];
}

int main(){

  char c,s[10];
  int f[101],x,y,e=1;
  int j=0,k,check=0;

  while(scanf("%c",&c)){
    if(c==' '){
      if(check){
	x=0;
	for(k=j-1;k>=0;k--){
	  x += atoi(s[k])*e;
	  e *= 10;
	}
	push(f,x);
	check = 0;
	j = 0;
	e = 1;
      }
      continue;
    }
    else if(c == '\n') break;
    else if('0' <= c && c <= '9'){
      s[j] = c;
      j++;
      check = 1;
    }
    else{
      x = pop(f);
      y = pop(f);
      
      if(c == '+'){
	x += y;
      }
      else if(c == '-'){
	x = y - x;
      }
      else if(c == '*'){
	x *= y;
      }
      push(f,x);
     
    }
  }

  printf("%d\n",f[i]);
  
  return 0;
}




Measured memory_bytes: 2084
#include <bits/stdc++.h>
using namespace std;
int a[200005];
typedef long long ll;
ll mod = 1000000007;
ll fa[100005];
ll po(ll a, int b)
{
    if(b==0)return 1;
    ll x = po(a, b/2);
    x = (x*x)%mod;
    if(b%2)x = (a*x)%mod;
    return x;
}
vector<int> v[100005];
ll ncr(int n, int r)
{
    if(r > n)return 0;
    if(r < 0)return 0;
    ll num = fa[n];
    ll den = (fa[r] * fa[n-r])%mod;
    den = po(den, mod-2);
    return (num * den)%mod;
}
int main() {
	int n,i;
	fa[0] = 1;
	for(n=1;n<=100001;n++)
	fa[n] = (n * fa[n-1])%mod;
	scanf("%d",&n);
	for(i=1;i<=n+1;i++){
	scanf("%d",&a[i]);
	v[a[i]].push_back(i);
	}
	for(i=1;i<=n;i++)
	if(v[i].size()==2)break;
	
//	printf("%d starting and %d ending\n",v[i][0]-1,n+1-v[i][1]);
    int st = v[i][0] -1;
    int en = n + 1 - v[i][1];
   
    int  len;
    for(len=1; len<=n+1;len++)
    {
        ll total = ncr(n+1, len);
        ll rem=0;
       rem = ncr(en +st, len-1);
        printf("%lld\n",(mod + total-rem)%mod);
    }
   
	return 0;
}


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

using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(),v.end()
#define _GLIBCXX_DEBUG
int main() {
    int n;
    cin>>n;
    //しゃくとり法
    int a[n];
    rep(i,n){
        cin>>a[i];
    }
    int l=0,r=0;//l~rの区間が条件を満たすか？
    map<int,int> d;
    bitset<20> s0(a[0]);
    rep(i,20){
        if (s0.test(i)){
            d[i]=1;
        }
        else{
            d[i]=0;
        }
    }

    int b=1;
    long long ans=1;
    while(r<n-1 or b==0){
        if (b==1){
            r+=1;
            bitset<20> sr(a[r]);
            rep(j,20){
                if (sr.test(j)){
                    d[j]+=1;
                    if (d[j]>=2){
                        b=0;
                    }
                }
            }
            if (b==1){
                ans+=r-l+1;
            }
        }
        else{
            bitset<20> sl(a[l]);
            b=1;
            rep(j,20){
                if (sl.test(j)){
                    d[j]-=1;
                }
                if (d[j]>=2){
                    b=0;
                }
            }
            l+=1;
            if (b==1){
                ans+=r-l+1;
            }
        }
    }
    cout<<ans<<endl;

    return 0;
}

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

int d, n, c;
long x[11][11], s, dx, ss;

int main(){
	cin >> n >> d;
	for (int i = 0; i < n; ++i){
		for (int j = 0; j < d; ++j){
			cin >> x[i][j];
		}
	}
	c = 0;
	for (int i = 0; i < n; ++i){
		for (int j = i+1; j < n; ++j){
			s = 0;
			for (int k = 0; k < d; ++k){
				dx = x[i][k] - x[j][k];
				s += dx*dx;
			}
			ss = static_cast<long>(sqrt(s));
			if (ss*ss == s) c++;
		}
	}
	cout << c;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;using ll=long long;using vi=vector<int>;using vvi=vector<vi>;using vl=vector<ll>;using vvl=vector<vl>;using P=pair<int,int>;using PL=pair<ll,ll>;using vp=vector<P>;using vpl=vector<PL>;
template<typename T>constexpr auto inf=numeric_limits<T>::max()/2;
constexpr int INF=inf<int>,MOD=1000000007;constexpr ll LINF=inf<ll>;
#define _ol3(_1,_2,_3,name,...)name
#define _rep(i,n)_repi(i,0,n)
#define _repi(i,a,b)for(int i=a,i##_l=(b);i<i##_l;++i)
#define REP(...)_ol3(__VA_ARGS__,_repi,_rep,)(__VA_ARGS__)
#define REPR(i,n)for(int i=n-1;i>=0;--i)
#define REPA(i,v)REP(i,v.size())
#define all(v)(v).begin(),(v).end()
#define bit(n)(1ll<<(n))
#define uniq(v)sort(all(v));v.erase(unique(all(v)),v.end())
#define F first
#define S second
#define endl '\n'
#define cho(n,a,b)cout<<((n)?a:b)<<endl
void YES(int n){cho(n,"YES","NO");}void Yes(int n){cho(n,"Yes","No");}void Poss(int n){cho(n,"Possible","Impossible");}
#ifndef LOCAL
struct osd{template<class T>osd&operator<(const T&t){return*this;}template<class T>osd&operator<<(const T&t){return*this;}};osd cer_;template<class...T>void _print(osd&a,T&&...t){}
#define cerr cer_
#endif
template<class T>ostream&operator<(ostream&o,const T&t){return o<<t;}template<class T>istream&operator>(istream&i,T&t){return i>>t;}
void _print(ostream&s){}template<class T,class...U>void _print(ostream&s,T&&t,U&&...u){s<t<(sizeof...(u)?' ':'\n');_print(s,u...);}
template<class...T>void print(T&&...t){_print(cout,t...);}template<class...T>void dprint(T&&...t){_print(cerr,t...);}
template<class T>void chmax(T&a,const T&b){if(a<b)a=b;}template<class T>void chmin(T&a,const T&b){if(a>b)a=b;}
template<class T>ostream&operator<<(ostream&o,const vector<T>&v){for(auto&&i:v)o<i<' ';return o;}
template<class T>istream&operator>>(istream&i,vector<T>&v){for(T&j:v)i>j;return i;}
template<class T,class U>ostream&operator<<(ostream&o,const pair<T,U>&p){return o<p.F<' '<p.S;}
template<class T,class U>istream&operator>>(istream&i,pair<T,U>&p){return i>p.F>p.S;}
template<class T>ostream&operator<<(ostream&o,const set<T>&v){for(auto&&i:v)o<i<' ';return o;}
template<class T>vector<T>&operator<<(vector<T>&v,const T&t){v.push_back(t);return v;}
template<class T>queue<T>&operator<<(queue<T>&q,const T&t){q.push(t);return q;}template<class T>queue<T>&operator<<(T&t,queue<T>&q){t=q.front();q.pop();return q;}
template<class T>deque<T>&operator>>(const T&t,deque<T>&q){q.push_front(t);return q;}template<class T>deque<T>&operator<<(T&t,deque<T>&q){t=q.front();q.pop_front();return q;}
template<class T>deque<T>&operator<<(deque<T>&q,const T&t){q.push_back(t);return q;}template<class T>deque<T>&operator>>(deque<T>&q,T&t){t=q.back(t);q.pop_back();return q;}
template<class T>stack<T>&operator<<(stack<T>&s,const T&t){s.push(t);return s;}template<class T>stack<T>&operator>>(stack<T>&s,T&t){t=s.top();s.pop();return s;}

int main(){
    cin.tie(0);ios::sync_with_stdio(0);
    int n,d;
    cin>n>d;
    cout<(n+d*2)/(d*2+1)<endl;
    return 0;
}


Measured memory_bytes: 256
from collections import deque

while True:
    a,b = map(int,input().split())
    if a == b == 0:
        break
    map_list = []
    map_list.append([1 for i in range(2 * a + 1)])
    for i in range(2 * b - 1):
        
        lis_c = list(map(int,input().split()))
        if i % 2 == 0:
            row = [2 for i in range(2 * a - 1)]
            for j in range(len(lis_c)):
                row[2 * j + 1] = lis_c[j]
            
        else:
            row = [1 for i in range(2 * a - 1)]
            for j in range(len(lis_c)):
                row[2 * j] = lis_c[j]
        row.append(1)
        row.insert(0,1)
        map_list.append(row)
    map_list.append([1 for i in range(2 * a + 1)])


    
    time = 0
    M_dic = {}
    M_que = deque([])
    M_que.append([time,[1,1]])
    M_dic[(1,1)] = time
    while True:
        now_list = M_que.popleft()
        now_time = now_list[0]

        now_pos = now_list[1]
        if now_pos == [2 * b - 1,2 * a - 1]:
            print(now_time + 1)
            break
            
        if map_list[now_pos[0] + 1][now_pos[1]] == 0:
            if not (now_pos[0] + 2,now_pos[1]) in M_dic:
                M_dic[(now_pos[0] + 2,now_pos[1])] = now_time + 1
                M_que.append([now_time + 1, [now_pos[0] + 2,now_pos[1]]])
   
        if map_list[now_pos[0]][now_pos[1] + 1] == 0:
            if not (now_pos[0],now_pos[1] + 2) in M_dic:
                M_dic[(now_pos[0],now_pos[1] + 2)] = now_time + 1
                M_que.append([now_time + 1, [now_pos[0],now_pos[1] + 2]])
                
        if map_list[now_pos[0] - 1][now_pos[1]] == 0:
            if not (now_pos[0] - 2,now_pos[1]) in M_dic:
                M_dic[(now_pos[0] - 2,now_pos[1])] = now_time + 1
                M_que.append([now_time + 1, [now_pos[0] - 2,now_pos[1]]])
   
        if map_list[now_pos[0]][now_pos[1] - 1] == 0:
            if not (now_pos[0],now_pos[1] - 2) in M_dic:
                M_dic[(now_pos[0],now_pos[1] - 2)] = now_time + 1
                M_que.append([now_time + 1, [now_pos[0],now_pos[1] - 2]])
                
        if len(M_que) == 0:
            print(0)
            break

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

int main() {
	double x1, y1, x2, y2;
	cin >> x1 >> y1 >> x2 >> y2;
	cout << fixed << setprecision(5) << sqrt(pow(x2 - x1, 2) + pow(y2 - y1, 2)) << endl;
	return 0;
}


Measured memory_bytes: 3264
#include<stdio.h>

int main(void){
        int n;
        scanf("%d", &n);

        int S[13], H[13], C[13], D[13];
        for(int i=0; i<13; i++) S[i] = H[i] = C[i] = D[i] = 1;
        for(int i=0; i<n; i++){
                getchar();
                char m;
                int a;
                scanf("%c %d", &m, &a);

                if(m=='S') S[a-1] = 0;
                if(m=='H') H[a-1] = 0;
                if(m=='C') C[a-1] = 0;
                if(m=='D') D[a-1] = 0;
        }

        for(int i=0; i<13; i++) S[i] && printf("S %d\n", i+1);
        for(int i=0; i<13; i++) H[i] && printf("H %d\n", i+1);
        for(int i=0; i<13; i++) C[i] && printf("C %d\n", i+1);
        for(int i=0; i<13; i++) D[i] && printf("D %d\n", i+1);
        return 0;
}


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

def stairs():
    for i in range(1, n):
        if h[i] > h[i-1]:
            h[i] -= 1
    
        if h[i] < h[i-1]:
            return False
        
    return True

if stairs() == True:
    print('Yes')
else:
    print('No')

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

struct dsu {
  int cc;
  vector<int> p, sz;
  dsu(int n) : cc(n), p(n, -1), sz(n, 1) {}
  int root(int v) const {
    while (p[v] != -1) v = p[v];
    return v;
  }
  bool unite(int u, int v) {
    u = root(u), v = root(v);
    if (u == v) return false;
    --cc;
    if (sz[u] < sz[v]) swap(u, v);
    p[v] = u;
    sz[u] += sz[v];
    return true;
  }
  bool same(int u, int v) const { return root(u) == root(v); }
  int size(int v) const { return sz[root(v)]; }
};

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int n, m, k;
  cin >> n >> m >> k;
  dsu d(n);
  vector<int> deg(n);
  while (m--) {
    int u, v;
    cin >> u >> v;
    --u, --v;
    d.unite(u, v);
    ++deg[u], ++deg[v];
  }
  vector<vector<int>> g(n);
  while (k--) {
    int u, v;
    cin >> u >> v;
    --u, --v;
    g[u].push_back(v);
    g[v].push_back(u);
  }
  for (int v = 0; v < n; ++v) {
    int res = d.size(v) - 1 - deg[v];
    for (int u : g[v]) {
      res -= d.same(v, u);
    }
    cout << res << " \n"[v == n - 1];
  }
}


Measured memory_bytes: 7168
import java.util.Scanner;
class Main{ 
   int n,x,y,z; 
   public void solve(){  
      Scanner sc = new Scanner(System.in); 
       n = sc.nextInt();   
     for(x = 3; x <= n; x++){  
          y = x;  
          z = 0;
                 if(y % 3 == 0){
                    System.out.printf(" %d",x);
                    z++;  
              }else{  
                  while(z == 0){   
                     if(y % 10 == 3){
                            System.out.printf(" %d",x);  
                          z++;
                        } 
                       y /= 10;
                        if(y < 3){                            
                        z++;
                        }
                    }
                   } 
       } 
       System.out.println();
    }
    public static void main(String[] args){ 
       new Main().solve(); 
   }
}

Measured memory_bytes: 33688
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define N 100005
#define mod 1000000007
#define dd double
#define rep(i, n) for(int i = 0; i < n; i++)
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep1(i,b) for(int i=1;i<=b;i++)
#define pb push_back
#define mp make_pair
#define F first
#define S second
long dp[105][100005];
long w[105];
long val[105];
int n;
long knap(int i,int v){
	// hyphothesis is weight
	if(v == 0)
		return 0;
	if(i == n)
		return INT_MAX;
	if(dp[i][v]!=-1)
		return dp[i][v];
	if(val[i]>v)
		return knap(i+1,v);
	else
		return dp[i][v] =   min(knap(i+1,v-val[i]) + w[i],knap(i+1,v));

}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
#ifndef ONLINE_JUDGE    
    freopen("input.txt", "r", stdin);     
    freopen("output.txt", "w", stdout);
#endif
int W;
cin>>n>>W;

	rep(i,n){
		cin>>w[i];
		cin>>val[i];
	}
	int sum = 0;
	rep(i,n)
	{
		sum+=val[i];
	}
	memset(dp,-1,sizeof(dp));
	for(int i = 0;i<=sum;i++)
		knap(0,i);	
	int ma = 0;
	for(int i = 0;i<=sum;i++){
		for(int j = 0;j<n;j++){
			if(dp[j][i]<=W)
			{
				ma = max(ma,i);
				break;
			}
		}
	}
	
	cout<<ma;
 
 
 
 
 
 
 
 

 
return 0;
}

Measured memory_bytes: 85680
#include<iostream>
using namespace std;
int i, e, j;
long long n, p, aux, sol;
int main(){
    cin>> n >> p;
    aux = p;
    sol = 1;
    for(i = 2; i <= p / i; i++){
        e = 0;
        while(aux % i == 0){
            e++;
            aux /= i;
        }
        if(e != 0){
            e /= n;
            for(j = 1; j <= e; j++){
                sol *= i;
            }
        }
    }
    if(aux != 1 && n == 1){
        sol *= aux;
    }
    cout<< sol;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 2e5 + 50; // 蜜汁RE，不知道为什么,2e5+10就RE
ll c[N];

struct Node {
    int x, h;
    inline bool operator < (const Node& t) const {
        return x < t.x;
    }
} p[N];

int main()
{
    int n, a, d;
    cin >> n >> d >> a;
    for(int i = 1; i <= n; ++i)
        cin >> p[i].x >> p[i].h;
    sort(p + 1, p + n + 1);
    
    ll ans = 0;
    // 双指针
    for(int i = 1, j = 1; i <= n; ++i) {
        while(j <= n && p[j].x <= p[i].x + 2 * d) ++j;
        ll need = max((p[i].h - c[i] * a + a - 1) / a, 0ll);
        ans += need;
        // 构造差分序列
        c[i] += need;
        c[j] -= need;
        c[i + 1] += c[i];
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3328
#include<iostream>
#include<string>
#include<cstring>
#include<stdio.h>
#include<algorithm>
#include<functional>
#include<vector>
#include<set>
#include<queue>
#include<list>
#include<stdio.h>
#include<stdlib.h>
#include<map>
#include<cstdio>
#include <iomanip>

using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

typedef int _loop_int;
#define REP(i,n) for(_loop_int i=0;i<(_loop_int)(n);++i)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

#define CHMIN(a,b) a=min((a),(b))
#define CHMAX(a,b) a=max((a),(b))

// mod
const ll MOD = 1000000007ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

// floating
typedef double Real;
const Real EPS = 1e-11;
#define EQ0(x) (abs(x)<EPS)
#define EQ(a,b) (abs(a-b)<EPS)

int main() {

	int a, b; cin >> a >> b;

	for (int i = 1; i <= 3; i++) {
		int x = a*b*i;

		if (x % 2 == 1) {
			cout << "Yes" << endl;
			return 0;
		}
	}
	cout << "No" << endl;

	return 0;
}

Measured memory_bytes: 256
alf = {c:i for i,c in enumerate('abcdefghijklmnopqrstuvwxyz')}
a = 'abcdefghijklmnopqrstuvwxyz'
s = input()
k = int(input())
diff = [26-alf[c] if c != 'a' else 0 for c in s]
ans = []
for i in range(len(s)):
    if k >= diff[i]:
        ans.append('a')
        k -= diff[i]
    else:
        ans.append(s[i])
    # print(ans,k)
if k > 0:
    ans[-1] = a[(alf[ans[-1]] + k % 26)]
print(''.join(ans))


Measured memory_bytes: 47924
import java.util.*;
 
public class Main {
  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);
     
    List<Integer> answer = new ArrayList<Integer>();

    boolean end = false;
    while(!end) {
      int a = scanner.nextInt();
      String op = scanner.next();
      int b = scanner.nextInt();
 
      switch(op) {
        case "+": answer.add(a+b);
          break;
        case "-": answer.add(a-b);
          break;
        case "*": answer.add(a*b);
          break;
        case "/": answer.add(a/b);
          break;
        case "?": end = true;
          break;
       }
    }
 
    for(int i = 0; i < answer.size(); ++i) {
      System.out.println(answer.get(i));
    }
   }
} 


 


Measured memory_bytes: 26060
N,X = map(int,input().split())
L = input()
list1 = list(L.split())

list2 = []
t,count = 0,0
for i in range(N):
    t += int(list1[i])
    list2.append(t)

for i in range(N):
    if list2[i] <= X:
        count += 1

print(int(count) + 1)


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

int main(){
    string a,b;
    getline(cin, a);
    getline(cin, b);

    bool valid = b.size()-a.size() == 1 && a == b.substr(0, a.size());
    cout << (valid ? "Yes" : "No" ) << endl;
}


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

int main(){
  int M, D;
  cin >> M >> D;
  int counter = 0;
  for(int m = 1; m <= M; m++){
    for(int d = 1; d <= D; d++){
      int d1, d10;
      d1 = d - (d / 10) * 10;
      d10 = d / 10;
      if(d1 >= 2 && d10 >= 2 && d1 * d10 == m){
        counter++;
      }
    }
  }
  cout << counter << endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
const int N=10000005,M=998244353;
int inv[N],fac[N],ans,n,fac2[N];
inline int ksm(int x,int y){
	int ans=1;
	for (;y;y>>=1,x=x*x%M)
		if (y&1)(ans*=x)%=M;
	return ans;	
}
int C(int x,int y){
	if (x<y)return 0;
	return fac[x]*inv[y]%M*inv[x-y]%M;
} 
signed main(){
	scanf("%lld",&n);
	fac[0]=inv[0]=fac2[0]=1;
	for (int i=1;i<N;i++)fac[i]=fac[i-1]*i%M,fac2[i]=fac2[i-1]*2%M;
	inv[N-1]=ksm(fac[N-1],M-2);
	for (int i=N-2;i;i--)inv[i]=inv[i+1]*(i+1)%M; 
	int ans=ksm(3,n);
	for (int i=n/2+1;i<=n;i++)(ans+=M-2*C(n,i)*fac2[n-i]%M)%=M;
	printf("%lld\n",ans);
}

Measured memory_bytes: 234624
/*

 Remember, Hope is a good thing... May be the best of things... and No Good thing ever Dies !!!

*/
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define IOS ios::sync_with_stdio(0); cout.tie(0);
#define endl "\n"
#define MOD 1000000007
#define MOD1 1e18
#define yes cout<<"YES"<<endl
#define no cout<<"NO"<<endl
#define FOR(i,a,b) for(ll i=a;i<=b;i++)
#define ROF(i,a,b) for(ll i=a;i>=b;i--)
typedef long double ld;
const ll inf=(1LL<<60)-1;
const ll mxn=1e5;
int dx[]= {-1,1,0,0};
int dy[]= {0,0,-1,1};
long long ans,a[100005];
ll mod(ll x)
{
    ll res=x%MOD;
    while(res<0)
        res+=MOD;
    return res;
}
ll bigmod(ll x,ll n)
{
    ll res=1;
    while(n>0)
    {
        if(n&1)
            res=(res*x)%MOD;
        x=(x*x)%MOD;
        n>>=1;
    }
    return res;
}
void solve()
{
    //freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
  ll n;
  cin>>n;
  ll d[n][2];
  for(ll i=0;i<n;i++)
  {
      for(ll j=0;j<2;j++)
        cin>>d[i][j];
  }
  ll j=0;
  bool flag=0;
  for(ll i=0;i<n;i++)
  {
    if(d[i][j]==d[i][j+1] && d[i+1][j]==d[i+1][j+1] && d[i+2][j]==d[i+2][j+1])
    {
        flag=1;
        break;
    }
  }
  if(flag)
    cout<<"Yes"<<endl;
  else
    cout<<"No"<<endl;

}
int main()
{
    IOS;
    //ll t;
    //cin>>t;
    // while(t--)
    solve();
    return 0;
}


Measured memory_bytes: 3636
#include<bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
ll qmin(ll a, ll b){
	return (a < b) ? a : b;
}

bool cmp(pair<int, int> a, pair<int, int> b){
	return (a.first + a.second) < (b.first + b.second);
}

int n;
pair<ll, ll> a[5050];
ll dp[2][5050];

int main(){
	scanf("%d", &n);
	rep(i, n) scanf("%lld%lld", &a[i].first, &a[i].second);
	sort(a, a+n, cmp);
	memset(dp, 0x3f, sizeof(dp));
	ll no = dp[0][0];
	dp[0][0] = 0;
	rep(i, n){
		int now = i&1, nxt = (i+1) & 1;
		memset(dp[nxt], 0x3f, sizeof(dp[nxt]));
		rep(j, i+1){
			if(dp[now][j] <= a[i].first) dp[nxt][j+1] = qmin(dp[nxt][j+1], dp[now][j] + a[i].second);
			dp[nxt][j] = qmin(dp[nxt][j], dp[now][j]);
		}
	}
	int final_pos = n&1;
	for(int i = n; i >= 0; i--){
		if(dp[final_pos][i] < no){
			cout << i << endl;
			return 0;
		}
	}
	return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <vector>
#include <map>
#include <bitset>
#include <algorithm>
#include <string>
#include <queue>

#define ll long long
#define ull unsigned long long
using namespace std;

const ll mod = 1000000007;

int main() {
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    ll n;
    cin >> n;
    ll sum = 0;
    for (ll i = 1; i <= n; i++) {
        if ((i%3) && (i%5)) {
            sum += i;
        }
    }
    cout << sum;
    return 0;
}


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

int main(){
  long long N;
  cin >> N;
  vector<long long> A(N);
  for (long long i = 0; i < N; i++){
    cin >> A[i];
  }
  
  long long ans = 0;
  for (long long i = 0; i < N - 1; i++){
    if (A[i] > A[i + 1]){
      ans += A[i] - A[i + 1];
      A[i + 1] = A[i];
    }
  }
  
  cout << ans << endl;
}

Measured memory_bytes: 4812
#include <bits/stdc++.h>
using namespace std;
const int dd = 1e5+2;
int his[dd];
int main(){
    int n,before,after,maxx;
    cin>>n;
    maxx = 0;
    before = maxx;
    after = maxx;
    for(int i = 0;i<n;i++) cin>>his[i];
    for(int i=n-2;i>=0;i--){
        if(his[i]>=his[i+1]){
            after = before +1;
        }else{
            after = 0;
        }
        maxx = max(maxx,after);
        before = after;
    }
    cout<<maxx<<endl;
    return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
int N;
vector<int> a;
long long g(long long n) {
	if (n < 0) return 0;
	return (n+1) * (n+2) / 2;
}
long long f(int x, int y, int z) {
	return g(z-x) - g(y-x) - g(z-y-1);
	/*
	long long r = 0;
	for (int i = x; i < z; ++ i) {
		for (int j = i+1; j <= z; ++ j) {
			if (i <= y && y < j) ++ r;
		}
	}
	return r;
	*/
}
int main() {
	cin >> N;
	a.resize(N);
	for (int i = 0; i < N; ++ i) {
		int x;
		cin >> x;
		a[x-1] = i;
	}
	set<int> s;
	s.insert(0);
	s.insert(N);
	long long r = 0;
	for (int i = 0; i < N; ++ i) {
		int x = a[i];
		auto it = s.upper_bound(x);
		auto jt = it;
		-- it;
		s.insert(x);
		s.insert(x+1);
		r += f(*it, x, *jt) * (i+1);
	}
	cout << r << endl;
}


Measured memory_bytes: 10368
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#include<limits.h>
#include<iomanip>
#define rep(i, n) for(int i = 0; i < n; i++)
#define REP(i, m, n) for(int i = m; i < n; i++)
#define ALL(v) v.begin(),v.end()
#define RALL(v) v.rbegin(),v.rend()
#define check(v) rep(i,v.size()) cout << v[i] << " ";\
cout << endl
#define INF 1e8
typedef long long ll;
using namespace std;
//オーバーフローに気をつけろよおおおおおお
//確認忘れるなよおおおおおお

int main() {
    int n, m; cin >> n >> m;
    if(n%m==0) cout << -1 << endl;
    else cout << n << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pp;
const int INF = 1e9;
const int MOD = 1000000007;
#define rep(i,n) for(int i=0;i<n;i++)
 
int main() {
  ll n,a,b;
  cin >> n >> a >> b;
  vector<ll> x(n);
  rep(i,n) cin >> x.at(i);
  ll ans = 0;
  rep(i,n-1){
    ans += min(a*(x.at(i+1)-x.at(i)),b);
  }
  cout << ans << endl;
  
  return 0;
}




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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define each(it,v) for(auto it : v)
#define mod 1000000007
#define vi vector<int>
#define vpii vector<pair<int,int>>

using namespace std;

int n,m,cnt;

main()
{
        cin>>n>>m;
        vpii p(n+10);
        p[0].second=1;
        each(&it,p)it.first=true;

        vi v(m);
        each(&it,v)
        {
                cin>>it;
                p[it].first=false;
        }

        rep(i,n)
        {
                if(!p[i].first)continue;

                p[i+1].second=(p[i+1].second+p[i].second%mod)%mod;
                p[i+2].second=(p[i+2].second+p[i].second%mod)%mod;
        }

        //debug
        //each(it,p)printf("%d %d %d\n",cnt++,it.first,it.second);

        cout<<p[n].second<<endl;
}


Measured memory_bytes: 1408
#include <bits/stdc++.h>
#define REP(i, n) for(int i=0; i<(int)(n); i++)
#define REP1(i,a,b) for(int i=a; i<=(int)(b); i++)
#define ALL(x) begin(x),end(x)
#define PB push_back
using namespace std;
typedef int64_t LL;
typedef vector<int> VI;
typedef pair<int,int> PII;

template<class T> inline bool chmax( T &a, const T &b ) { return b>a ? a=b,true : false; }
template<class T> inline bool chmin( T &a, const T &b ) { return b<a ? a=b,true : false; }
template<class T> using MaxHeap = priority_queue<T>;
template<class T> using MinHeap = priority_queue<T, vector<T>, greater<T>>;
template<class T, class F=less<T>> void sort_uniq( vector<T> &v, F f=F() ) {
    sort(begin(v),end(v),f);
    v.resize(unique(begin(v),end(v))-begin(v));
}

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

    int n, m;
    cin >> n >> m;
    int sum=0;
    REP(i,m) {
        int a;
        cin >> a;
        sum+=a;
    }
    if ( sum>n ) {
        cout << -1 << '\n';
    } else {
        cout << n-sum << '\n';
    }
    return 0;
}

Measured memory_bytes: 3652
#include<bits/stdc++.h>
using ll = long long;
using namespace std;
int main(){
  ll n,k;
  char s[20];
  cin >> n >> s >> k;
  k--;
  for(int i=0;i<n;i++){
    if(s[i]!=s[k])s[i]='*';
  }
  cout << s;
}

Measured memory_bytes: 256