akhauriyash/Code-Regression huggingface dataset:
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		String in1 = scanner.nextLine();
		String in2 = scanner.nextLine();
		String res = "No";
		for(int i = 0; i < in1.length(); i++) {
			if(in2.equals(in1.substring(i) + in1.substring(0, i ))){
				res = "Yes";
				break;
			}
		}
		System.out.println(res);
	}

}

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

// indexからいくつ先まで水をやれるか
// 高さの差が一つ以内ならOK
int search(int idx, std::vector<int> v) {
  int current = v.at(idx);
  int count = 0;

  if(idx >= v.size()-1) return 0;
  
  for (size_t i = idx+1; i < v.size(); i++) {
    if (v.at(i) - current >= -1 && v.at(i) > 0) count++;
    else return count;
  }
}

int main(int argc, char const *argv[]) {
  int n;
  std::cin >> n;

  std::vector<int> h;

  for (size_t i = 0; i < n; i++) {
    int tmp;
    cin >> tmp;
    h.push_back(tmp);
  }
  
  int count = 0;
  int index = 0;

  while (true) {
    if (index >= h.size()) {
      break;
    }
    
    if (h.at(index) <= 0) {
      index++;
    } else {
      int ret = search(index, h);
      for (size_t i = index; i <= index+ret; i++) {
        h.at(i) -= 1;
      }
      count++;
    }
  }
  std::cout << count << '\n';
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <stdio.h>

using namespace std;

int main() {

	string S, T, U;
	int A, B;

	cin >> S >> T;
	cin >> A >> B;

	cin >> U;

	if (S == U) {
		A = A - 1;
	}
	else {
		B = B - 1;
	}

	cout << A << endl;
	cout << B << endl;


}









Measured memory_bytes: 256
#include<iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>
using namespace std;
const int N=200000;
struct P
	{
	int x,cnt;
	}p[2][N];
bool cmp(P x,P y)
	{
	return x.cnt>y.cnt;
	}
int main()
{
//freopen("input.txt","r",stdin);
int n;
cin >>n;
for(int i=1;i<=n;i++)
	{
	int tmp;
	cin >>tmp;
	p[i&1][tmp].cnt++;
	}
for(int i=1;i<N;i++)
	p[0][i].x=p[1][i].x=i;
sort(p[1]+1,p[1]+N,cmp);
sort(p[0]+1,p[0]+N,cmp);
int ans=n+1;
if(p[1][1].x!=p[0][1].x)
	{
	ans=n-p[1][1].cnt-p[0][1].cnt;
	}
else 
	{
	ans=min(n-p[1][1].cnt-p[0][2].cnt,n-p[1][2].cnt-p[0][1].cnt);
	}
cout <<ans;
return 0;
}


Measured memory_bytes: 3328
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

fn exe(a: u32, b: u32) -> i32 {
    for i in 0..1250 {
        let mut ok = false;
        let a_ans = (i as f64 * 0.08) as u32;
        let b_ans = (i as f64* 0.10) as u32;
        if a_ans == a && b_ans == b {
            return i
        }
    }
    -1
}

fn main() {
    input! {
        a: u32,
        b: u32,
    }
    let ans = exe(a, b);
    println!("{}", ans);
}


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

int main(){
    int N; cin >> N;
    string S; cin >> S;
    int ans = 0;
    for(int i = 0; i < N - 2; i++){
        if(S[i] == 'A' && S[i+1] == 'B' && S[i+2] == 'C') ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;

namespace DPL_1B_1{
    public class Program{
        public static void Main(string[] args){
            var input = Console.ReadLine().Split(' ');
            var n = int.Parse(input[0]);
            var w = int.Parse(input[1]);

            var goodslist = new HashSet<Goods>();
            for(var i = 0; i < n; i++){
                var tmp = Console.ReadLine().Split(' ');
                goodslist.Add(new Goods(int.Parse(tmp[0]), int.Parse(tmp[1])));
            }

            var dp = new int[w + 1];
            for(var i = 1; i <= w; i++){
                foreach(var goods in goodslist){
                    if(i >= goods.Weight){
                        dp[i] = Math.Max(dp[i], dp[i - goods.Weight] + goods.Value);
                    }
                }
            }

            Console.WriteLine(dp[w]);
        }
    }

    public class Goods{
        public Goods(int value, int weight){
            Value = value;
            Weight = weight;
        }

        public int Value;
        public int Weight;
    }
}

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

int main()
{
  int h1,m1,s1;
  int h2,m2,s2;
  int time,h,m,s;
  int i;
  for(i=0;i<3;i++){
    cin>>h1>>m1>>s1>>h2>>m2>>s2;
    time=h2*60*60+m2*60+s2;
    time-=h1*60*60+m1*60+s1;
    h=time/60/60;
    m=(time/60)%60;
    s=time%60;
    cout<<h<<" "<<m<<" "<<s<<endl;
  }
}

Measured memory_bytes: 0
import java.util.Scanner;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        //char[] S = sc.next().toCharArray();
        int count=0;
        int yakusuu=0;
        int n;
        for(int i=0; 2*i<N; i++){
            n = 2*i+1;
            for(int k=1; k<n+1; k++){
                if(n%k==0){
                    yakusuu++;
                }
            }
            if(yakusuu==8){
                count++;
                
            }
            yakusuu=0;

        }

          System.out.println(count);
        }
    }

Measured memory_bytes: 35744
#include <bits/stdc++.h>
using namespace std;
#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define int long long
#define ld long double
#define fi first
#define se second
#define all(uiet) uiet.begin(),uiet.end()
#define read(UIET) for(int i = 0; i < n; ++i) cin >> UIET[i]
#define out(UIET) for(int i = 0; i < n; ++i) cout << UIET[i] << " "
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define vpp vector<pair< int, int > >
#define pll pair<int , int >
#define ppll pair < pll , pll >
#define debug(n1) cout << n1 << endl
#define len(a) ((int) (a).size())
#define endl "\n"
#define mod 1000000007
const int INF=(1LL<<60)-1;
bool isPerfectSquare(long double x) {   
    long double sr = sqrt(x); 
    return ((sr - floor(sr)) == 0); 
} 
bool isPrime(int x){
    for(int i = 2; i * i <= x; ++i){
        if(x % i == 0) return 0;
    }
    return 1;
}
int fun(int n){
    if(n & 1) return 3 * n + 1;
    else return n/2;
}
int32_t main(){
    SPEED;
    string s;
    cin >> s;
    set<char> su;
    if(len(s) == 1 && s[0] == 'a') {
        cout << "None";
        return 0;
    }
    for(char c: s){
        su.insert(c);
    }
    if(len(su) == 26){
        cout << "None" ;
        return 0;
    }
    char c = 'a';
    for(int i = 1; i < 30; ++i){
        if(su.count(c)){
            c++;
        }
        else{
            cout << c;
            return 0;
        }
    }
}

Measured memory_bytes: 3692
# 宮殿を建設する地点の候補はN個
N = int(input())

# T気温の基準 A:理想の気温
T, A = map(int, input().split())

#それぞれの標高
heights = list(map(int, input().split()))

#理想の値を定義しておく
ideal = 1000
#場所の位置の番号を記録
place = 0


# for文で回して一個ずつ確かめる
for number in range(N):
	#平均気温を求める
	average_temperature = T - heights[number]*0.006
    
    #理想との絶対値の差はどれくらいか
	difference = average_temperature - A
	if difference < 0:
		difference = -1*difference
	
    #理想に最も近い地点はどれか　絶対値が一番小さい値はどれか
	if  difference < ideal:
      	#理想の場所の気温
		ideal = difference
        #理想の場所の番号
		place = number

#配列の番号と実際の番号がずれるため+1している
print(place+1)

Measured memory_bytes: 3064
#include <stdio.h>
int main()
{
  int d,s,i;
  while((scanf("%d",&d)) != EOF) {
    s = 0;
    for(i=0; i<600; i+=d){
      s += i*i*d;
    }
    printf("%d\n", s);
  }
  return 0;
}

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

int main() {
        int n, W;
        scanf("%d%d", &n, &W);
        vector<long long> cur(100001, 1e18);
        cur[0] = 0;
        rep(i, n) {
                int w, v;
                scanf("%d%d", &w, &v);
                vector<long long> next = cur;
                rep(j, 100001) {
                        next[j + v] = min(next[j + v], cur[j] + w);
                }
                cur.swap(next);
        }
        for (int i = 100000; i >= 0; i --) {
                if (cur[i] <= W) {
                        printf("%d\n", i);
                        return 0;
                }
        }
        assert(false);
        return 0;
}


Measured memory_bytes: 1792
#include<iostream>
using namespace std;
int main() {
	int n;
	while (cin >> n, n) {
		int w, h; cin >> w >> h;
		bool map[114][514] = {};
		for (int i = 0; i < n; i++) {
			int x, y; cin >> x >> y;
			map[x][y] = true;
		}
		int s, t; cin >> s >> t;
		int ans = 0;
		for (int i = 1; i <= w - s + 1; i++) {
			for (int j = 1; j <= h - t + 1; j++) {
				int cnt = 0;
				for (int k = 0; k < s; k++) {
					for (int l = 0; l < t; l++) {
						if (map[i + k][j + l])cnt++;
					}
				}
				if (cnt > ans)ans = cnt;
			}
		}
		cout << ans << endl;
	}
}

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

//template
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(a);i>(b);i--)
#define ALL(v) (v).begin(),(v).end()
typedef long long int ll;
const int inf = 0x3fffffff; const ll INF = 0x1fffffffffffffff; const double eps=1e-12;
void tostr(ll x,string& res){while(x)res+=('0'+(x%10)),x/=10; reverse(ALL(res)); return;}
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; }
//end

ll cnt[201000]={};

int main(){
   int n; scanf("%d",&n);
   vector<int> a(n);
   rep(i,0,n)scanf("%d",&a[i]);
   rep(i,0,n)cnt[a[i]]++;
   ll res=0; 
   rep(i,0,n+1)res+=cnt[i]*(cnt[i]-1)/2;
   res-=cnt[a[0]]*(cnt[a[0]]-1)/2;
   res+=1LL*(cnt[a[0]]-1)*(cnt[a[0]]-2)/2;
   printf("%lld\n",res);
   rep(k,0,n-1){
      res-=1LL*(cnt[a[k]]-1)*(cnt[a[k]]-2)/2;
      res+=1LL*(cnt[a[k]]-1)*(cnt[a[k]])/2;
      res-=1LL*(cnt[a[k+1]]-1)*(cnt[a[k+1]])/2;
      res+=1LL*(cnt[a[k+1]]-1)*(cnt[a[k+1]]-2)/2;
      printf("%lld\n",res);
   } 
   return 0;
}


Measured memory_bytes: 3968
l = gets.to_i
a = Math.log2(l).floor

ans = []
a.times do |i|
    ans << "#{i+1} #{i+2} #{0}"
    ans << "#{i+1} #{i+2} #{2**i}"
end

s = 2**a
(a-1).downto(0) do |i|
    if l[i] == 1
        ans << "#{i+1} #{a+1} #{s}"
        s += 2**i
    end
end
puts "#{a+1} #{ans.size}",ans

Measured memory_bytes: 2172
#include<bits/stdc++.h>
using namespace std;
struct node
{
	int x,y,sum;
}p;
int n,m,b[23][23],ans,nx,ny,px,py;
int b1[5]={0,0,1,-1},b2[5]={1,-1,0,0};
char a[30][30];
queue<node>q;
int main()
{
	scanf("%d%d",&n,&m);
	for(int i=1;i<=n;i++)
		for(int j=1;j<=m;j++)
			cin>>a[i][j];
	for(int i=1;i<=n;i++)
		for(int j=1;j<=m;j++)
			if(a[i][j]=='.')
			{
				memset(b,0,sizeof(b));
				b[i][j]=1,p.x=i,p.y=j,p.sum=0;
				q.push(p);
				while(!q.empty())
				{
					p=q.front(),q.pop(),nx=p.x,ny=p.y;
					for(int i=0;i<4;i++)
						if(b[nx+b1[i]][ny+b2[i]]==0&&a[nx+b1[i]][ny+b2[i]]=='.')
						{
							px=nx+b1[i],py=ny+b2[i],b[px][py]=1;
							node txt;
							txt.x=px,txt.y=py,txt.sum=p.sum+1,ans=max(ans,txt.sum);
							q.push(txt);
						}
				}
			}
	cout<<ans;
	return 0;
}


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

using namespace std;

class Dice{
    public:
        int dice[6];
        int buf;
        void north(){
            buf = dice[0];
            dice[0] = dice[1];
            dice[1] = dice[5];
            dice[5] = dice[4];
            dice[4] = buf;
        }
        void south(){
            buf = dice[0];
            dice[0] = dice[4];
            dice[4] = dice[5];
            dice[5] = dice[1];
            dice[1] = buf;
        }
        void east(){
            buf = dice[0];
            dice[0] = dice[3];
            dice[3] = dice[5];
            dice[5] = dice[2];
            dice[2] = buf;
        }
        void west(){
            buf = dice[0];
            dice[0] = dice[2];
            dice[2] = dice[5];
            dice[5] = dice[3];
            dice[3] = buf;
        }

        void rotate_R(){
            buf = dice[4];
            dice[4] = dice[2];
            dice[2] = dice[1];
            dice[1] = dice[3];
            dice[3] = buf;
        }
};



int main(){
    int num;
    int upper, front;
    string::iterator itr;

    Dice d;

    for(int i=0; i<6; i++){
        cin >> d.dice[i];
    }
    cin >> num;
    for(int i=0; i<num; i++){
        cin >> upper >> front;
        for(int j=0; j<6; j++){
            if(d.dice[j] == upper){
                if(j == 0) break;
                if(j == 1) d.north();
                if(j == 2) d.west();
                if(j == 3) d.east();
                if(j == 4) d.south();
                if(j == 5){
                    d.north();
                    d.north();
                }
            }
        }
        while(1){
            if(front == d.dice[1]){
                break;
            }
            d.rotate_R();
        }
        cout << d.dice[2] << endl;
    }

    return 0;
}

Measured memory_bytes: 3048
X=list(map(int,input().split()))
if X[3]>X[4]:
	X=[X[i] for i in [1,0,2,4,3]]
print(min(X[0]*X[3]+X[1]*X[4], X[1]*X[4]+(2*X[2]-X[1])*X[3], 2*X[2]*X[4]))

Measured memory_bytes: 3064
#include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;

int main(){
    int A,B,sum,diff,multi;
    scanf("%d %d",&A,&B);

    sum=A+B;
    diff=A-B;
    multi=A*B;

    if(sum>=diff&&sum>=multi) printf("%d\n",sum);
    else if(diff>=sum&&diff>=multi) printf("%d\n",diff);
    else printf("%d\n",multi);
    return 0;
}

Measured memory_bytes: 128
#include <stdio.h>

int N;
int A[2010];
int Q;
int M[2010];


int solve(int i, int m)
{
    if (m == 0) return 1;
    if (i >= N) return 0;
    return solve(i+1, m) || solve(i+1, m-A[i]);
}

int main()
{
    int i, m;
    
    scanf("%d", &N);
    for (i = 0; i < N; i++) {
        scanf("%d", &A[i]);
    }
    
    scanf("%d", &Q);
    for (i = 0; i < Q; i++) {
        scanf("%d", &m);
        if (solve(0, m)) {
            puts("yes");
        }
        else {
            puts("no");
        }
    }
    
    return 0;
}

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

int main()
{
    int n;
    cin >> n;
    vector<int> a(n);

    bool frag = true;

    rep(i, n)
    {
        cin >> a.at(i);
        int x = a.at(i);

        if (x % 2 == 0)
        {
            if ((x % 3 != 0) && (x % 5 != 0))
            {
                frag = false;
                break;
            }
        }
    }

    if (frag)
    {
        cout << "APPROVED" << endl;
    }
    else
    {
        cout << "DENIED" << endl;
    }
}


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


int main() {
 int n;
 cin>>n;
 vector<double> vec(n) ;
   cout << fixed << setprecision(6);
 for (int i = 0; i < n; i++)
 {
   cin>>vec[i];
 }
   double ans=0;
 for (int i = 0; i < n-1; i++){

   sort(vec.begin(), vec.end());
  ans=(vec[i]+ vec[i+1])/2;
  vec[i+1]=ans;

  
 }
 cout << vec[n-1] <<endl;
}

Measured memory_bytes: 3808
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
using namespace std;
int absolute(int x) {
  x=max(x,-x);
  return x;
}
int main() {
  int n,l;
  cin >> n >> l;
  vector<int>taste(n);
  int sum=0;
  rep(i,n) {
    taste[i]=l+i;
    sum+=taste[i];}
  int ans=0;
  int cnt=100000;
  rep(i,n) {
    int sum_mk2=sum-taste[i];
    if(cnt>absolute(sum-sum_mk2)) {
      ans=sum_mk2;
      cnt=absolute(sum-sum_mk2);
    }}
    cout << ans << endl;
    return 0;
  }
    

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,j,k) for(int i = (int)(j);i <= (int)(k);i ++)
#define debug(x) cerr<<#x<<":"<<x<<endl
#define fix cout<<fixed<<setprecision(20);
const int maxn=(int)1e6+5;
long long a[maxn],ans;
unordered_map<int,long long> mp;
int main(){
    ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    int n;cin>>n;rep(i,1,n)cin>>a[i];
    for(int i=n;i>=1;i--){
        ans+=mp[a[i]+i];
        mp[i-a[i]]++;
    }
    cout<<ans<<endl;
}
/* 
i>j:
Ai+Aj=i-j
Ai-i=-j-Aj
i<j:
Ai+Aj=j-i
Ai+i=j-Aj
 */

Measured memory_bytes: 20000
using System;
using System.ComponentModel;

namespace Constest
{
    class Program
    {
        static void Main(string[] args)
        {
            string line = Console.ReadLine();
            string[] stArrayData = line.Split(' ');
            stArrayData = line.Split(' ');
            int x = int.Parse(stArrayData[0]);
            if(x == 0)
            {
                Console.WriteLine("1");
            }
            else
            {
                Console.WriteLine("0");

            }
     
        }
    }
}


Measured memory_bytes: 27308
# ABC120 C - Coloring Colorfully
si = lambda: input()
ni = lambda: int(input())
nm = lambda: map(int, input().split())
nl = lambda: list(map(int, input().split()))

S = si()

ans_1 = 0
ans_2 = 0

cnt_1 = 0
cnt_2 = 0

if len(S) == 1:
    print(0)
    exit()

for i,s in enumerate(S):
    if i%2 == 0:
        # 0101
        if s == '1':
            cnt_1 += 1
        # 1010
        if s == '0':
            cnt_2 += 1
    elif i%2 == 1:
        # 0101
        if s == '0':
            cnt_1 += 1
        # 1010
        if s == '1':
            cnt_2 += 1

print(min(cnt_1,cnt_2))

Measured memory_bytes: 3188
#include <bits/stdc++.h>
using namespace std;
int main(){
  	long long N,K;
  	cin>>N>>K;
  	long long ans=0;
  	if(!K){
    	cout<<N*N<<endl;
    	return 0;
  	}
  	for(long long i=K+1;i<=N;i++){
    	ans+=((N+1)/i)*(i-K);
    	long long temp=(N+1)/i;
    	if(N+1-i*temp-K>0){
      		ans+=(N+1-i*temp-K);
    	}
  	}
  	cout<<ans<<endl;
  	return 0;
}
 

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

public class Main {

    public static void main(String[] args) {
        try (Scanner in = new Scanner(System.in)) {
            solve(in);
        }
    }

    private static void solve(Scanner in) {
        int H = in.nextInt();
        int W = in.nextInt();
        char[][] a = new char[H + 2][W + 2];
        for (int i = 0; i < H + 2; i++) {
            if (i == 0 || i == H + 1) {
                Arrays.fill(a[i], '.');
            } else {
                String row = "." + in.next() + ".";
                a[i] = row.toCharArray();
            }
        }
        // for (int i = 0; i < H + 2; i++) {
        // System.out.println(Arrays.toString(a[i]));
        // }
        boolean good = true;
        for (int i = 1; i < H + 1; i++) {
            if (!good) {
                break;
            }
            for (int j = 1; j < W + 1; j++) {
                if (!good) {
                    break;
                }
                if (i == H && j == W) {
                    if (SH(a, i - 1, j) && SH(a, i, j - 1)) {
                        good = false;
                    } else {
                        System.out.println("Possible");
                        return;
                    }
                }
                if (SH(a, i, j) == false) {
                    continue;
                }
                if (SH(a, i + 1, j) && SH(a, i, j + 1)) {
                    good = false;
                }
                if (SH(a, i - 1, j) && SH(a, i + 1, j)) {
                    if (SH(a, i, j - 1) || SH(a, i, j + 1)) {
                        good = false;
                    }
                }
                if (SH(a, i, j - 1) && SH(a, i, j + 1)) {
                    if (SH(a, i - 1, j) || SH(a, i + 1, j)) {
                        good = false;
                    }
                }
            }
        }
        System.out.println("Impossible");
    }

    static boolean SH(char[][] a, int i, int j) {
        return a[i][j] == SH;
    }

    static final char SH = '#';
}

Measured memory_bytes: 9172
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(s,i, n) for (int i = (int)s; i < (int)(n); i++)
#define pb push_back
typedef long long ll;
  
int main(){
    int a,b;
    cin>>a>>b;
    cout<<max(a+b,max(a*b,a-b))<<endl;
    return 0;
}

Measured memory_bytes: 256
//这里sum就是cnt
#include <iostream>
#include <cstdio>
using namespace std;
const int N = 2e5 + 10;
int n, a[N];
long long sum[N], tot;
int main() {
    scanf("%d", &n);
    for (int i = 1; i <= n; i++) scanf("%d", &a[i]), sum[a[i]]++;
    for (int i = 1; i <= n; i++) {
        tot += sum[i] * (sum[i] - 1) / 2;
    }
    for (int i = 1; i <= n; i++) {
        printf("%lld\n", tot - (sum[a[i]] - 1));
    }
    return 0;
}


Measured memory_bytes: 3968
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.BufferedReader;

public class Main{
    public static void main(String[] args) throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String line = br.readLine();

        for(int i = 0; i < line.length(); i++){
            System.out.print(line.charAt(line.length()-i-1));
        }

        System.out.println();
    }

}

Measured memory_bytes: 24080
the_string = raw_input()
COLS, ROWS = the_string.split()
two_string = raw_input()
co, ro = two_string.split()


Mylist= [[0 for cols in range(int(COLS))] for rows in range(int(ROWS))]

for cols in range(int(co)):
        for rows in range(int(ROWS)):
                Mylist[rows][cols]=1

for rows in range(int(ro)):
        for cols in range(int(COLS)):
                Mylist[rows][cols]=1

d = sum(row.count(0) for row in Mylist)

print(d)

Measured memory_bytes: 2568
import sys
input = sys.stdin.readline
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
# A = [ int(input()) for _ in range(N) ]
##############################

N = int(input())
S = [ input() for _ in range(N) ]

ans = []

for i in range(ord('a'), ord('z')+1):
    x = INF
    for c in S:
        x = min(x, c.count(chr(i)))

    if x > 0:
        ans.append(chr(i)*x)

print(''.join(ans))



Measured memory_bytes: 3064
PROGRAM ATCODER

implicit none
integer :: a,b,c

read(*,*) a,b,c

if(a == b+c .or. b == a+c .or. c == a+b)then
  write(*,'(a)') 'Yes'
else
  write(*,'(a)') 'No'
end if

contains
!!!!!! サブルーチンは↓

!!!!!!

END PROGRAM ATCODER

Measured memory_bytes: 256
#include <iostream>
#include <functional>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <climits>

using namespace std;
typedef long long int ll;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
ll MOD = 1000000007;
#define INF (1e9)

ll gcd(ll a, ll b) { return b ? gcd(b,a%b) : a;}
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
typedef pair <ll,ll> P;

int main()
{
    ll A, B;
    cin >> A >> B;
    if (A == 1) A = 14;
    if (B == 1) B = 14;
    if (A>B) {
        cout << "Alice" << endl;
    } else if (A<B) {
        cout << "Bob" << endl;
    } else {
        cout << "Draw" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using static Input;
using static Prog;
using NX = System.Int64;

public class Solver
{
    public void Solve()
    {
        Console.WriteLine(NextInt() * 2 * Math.PI);
    }
}

public class Prog
{
    public const long MOD = 1000000007;
    public const int INF = 1000000007;
    public struct Pair { public int x, y; public Pair(int a, int b) { x = a; y = b; } }
    static void Main()
    {
        var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
        Console.SetOut(sw);
        new Solver().Solve();
        Console.Out.Flush();
        return;
    }
}

public class Input
{
    private static Queue<string> q = new Queue<string>();
    private static void Confirm() { if (q.Count == 0) foreach (var s in Console.ReadLine().Split(' ')) q.Enqueue(s); }
    public static int NextInt() { Confirm(); return int.Parse(q.Dequeue()); }
    public static long NextLong() { Confirm(); return long.Parse(q.Dequeue()); }
    public static string NextString() { Confirm(); return q.Dequeue(); }
    public static double NextDouble() { Confirm(); return double.Parse(q.Dequeue()); }
    public static int[] LineInt() { return Console.ReadLine().Split(' ').Select(int.Parse).ToArray(); }
    public static long[] LineLong() { return Console.ReadLine().Split(' ').Select(long.Parse).ToArray(); }
    public static string[] LineString() { return Console.ReadLine().Split(' ').ToArray(); }
    public static double[] LineDouble() { return Console.ReadLine().Split(' ').Select(double.Parse).ToArray(); }
    public long Abs(long a, long b) => Math.Abs(a - b);
}


Measured memory_bytes: 27932
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

from collections import Counter


def prime_decomposition(n):
    i = 2
    table = []
    while i * i <= n:
        while n % i == 0:
            n //= i
            table.append(i)
        i += 1
    if n > 1:
        table.append(n)
    return table


n = int(readline())
divisors = [1]
for i in range(1, n):
    divisors += prime_decomposition(i + 1)
counter = list(Counter(divisors).items())
ans = 1
mod = 10 ** 9 + 7
for k, v in counter:
    if k != 1:
        ans = (ans % mod) * ((v + 1) % mod) % mod
print(ans)


Measured memory_bytes: 3316
#include <iostream>
#include <stack>
using namespace std;
int main(void){
    int car;
    stack <int> s;
    while(cin >> car){
        if(car != 0)
            s.push(car); //要素を挿入する
        else{
            cout << s.top() << endl; //一番上の要素を参照し、その要素を出力する
            s.pop(); //一番上の要素を削除する
        }
    }
}


Measured memory_bytes: 3076
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <math.h>
#include <iomanip>
using namespace std;
#define int long long

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

    int x;
    int ans;
    for(int i = 1;i < 6;i ++){
        cin >> x;
        if(x == 0){
            ans = i;
        }
    }

    cout << ans << endl;

}

Measured memory_bytes: 3600
#include <iostream>
#define ll long long
using namespace std;
typedef unsigned long long ull;
int main(void){
    // Your code here!
    ll n,p;
    cin>>n>>p;
    ll ans=1;
    for(ll i=2;i*i<=p;i++){
        if(n==1){
            ans=p;
            break;
        }
        ll count=0;
        while(p%i==0){
            count++;
            if(count==n){
                count=0;
                ans*=i;
            }
            p/=i;
        }
    }
    cout<<ans;
}


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

int dp[16][16];

int main(){
	int a,b,n;
	while(scanf("%d%d",&a,&b)&&a!=0&&b!=0){
		scanf("%d",&n);
		for(int i=0;i<16;i++) for(int j=0;j<16;j++) dp[i][j]=0;
		for(int i=0;i<n;i++){
			int x,y; scanf("%d%d",&x,&y);
			dp[x-1][y-1]=-1;
		}
		dp[0][0]=1;
		for(int i=0;i<a;i++) for(int j=0;j<b;j++){
			if(dp[i][j]==-1) dp[i][j]=0;
			else dp[i][j]+=((i==0?0:dp[i-1][j])+(j==0?0:dp[i][j-1]));
		}
		printf("%d\n",dp[a-1][b-1]);
	}
}

Measured memory_bytes: 1188
#include <stdio.h>


//表計算を行うプログラム
// 表の行数rと列数c、r × c の要素を持つ表を読み込んで、
// 各行と列の合計を挿入した新しい表を出力する
int main()
{
	int iInputR, iInputC;
	int iInputValue;
	int iSum;
	int iCnt1, iCnt2;
	int* aiSumCol;

	scanf("%d %d", &iInputR, &iInputC);

	aiSumCol = (int*)malloc(sizeof(int) * (iInputC + 1));

	for (iCnt1 = 0; iCnt1 < iInputC + 1; iCnt1++)
	{
		aiSumCol[iCnt1] = 0;
	}

	for (iCnt1 = 0; iCnt1 < iInputR; iCnt1++)
	{
		iSum = 0;
		for (iCnt2 = 0; iCnt2 < iInputC; iCnt2++)
		{
			scanf("%d", &iInputValue);
			printf("%d ", iInputValue);
			aiSumCol[iCnt2] += iInputValue;
			iSum += iInputValue;
		}
		aiSumCol[iCnt2] += iSum;
		printf("%d\n", iSum);
	}

	for (iCnt1 = 0; iCnt1 < iInputC; iCnt1++)
	{
		printf("%d ", aiSumCol[iCnt1]);
	}
	printf("%d\n", aiSumCol[iCnt1]);

	return 0;
}


Measured memory_bytes: 2048
#ifdef LOCAL111
	#define _GLIBCXX_DEBUG
#else
	#pragma GCC optimize ("O3")
	#define NDEBUG
#endif
// #define _USE_MATH_DEFINES
#include <bits/stdc++.h>
const int INF = 1e9;
using namespace std;
template<typename T, typename U> ostream& operator<< (ostream& os, const pair<T,U>& p) { os << '(' << p.first << ' ' << p.second << ')'; return os; }

#define endl '\n'
#define ALL(a)  (a).begin(),(a).end()
#define SZ(a) int((a).size())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#ifdef LOCAL111
	#define DEBUG(x) cout<<#x<<": "<<(x)<<endl
	template<typename T> void dpite(T a, T b){ for(T ite = a; ite != b; ite++) cout << (ite == a ? "" : " ") << *ite; cout << endl;}
#else
	#define DEBUG(x) true
	template<typename T> void dpite(T a, T b){ return; }
#endif
#define F first
#define S second
#define SNP string::npos
#define WRC(hoge) cout << "Case #" << (hoge)+1 << ": "
template<typename T> void pite(T a, T b){ for(T ite = a; ite != b; ite++) cout << (ite == a ? "" : " ") << *ite; cout << endl;}
template<typename T> bool chmax(T& a, T b){if(a < b){a = b; return true;} return false;}
template<typename T> bool chmin(T& a, T b){if(a > b){a = b; return true;} return false;}

template<typename T>
vector<T> make_v(size_t a){return vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
  return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value!=0>::type
fill_v(U &u,const V... v){u=U(v...);}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value==0>::type
fill_v(U &u,const V... v){
  for(auto &e:u) fill_v<T>(e,v...);
}

const array<int, 4> dx = {0, 1, 0, -1};
const array<int, 4> dy = {1, 0, -1, 0};


typedef long long int LL;
typedef unsigned long long ULL;
typedef pair<int,int> P;

void ios_init(){
	//cout.setf(ios::fixed);
	//cout.precision(12);
#ifdef LOCAL111
	return;
#endif
	ios::sync_with_stdio(false); cin.tie(0);
}

int main()
{
	ios_init();
	int n;
	string s;
	while(cin >> n >> s) {
		int cnt = 0;
		REP(i, n - 1) {
			cnt += (s[i] != s[i + 1]);
		}
		cout << cnt + 1 << endl;
	}
	return 0;
}


Measured memory_bytes: 512
from collections import deque
n = int(input())
dist = [[] for _ in range(n)]
for i in range(n-1):
  a, b, c = map(int, input().split())
  dist[a-1].append([a-1, b-1, c])
  dist[b-1].append([b-1, a-1, c])

q, k = map(int, input().split())
dist_k = [0]*n

not_yet = deque(dist[k-1])
already = [False]*n
already[k-1] = True
for a, b, c in dist[k-1]:
  already[b] = True

while not_yet:
  key = not_yet.popleft()
  a, b, c = key[0], key[1], key[2]
  dist_k[b] = dist_k[a]+c
  
  for value in dist[b]:
    if already[value[1]]:
      continue
    not_yet.append(value)
    already[value[1]] = True

for i in range(q):
  x, y = map(int, input().split())
  print(dist_k[x-1]+dist_k[y-1])

Measured memory_bytes: 57028
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<iostream>
#include<cstring>
#define ll long long
using namespace std;
string s[1000000];
int main()
{	
	ios::sync_with_stdio(false);
	int n;
	cin>>n;
	for(int i=0;i<n;i++)
	{
		cin>>s[i];
		sort(s[i].begin(),s[i].end());
	}
	sort(s,s+n);
	ll sum=0;
	long long ans=0;
 	for(int i=0;i<n-1;i++)
 	{
	 	if(s[i]==s[i+1])
 			ans++;		
 		else {
 			sum+=ans*(ans+1)/2;
 			ans=0;
		 }
	}
	sum+=ans*(ans+1)/2;
	cout<<sum<<endl;	
	return 0;
}

Measured memory_bytes: 12800
#include<bits/stdc++.h>
using namespace std;
int main(){
    int d,t,s;
    cin>>d>>t>>s;
    if(double(d)/double(s)<=t){
        std::cout << "Yes" << std::endl;
    }
    else{
        std::cout << "No" << std::endl;
    }
}

Measured memory_bytes: 3616
import java.util.*;
import java.io.*;
class Main {
    public static void main(String[] args) throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st= new StringTokenizer(br.readLine());
        int S = Integer.parseInt(st.nextToken());
        int W = Integer.parseInt(st.nextToken());
        String ans = W>=S ? "unsafe":"safe";
        System.out.println(ans);
    }
}

Measured memory_bytes: 32424
#include <iostream> // cin, cout, cerr, clog
#include <algorithm> // minmax, sort, swap
#include <numeric> // iota, gcd, lcm 
#include <cstdio> // printf, scanf
#include <climits> // INT_MIN, LLONG_MIN
#include <cmath> // long, trig, pow
#include <vector> // vectors
#include <string> // string
#include <queue> // queue
#include <stack> // stack
#include <map> // key-value pairs sorted by keys
#include <unordered_map> // hashed by keys
#include <iomanip> //cout<<setprecision(n)
#define rep(i,n) for(int i = 0; i < n; i++)

typedef long long ll; // at least int64 > 9*10^18
typedef unsigned long long ull; // at least uint64

struct UnionFind
{
  int n;
  std::vector<int> par,size;
  void reset() {
    std::iota(par.begin(),par.end(),0);
  }
  UnionFind(int sz) : n(sz), par(sz,0), size(sz,0) {
    reset();
  }
  int find(int x) {
    if(par[x]==x) return x;
    return par[x] = find(par[x]);
  }
  void unite(int x, int y) {
    x=find(x);y=find(y);
    if(x==y) return;
    if(size[x]<size[y]) std::swap(x,y);
    size[x]+=size[y];
    par[y]=x;
  }
};

int main() {
  int n,m;
  std::cin >> n >> m;
  int a[m];
  int b[m];
  rep(i,m) {
    std::cin >> a[i] >> b[i];
    a[i]--;
    b[i]--;
  }
  int count = 0;
  UnionFind uf(n);
  rep(i,m) {
    uf.reset();
    rep(j,m) {
      if(i!=j) uf.unite(a[j],b[j]);
    }
    bool connected = true;
    int tmp = uf.find(0);
    rep(j,n) {
      if(uf.find(j)!=tmp) connected = false;
    }
    if(connected == false) count ++;
  }
  std::cout << count << std::endl;
  return 0;
}

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

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

#define fast ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)

#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>

#define ll long long
#define ld long double
#define pb push_back
#define eb(a) emplace_back(a)

#define xx first
#define yy second
#define mp make_pair
#define pll pair<ll,ll>
#define mll map<ll,ll>
#define vll vector<ll>
#define pdd pair<double,double>
#define ALL(v) (v).begin(), (v).end()

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

#define MODSET(d) if ((d) >= MOD) d %= MOD;
#define MODNEGSET(d) if ((d) < 0) d = ((d % MOD) + MOD) % MOD;
#define put(x) cout<<#x<<" = "<<x<<endl;

#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " = " << a << endl;
	err(++it, args...);
}

ll power(ll a,ll n){
    ll ans=1;
    while(n){
        if(n&1)
            ans=(ans*a);
        n>>=1;
        a=(a*a);
    }
    return ans;
}


ll powerMod(ll a,ll n){
    ll ans=1;
    while(n){
        if(n&1)
            ans=(ans*a)%MOD;
        n/=2;
        a=(a*a)%MOD;
    }
    return ans;
}

ll powerMod1(ll a,ll n,ll mod){
	a = a%mod;
    ll ans=1;
    while(n){
        if(n&1)
            ans=(ans*a)%mod;
        n>>=1;
        a=(a*a)%mod;
    }
    return ans;
}

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

ll sumdigit(ll n){
    ll sum=0;
    while(n){
        sum+=n%10;
        n=n/10;
    }
    return sum;
}

ll countSetBit(ll a){
    return __builtin_popcount(a);
}
ll countBit(ll a){
    ll sum=0;
    while(a){
        sum++;
        a>>=1;
    }
    return sum;
}

ll length(ll a){
    ll ans=0;
    while(a){
        ans++;
        a=a/10;
    }
    return ans;
}

bool isVowel(char c){
	if(c=='a' or c=='e' or c=='i' or c=='o' or c=='u')
		return true;
	return false;
}
template <typename T>
void max_self(T &a, T b ){
	a = max(a, b);
}

int main()
{
    fast;
    int t;
    //~ cin>>t;
    t=1;
    while(t--){
		ll n,W;
		cin>>n>>W;
		
		vector<ll> dp(W+1);
		
		for(int i=0;i<n;i++){
			ll weight,val;
			cin>>weight>>val;
			
			for(int cur_weight = W-weight; cur_weight>=0;cur_weight--){
				max_self(dp[cur_weight+weight], dp[cur_weight]+val);
			}
		}
		ll answer = 0;
		for(auto x: dp)
			max_self(answer,x);
		cout<<answer;
    }
    return 0;
}


Measured memory_bytes: 1024
N=int(input())
X=[int(i) for i in input().split()]

X.sort()

if N%2==0:
    ans=10**10
    for i in range(1,100):
        a=0
        for j in range(N):
            a+=(X[j]-i)**2
        ans=min(ans,a)
else:
    ans=10**10
    for i in range(1,100):
        a=0
        for j in range(N):
            a+=(X[j]-i)**2
        ans=min(ans,a)

print(ans)


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

using namespace std;

#define pb push_back
#define mp make_pair
#define eb emplace_back


typedef long long ll;
typedef long double ld;


const ll inf = 2e9;
const ll base = 998244353;
ll mod = 1e9 + 7;


int main() {
//    srand(time(NULL));
//    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);
    std::ios_base::sync_with_stdio(false);
    std::cin.tie(nullptr);
//    std::random_device rd;
//    std::mt19937 g(rd());

    auto start = clock();

    int r; cin >> r;
    cout << 1LL * r * r << endl;


    std::cerr << double(clock() - start) / CLOCKS_PER_SEC << std::endl;
    return 0;
}


Measured memory_bytes: 256
N = int(input())
l = [[] for i in range(N)]
for i in range(N):
    A = int(input())
    l[i] = [0 for j in range(A)]
    for j in range(A):
        x, y = map(int, input().split())
        l[i][j] = [x, y]

ans = 0
for i in range(2**N):
    cnt = 0
    flag = True
    for j in range(N):
        if (i >> j) & 1:
            cnt += 1
            for k in range(len(l[j])):
                #人1, 2, 3　--> 人0, 1, 2のため、-1をする
                if (i >> (l[j][k][0] - 1)) & 1 == l[j][k][1]:
                    pass
                else:
                    flag = False
                    break
    if flag:
        ans = max(ans, cnt)
    cnt = 0
print(ans)

Measured memory_bytes: 3064
#include<iostream>
#include<cstdio>
//#include<cmath>
//#include<algorithm>
//#include<cstring>
//#include<map>
using namespace std;
inline int read()
{
    int p=0,f=1;char c=getchar();
    while(c<'0'||c>'9'){if(c=='-') f=-1;c=getchar();}
    while(c>='0'&&c<='9'){p=p*10+c-'0';c=getchar();}
    return f*p;}
int N,a[107][107],f[107][107];
int main()
{
	N=read();
	for(int i=1;i<=2;i++)
	   for(int j=1;j<=N;j++)
	       a[i][j]=read();
	f[1][1]=a[1][1];
	for(int i=1;i<=2;i++)
	    for(int j=1;j<=N;j++)
	        f[i][j]=max(f[i][j-1]+a[i][j],f[i-1][j]+a[i][j]);
	cout<<f[2][N];
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define REPR(i, n) for (int i = n - 1; i >= 0; i--)
#define INF 1LL << 60;
#define LLINF 1e12
#define PI 3.14159265359
int dy[] = {1, 0, -1, 0};
int dx[] = {0, 1, 0, -1};
int ny, nx;
typedef long long ll;
using namespace std;

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

ll lcm(ll m, ll n)
{
    if ((0 == m) || (0 == n))
        return 0;
    return ((m / gcd(m, n)) * n);
}

ll llpow(ll x, ll y)
{
    ll ans = 1;
    REP(i, y)
    ans *= x;
    return ans;
}

ll llmin(ll x, ll y) { return x < y ? x : y; }
ll llmax(ll x, ll y) { return x > y ? x : y; }

template <typename Container>
bool exist_in(const Container &c, const typename Container::value_type &v)
{
    return (c.end() != std::find(c.begin(), c.end(), v));
}

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

//std::cout << std::defaultfloat << std::setprecision(10);
////////////////////////////////////////
int main()
{
    ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);

    string S; 
    cin >> S;

    if(S[2]==S[3] and S[4]==S[5]) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}


Measured memory_bytes: 256
// {{{ by shik
#include <bits/stdc++.h>
#include <unistd.h>
#define SZ(x) ((int)(x).size())
#define ALL(x) begin(x),end(x)
#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 FOR(it,c) for ( auto it=(c).begin(); it!=(c).end(); it++ )
#define MP make_pair
#define PB push_back
using namespace std;
typedef long long LL;
typedef pair<int,int> PII;
typedef vector<int> VI;

#ifdef SHIK
template<typename T>
void _dump( const char* s, T&& head ) { cerr<<s<<"="<<head<<endl; }

template<typename T, typename... Args>
void _dump( const char* s, T&& head, Args&&... tail ) {
    int c=0;
    while ( *s!=',' || c!=0 ) {
        if ( *s=='(' || *s=='[' || *s=='{' ) c++;
        if ( *s==')' || *s==']' || *s=='}' ) c--;
        cerr<<*s++;
    }
    cerr<<"="<<head<<", ";
    _dump(s+1,tail...);
}

#define dump(...) do { \
    fprintf(stderr, "%s:%d - ", __PRETTY_FUNCTION__, __LINE__); \
    _dump(#__VA_ARGS__, __VA_ARGS__); \
} while (0)

template<typename Iter>
ostream& _out( ostream &s, Iter b, Iter e ) {
    s<<"[";
    for ( auto it=b; it!=e; it++ ) s<<(it==b?"":" ")<<*it;
    s<<"]";
    return s;
}

template<typename A, typename B>
ostream& operator <<( ostream &s, const pair<A,B> &p ) { return s<<"("<<p.first<<","<<p.second<<")"; }
template<typename T>
ostream& operator <<( ostream &s, const vector<T> &c ) { return _out(s,ALL(c)); }
template<typename T, size_t N>
ostream& operator <<( ostream &s, const array<T,N> &c ) { return _out(s,ALL(c)); }
template<typename T>
ostream& operator <<( ostream &s, const set<T> &c ) { return _out(s,ALL(c)); }
template<typename A, typename B>
ostream& operator <<( ostream &s, const map<A,B> &c ) { return _out(s,ALL(c)); }
#else
#define dump(...)
#endif

template<typename T>
void _R( T &x ) { cin>>x; }
void _R( int &x ) { scanf("%d",&x); }
void _R( long long &x ) { scanf("%" PRId64,&x); }
void _R( double &x ) { scanf("%lf",&x); }
void _R( char &x ) { scanf(" %c",&x); }
void _R( char *x ) { scanf("%s",x); }

void R() {}
template<typename T, typename... U>
void R( T& head, U&... tail ) {
    _R(head);
    R(tail...);
}

template<typename T>
void _W( const T &x ) { cout<<x; }
void _W( const int &x ) { printf("%d",x); }
template<typename T>
void _W( const vector<T> &x ) {
    for ( auto i=x.cbegin(); i!=x.cend(); i++ ) {
        if ( i!=x.cbegin() ) putchar(' ');
        _W(*i);
    }
}

void W() {}
template<typename T, typename... U>
void W( const T& head, const U&... tail ) {
    _W(head);
    putchar(sizeof...(tail)?' ':'\n');
    W(tail...);
}

#ifdef SHIK
#define FILEIO(...)
#else
#define FILEIO(name) do {\
    freopen(name ".in","r",stdin); \
    freopen(name ".out","w",stdout); \
} while (0)
#endif

// }}}

const int N=1e5+10;
const LL MOD=1e9+7;

int n,x[N];
int main() {
    R(n);
    REP(i,n) R(x[i]);
    LL ans=1;
    int t=0;
    REP(i,n) {
        t++;
        if ( x[i]<2*t-1 ) {
            ans*=t;
            ans%=MOD;
            t--;
        }
    }
    while ( t>0 ) {
        ans*=t;
        ans%=MOD;
        t--;
    }
    W(ans);
    return 0;
}


Measured memory_bytes: 640
#include <vector>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>

using namespace std;

const int N = 1000000 + 5;
const int D = 29;

int n;
int a[N], b[N];
int cnt[N];

void solve()
{
    cin >> n;
    for (int i = 0; i < n; i++) {
        scanf("%d", a + i);
        if (n & 1) {
            for (int j = 0; j < D; j++) {
                cnt[j] ^= (a[i] >> j & 1);
            }
        }
    }
    for (int i = 0; i < n; i++) {
        scanf("%d", b + i);
        if (n & 1) {
            for (int j = 0; j < D; j++) {
                cnt[j] ^= (b[i] >> j & 1);
            }
        }
    }
    sort(b, b + n);

    for (int j = 1; j < D; j++) {
        vector<int> vec;
        int mask = (1 << j) - 1;
        for (int i = 0; i < n; i++) {
            vec.push_back(b[i] & mask);
        }
        sort(vec.begin(), vec.end());
        for (int i = 0; i < n; i++) {
            int x = a[i] & mask;
            cnt[j] ^= (vec.end() - upper_bound(vec.begin(), vec.end(), mask - x)) & 1;
        }
    }
    int ret = 0;
    for (int j = D - 1; j >= 0; j--) {
        ret = ret * 2 + cnt[j];
    }
    cout << ret << endl;
}

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



Measured memory_bytes: 10308
void main() {
	int[] arr;
	arr ~= 1;
	foreach(i; 2..33) {
		int k = 2;
		while(i^^k <= 1000) {
			arr ~= i^^k;
			k++;
		}
	}
	debug arr.writeln;
	auto X = ri;
	arr.sort();
	arr.filter!(v => v <= X).array.back.writeln;
}

// ===================================

import std.stdio;
import std.string;
import std.functional;
import std.algorithm;
import std.range;
import std.traits;
import std.math;
import std.container;
import std.bigint;
import std.numeric;
import std.conv;
import std.typecons;
import std.uni;
import std.ascii;
import std.bitmanip;
import core.bitop;

T readAs(T)() if (isBasicType!T) {
	return readln.chomp.to!T;
}
T readAs(T)() if (isArray!T) {
	return readln.split.to!T;
}

T[][] readMatrix(T)(uint height, uint width) if (!isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		res[i] = readAs!(T[]);
	}
	return res;
}

T[][] readMatrix(T)(uint height, uint width) if (isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		auto s = rs;
		foreach(j; 0..width) res[i][j] = s[j].to!T;
	}
	return res;
}

int ri() {
	return readAs!int;
}

double rd() {
	return readAs!double;
}

string rs() {
	return readln.chomp;
}

Measured memory_bytes: 256