akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
#define MAX 10000

int main(){
  int i,j,k,a,flag,n;
  int data[MAX];
  int count = 0;

  scanf("%d",&n);

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

  for(i = 0;i < n;i++){
    flag = 0;
    a = data[i];
    j = 1;
    
    while(1){
      j++;
      if(j*j > a) {
	j = j + 1;
	break;
      }
    }
    for(k = 2;k <= j;k++){
      if(a == 2 || a == 3){
	flag = 1;
      }
      if(a%k == 0) break;
      if(k == j){
	flag = 1;
      }
    }
    if(flag != 0){
      count++;
    }
  }

  printf("%d\n",count);
  
}



Measured memory_bytes: 2044
#include "bits/stdc++.h"

using namespace std;

using ll = long long;
using ld = long double;

const double PI = 3.1415926535897932384626433832795;
const ll MOD = 1000000007;

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

int gcd(int x, int y) { return y ? gcd(y, x % y) : x; }
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
int lcm(int x, int y) { return x / gcd(x, y) * y; }
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }

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

	ll n, a, b;
	cin >> n >> a >> b;

	vector<ll> x(n);
	for (auto &v : x) {
		cin >> v;
	}

	vector<ll> dp(n);
	for (int i = 1; i < n; i++) {
		dp[i] += dp[i - 1] + min(a * (x[i] - x[i - 1]), b);
	}

	cout << dp[n - 1] << endl;
	return 0;
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
#include<string>
#include<vector>
using namespace std;
typedef pair<int, int>P;
typedef long long ll;
#define rep(i,n)for(ll i=0;i<n;++i)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll MOD = 1000000007;
const ll INF = 1e16;
const ll MAX_N = 5000100;
//max=({});
//条件式が真ならwhileの中身を回し続ける
//printf("%d\n", ans);

//pairの入力
//vector<pair<ll, ll>>work(n);
//rep(i, n) {
//	ll a, b;
//	cin >> a >> b;
//	work[i] = make_pair(a, b);
//for(auto p:mp)(mapの探索)
//printf("%.10f\n",なんちゃら)
//最大公約数
ll gcd(ll x, ll y) {
	return y ? gcd(y, x % y) : x;
}

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

//組み合わせの余りを求める
ll fac[MAX_N], finv[MAX_N], inv[MAX_N];
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX_N; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}

// 二項係数計算
long long COM(ll n,ll k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

ll dx[8] = { 0,0,-1,1 };
ll dy[8] = { -1,1,0,0 };
ll dp[101010];

//long longしか使わない
//素数は1より大きい
int main() {
	ll x, y;
	cin >> x >> y;
	ll n = (2 * y - x) / 3;
	ll m = (2 * x - y) / 3;
	if ((x + y) % 3 != 0) {
		cout << 0 << endl;
	}
	else if (n < 0 || m < 0) {
		cout << 0 << endl;
	}
	else {
		COMinit();
		cout << COM(n + m, m) << endl;
	}
	return 0;
}


Measured memory_bytes: 117376
#pragma comment(linker, "/stack:20000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx")

#include <bits/stdc++.h>
 
#define se second
#define fi first
#define mp make_pair
#define pb push_back
 
using namespace std;
 
typedef long long ll;

int x[7];

int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	cin >> x[1] >> x[2] >> x[3] >> x[4] >> x[5];
	for(int i = 1; i <= 5; i++)
		if(x[i] == 0){
			cout << i;
		}
}

Measured memory_bytes: 3572
import sys
read = sys.stdin.buffer.read
input = sys.stdin.buffer.readline
inputs= sys.stdin.buffer.readlines
#rstrip().decode('utf-8')

import numpy as np
#import operator
#import bisect
#from heapq import heapify,heappop,heappush
#from math import gcd
#from fractions import gcd
#from collections import deque
#from collections import defaultdict
#from collections import Counter
#from itertools import accumulate
#from itertools import groupby
#from itertools import permutations
#from itertools import combinations
from scipy.sparse import csr_matrix
from scipy.sparse.csgraph import floyd_warshall
#from scipy.sparse.csgraph import csgraph_from_dense
#from scipy.sparse.csgraph import dijkstra
#sys.setrecursionlimit(10**7)

#map(int,input().split())

def main():
    N,M,L=map(int,input().split())
    ABCQST=np.array(read().split(),np.int64)
    ABC=ABCQST[:3*M]
    A=ABC[::3]
    B=ABC[1::3]
    C=ABC[2::3]
    ST=ABCQST[3*M+1:]
    S=ST[::2]
    T=ST[1::2]

    graph1=csr_matrix((C,(A,B)),(N+1,N+1))
    graph1_dist=floyd_warshall(graph1,directed=False)

    graph2=np.full(((N+1),(N+1)),np.inf)
    np.fill_diagonal(graph2,0)
    graph2[graph1_dist<=L+0.5]=1

    graph2_dist=floyd_warshall(graph2,directed=False)
    graph2_dist[graph2_dist==np.inf]=0
    graph2_dist=(graph2_dist+0.5).astype(int)
    ans=graph2_dist[S,T]-1
    print("\n".join(ans.astype(str)))


if __name__ == '__main__':
    main()

Measured memory_bytes: 37948
#include <bits/stdc++.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <string>
#include <deque>
using namespace std;


int main() {
    //input
    string str; cin >> str;
    int size;
    size = str.size();
    int a,b,c;
    a = 0;
    b = 0;
    c = 0;

    if(size == 1){
        cout << "YES" << endl;
        return 0;             
    }

    if(size == 2){
        if( str.at(0) == str.at(1)){
            cout << "NO" << endl;
            return 0;
        }else{
            cout << "YES" << endl;
            return 0;
        }            
    }

    //compute
    for(int i = 0; i < size; i++){
        if(str.at(i) == 'a'){
            a += 1;
        }else if(str.at(i) == 'b'){
            b += 1;
        }else{
            c += 1;
        }        
    }

    bool p,q,r;
    int k;
    k = size / 3;
    p = (a == k) || (a == k + 1); 
    q = (b == k) || (b == k + 1);
    r = (c == k) || (c == k + 1);

    if(p && q && r){
        cout << "YES" << endl;
    }else{
        cout << "NO" << endl;
    }

    //output
}



Measured memory_bytes: 3736
#include <bits/stdc++.h>
using namespace std;
int N, K;
double ans = 0.0;

void solve() {
	for (int i = 1; i <= N; i++)
	{
		int j = i;
		double win = 1.0 / N;
		while (j < K)
		{
			j *= 2;
			win /= 2.0;
		}
		ans += win;
	}
	cout << setprecision(15) << ans<<endl;
}
int main() {
	cin >> N >> K;
	solve();
}

Measured memory_bytes: 256
n, Y = [int(s) for s in input().split(' ')]
 
for x in range(n, -1, -1):
    if Y < x*10000 or n < x:
        continue
    
    for y in range(n-x, -1, -1):
        if Y < x*10000+y*5000 or n < x+y:
            continue
            
        z = n-x-y
        if Y == x*10000+y*5000+z*1000:
            print('{} {} {}'.format(x, y, z))
            exit()
            
print('-1 -1 -1')

Measured memory_bytes: 3064
#include<stdio.h>
int main()
{
	int a,b,c,x,y,i=0,j=0,z,p,tot;
	scanf("%d %d %d %d %d", &a, &b, &c, &x, &y);
	if(x>=y) 
	{
		i= x-y;
		p= y;
	}
	else 
	{
		j = y-x;
		p = x;
	}
	if(a+b>2*c) z = 2*c;
	else z = a+b;
	if(a>2*c) 
		a=2*c;
	if(b>2*c)
		b=2*c;
	tot = z*p + i*a + j*b;
	printf("%d\n",tot);
	return 0;
}

Measured memory_bytes: 256
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author
 */

#include <iostream>
#include <fstream>

#include "bits/stdc++.h"

#define REP(i,x,y) for(int i=(x);i<(y);i++)
#define RREP(i,x,y) for(int i=(y)-1;i>=(x);i--)
#define all(x) (x).begin(),(x).end()
//#define int long long

using namespace std;

// conversion
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

#define dump(x)  cout << #x << " = " << (x) << endl
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl

typedef long long ll;

const ll MOD = 1e9 + 7;

class BCountABC {
public:
    void solve(std::istream& in, std::ostream& out) {
        int N;
        in >> N;
        string S;
        in >> S;
        int answer = 0;
        REP(i,0,N-2) {
            if (S[i] == 'A' && S[i+1] == 'B' && S[i+2] == 'C') answer++;
        }
        out << answer << "\n";
    }
};


signed main() {
    BCountABC solver;
    std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 256
import java.util.HashSet;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int N = Integer.parseInt(sc.next());
		
		HashSet<Integer> integers=new HashSet<Integer>();
		while(true) {
			
			if(!integers.add(N)) {
				break;
			}
			N=function(N);
		}
		
		System.out.println(integers.size()+1);
		sc.close();
	}
	
	public static Integer function(Integer N) {
		if(N%2==0) {
			N=N/2;
		}else {
			N=3*N+1;
		}
		return N;
	}
}


Measured memory_bytes: 21844
import numpy as np

N = int(input())
A = np.array(list(map(int, input().split())))

A.sort()
answer = 1
B = A.cumsum()
C = A[1:] <= (2 * B)[:-1]
C = reversed(list(C))
for c in C:
    if not c:
        break
    else:
        answer += 1
print(answer)

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

int main() {
    ll A, B, C, K;
    cin >> A >> B >> C >> K;
    ll ans = 0;
    if (K<=A) {
        ans = K;
    }
    else if (A<K and K<=A+B) {
        ans = A;
    }
    else {
        ans = A - (K-(A+B));
    }
    cout << ans << endl;
}

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

using namespace std;

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

    if(N >= 100){
        cout << "ABC" << N << endl;
    }else if(N >= 10){
        cout << "ABC0" << N;
    }else{
        cout << "ABC00" << N;
    }

    return 0;
}

Measured memory_bytes: 256
n=int(input())
a=[]
for i in range(5):
    a.append(int(input()))
    
ans=5
ind=0
m=min(a)
for i in range(n):
    if m==a[i]:
        ind=i
        break
k=n//m
if n%m!=0:
    k+=1
print(ans+k-1)

Measured memory_bytes: 3064
while True:
    H,W=map(int,input().split())
    if H==0 and W==0:
        break
    for i in range(H):
        for j in range(W):
            if i==0 or i==H-1 or j==0 or j==W-1:
                print("#",end="")
            else:
                print(".",end="")
        print()
    print()



Measured memory_bytes: 7004
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define rep1(i,n) for(int i=1; i<=(n); ++i)
#define repi(i,a,b) for(int i=a; i<=(b); ++i)
#define ALL(obj) (obj).begin(), (obj).end()
#define pb push_back
#define sz(v) (int)v.size()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
using ll = long long;
using namespace std;
struct aaa{aaa(){ cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(20);};}aaaaaaa;
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

int N;
double a,b,c,d;
double EPS = 1e-6;
double EPS2 = 1e-10;

double func(double x){
    return a*x*x*x + b*x*x + c*x + d;
}

int pl,mn;

bool is_zero(double x){
    if(abs(x) < EPS) return true;
    return false;
}

bool fis_zero(double x){
    if(abs(x) < EPS2) return true;
    return false;
}

void add(double x){
    if(is_zero(x)) return;
    if(x > 0) pl++;
    else if(x < 0) mn++;
    return;
}

void bisearch(double x, double y){
    if(func(y) < func(x)) swap(x,y);
    if(fis_zero(func(x))){ add(x); return;}
    if(fis_zero(func(y))){ add(y); return;}
    double mid;
    int ct = 0;
    rep(i,100){
        mid = (x+y)/2;
        if(fis_zero(func(mid))) break;
        if(func(mid) > 0) y = mid;
        else if(func(mid) < 0) x = mid;
        ct++;
    }
    if(ct == 100) return;
    add(mid);
    return;
}

int main(){
    int N;
    cin >> N;
    rep(i,N){
        cin >> a >> b >> c >> d;
        b /= a, c /= a, d /= a, a = 1;
        pl = 0, mn = 0;
        double D = b*b - 3*a*c;
        double xl,xs;
        
        if(D < 0) bisearch(-10000,10000);
        else{
            xs = (-b-sqrt(D))/(3*a);
            xl = (-b+sqrt(D))/(3*a);
            bisearch(-10000,min(xs,xl));
            bisearch(min(xs,xl),max(xs,xl));
            bisearch(max(xs,xl),10000);
        }
        
        cout << pl << " " << mn << endl;
    }
    
}


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

#define FOR(i, a, b) for(int i = (int)a; i <= (int)b; ++i)
#define FORD(i, a, b) for (int i = (int)a; i >= (int)b; --i)
#define REP(i, n) for (int i = 0; i < (int)n; ++i)
#define Debug(x) cerr << #x << " = " << x << '\n';
#define HERE cerr << "HERE\n\n";
#define X first
#define Y second
#define pb push_back
#define FASTER { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); }

using namespace std;

typedef pair <int, int> ii;
typedef vector <int> vi;



int main(){
    FASTER
//    freopen("x.INP", "r", stdin);
//    freopen("x.OUT", "w", stdout);
    int64_t a, b;
    cin >> a >> b;
    cout << a*b/__gcd(a, b);
}


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

int main() {
	int N;
	string name;
	cin >> N >> name;
	int ans=0;
	while(N-->0){
		string str;
		cin >> str;
		
		int count=0;
		for(int i=0;i<str.length();i++){
			for( int j=1; i+(name.length()-1)*j < str.length() ;j++){
				bool ok = true;
				for(int k=0;k<name.length();k++){
					if( str[i+k*j] != name[k]){
						ok=false;
						break;
					}
				}
				if(ok){
//					cout << i << " " << j << endl;
					count++;
				}
			}
		}
		if(count>0) ans++;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1212
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define ld long double
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; }
using P=pair<long long,long long>;
#define rep(i,n) for(long long i=0; i<(long long)n; i++)
#define FOR(i,a,b) for(long long i=a; i<b; i++)
#define all(x) (x).begin(), (x).end()
#define SZ(x) ((long long)(x).size())
#define COUT(x) cout << x << endl
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define vint vector<int>
#define vvint vector<vector<int>>
#define vstr vector<string>
#define vp vector<pair<int,int>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
#define SUM(x) accumulate(x.begin(),x.end(),0)
#define MAX(x) *max_element(x.begin(),x.end())
#define MIN(x) *min_element(x.begin(),x.end())
#define couty cout<<"Yes"<<endl
#define coutn cout<<"No"<<endl
#define coutY cout<<"YES"<<endl
#define coutN cout<<"NO"<<endl
#define yn(x) cout<<(x?"Yes":"No")<<endl
#define YN(x) cout<<(x?"YES":"NO")<<endl
long long gcd(long long a,long long b){return b?gcd(b,a%b):a;}
long long lcm(long long a, long long b){return a*b/gcd(a,b);}
const long long dx[4]={1,0,-1,0};
const long long dy[4]={0,1,0,-1};
const long long INF = 1e12;
const long long MOD = 1e9+7;

signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout<<fixed<<setprecision(15);

    int n; cin >> n;
    vint a(n);
    rep(i,n) cin >> a[i];
    sort(all(a));
    int p,q;
    //pCqを求める
    //pはaの中で最大の数,qはp/2に近いほどよい
    p=a[n-1];

    int max=-1*INF;
    ld half=(ld)p/2.0;
    ld min=INF;
    rep(i,n-1){    
        if(abs(half-a[i])<min){
            chmin(min,abs(half-a[i]));
            q=a[i];
        }
    }

    cout<<p<<' '<<q<<endl;
    
}

Measured memory_bytes: 1024
def judge(s):
	if len(s) == 2:
		if s[0] == s[1]: return [1, 2]
		else: return [-1, -1]
	else:
		for i in range(0, len(s)-2):
			if s[i] == s[i+1] or s[i] == s[i+2] or s[i+1] == s[i+2]:
				return [i+1, i+3]
		return [-1, -1]

s = raw_input()
ans = judge(s)
print str(ans[0]) + " " + str(ans[1])


Measured memory_bytes: 5892
key = raw_input().upper()
c = ''
while True:
    s = raw_input()
    if s == 'END_OF_TEXT':
        break
    c = c + ' ' + s.upper()
   
cs = c.split()
total = 0
for w in cs:
    if w == key:
        total = total + 1
        
print total

Measured memory_bytes: 4204
#include <iostream>
#include <vector>
#include <string>
#include <math.h>
#include <algorithm>
#include <set>
#include <iomanip>
#include <stdio.h>
#include <sstream>
#include <string>
using namespace std;
int main(void){
    string s;
    cin>>s;
    for(int i=0; i<s.length(); i++){
        if(s[i]=='1') {s[i]='9';}
        else if(s[i]=='9') s[i]='1';
    }
    cout<<s<<endl;
}

Measured memory_bytes: 764
#include <stdio.h>

int num[1000000];

int main(void)
{
	int n, i, j;
	int count;
	
	for (i = 0; i <= 999999; i++){
		num[i] = 1;
	}
		
	num[0] = 0;
	num[1] = 0;
	
	for (i = 2; i * i <= 999999; i++){
		if (num[i] == 1){
			for (j = i * i; j <= 999999; j += i){
				num[j] = 0;
			}
		}
	}
	
	
	while (scanf("%d", &n) != EOF){
		
		for (i = 1; num[n + i] != 1; i++);
		for (j = 1; num[n - j] != 1; j++);
		
		printf("%d %d\n", n - j, n + i);
	}
	
	return (0);
}

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

int main(int argc, char const *argv[])
{
	char a,b;
	cin>>a>>b;
	if (a<b)
	{
		cout<<"<\n";
	}
	else if (a>b)
	{
		cout<<">\n";
	}
	else
	{
		cout<<"=\n";
	}
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<cstdio>
#include<string>
#include<stdio.h>
#include<stdlib.h>
#include<float.h>
#include<tuple>
#include<string.h>
#include<iomanip>
#include<stack>
#include<queue>
#include<map>

using namespace std;
#define ll long long
#define rep(i,n) for(ll i=0;i<n;i++)
#define ALLOF(c) (c).begin(), (c).end()
#define Pa pair<ll,ll>
const ll mod=1000000007;
const ll INF=10e12;
const ll inf=-1;
ll ABS(ll a){return max(a,-a);}


int main(void){
    string X;
    cin>>X;
    stack<char> fixX;
    rep(i,X.size()){
        if(X.at(i)=='S') fixX.push('S');
        else{
            if(fixX.empty()) fixX.push('T');
            else if(fixX.top()=='S') fixX.pop();
            else fixX.push('T');
        }
    }
    if(fixX.empty()) cout<<0<<endl;
    else cout<<fixX.size()<<endl;
    return 0;
}


Measured memory_bytes: 644
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
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;}
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(vec) vec.begin(),vec.end()
typedef long long ll;
typedef pair<ll,ll> l_l;
typedef pair<int,int> i_i;
typedef pair<int,string> i_s;
const ll mod=1e9+7;
const int inf=1<<30;

int main(){
  vector<string> ans(0);
  int n; cin >> n;
  vector<string> s(n);
  set<string> st;
  map<string,int> mp;
  int mx=0;
  rep(i,n){
    cin >> s[i];
    st.insert(s[i]);
    mp[s[i]]++;
    chmax(mx,mp[s[i]]);
  }
  vector<pair<int,string> > v(0);
  for(auto c:st){
    if(mp[c]==mx) ans.push_back(c);
  }
  sort(all(ans));
  int l=ans.size();
  //cout << "-" << endl;
  rep(i,l){
    cout << ans[i] << endl;
  }
  
}

Measured memory_bytes: 37876
#include <bits/stdc++.h>
#define FASTIO ios::sync_with_stdio(false);cin.tie(0);
#define ADD +
#define SUBTRACT -
#define MULTIPLY *
#define DIVIDE /
#define MOD %
#define INCREMENT(x) ++x
#define DECREMENT(x) --x
#define in(a,b) cin>>a>>b;
#define out(a,b) cout<<a<<endl<<b<<endl;
#define scan(a) scanf("%d",&a);
#define print(a) printf("%d\n",a);
#define scanii(a,b) scanf("%d %d",&a,&b);
#define printii(a,b) printf("%d\n%d\n",a,b);
#define scaniii(a,b,c) scanf("%d %d %d",&a,&b,&c);
#define pub push_back
#define pob pop_back
#define puf push_front
#define pof pop_front
#define ll long long
#define ull unsigned long long
#define sll signed long long
#define pi acos(-1)
#define mod 1000000007
#define TRUE 1
#define FALSE 0
#define ZERO 0
#define MP make_pair
#define F first
#define S second
#define f1(i,a) for(int i=0;i<a;++i)
#define f2(i,a) for(int i=a-1;i>=0;--i)
#define en puts("");
#define elif else if
typedef ll int lli;
typedef sll int slli;
typedef ull int ulli;
const int sz=10000;
using namespace std;

int clue();
int result();
void show();
bool check();


// bool cmp(pair<int,int>p,pair<int,int>q) {
//     return p.first>q.first;//descending by first
//     return p.first<q.first;//ascending by first
//     return p.second>q.second;//descending by second
//     return p.second<q.second;//ascending by second
// }

bool cmp(int p,int q) {
    return p>q;//descending
    // return p<q;//ascending
}

int main() {

    int t;
    // cin>>t;
    t=1;
    while(t-->0) {
        clue();
    }
    return 0;
}
int clue() {

    int a,b;
    cin>>a>>b;
    cout<<a*b<<endl;
    return 0;
}

Measured memory_bytes: 3616
#include<bits/stdc++.h>
//#pragma GCC optimize("O3")
#define endl "\n"
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL)
#define all(x) x.begin(), x.end()
#define pb push_back
#define eb emplace_back

using namespace std;
using ll=long long;
// using ll=int;

const ll mod = (ll)(1e9+7);

typedef pair<ll, ll> ii;
typedef vector<ll> vi;
typedef vector<ii> vii;

int main(){

    /*
    #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("myoutput.txt", "w", stdout);
    #endif
    */

    fast;
    ll t = 1;
    // cin >> t;
    while(t--){
        ll n, r; cin >> n >> r;
        ll inner = 0;
        if(n >=10) inner = r;
        else {
            inner = r + 100*(10-n);
        }
        cout << inner << endl;
        
    }
    // cerr << (double)clock()/CLOCKS_PER_SEC << endl;
    return 0;
}

Measured memory_bytes: 256
s = input()
N = len(s)
t_01 = '01' * (N // 2) + ('0' if N % 2 == 1 else '')
t_10 = '10' * (N // 2) + ('1' if N % 2 == 1 else '')

# print(s)
# print(t_01)
# print(t_10)

s_n = int(s, 2)
t_01_n = int(t_01, 2)
t_10_n = int(t_10, 2)

# print(s_n)
# print(t_01_n)
# print(t_10_n)

ans = N
for x in s_n ^ t_01_n, s_n ^ t_10_n:
    ans = min(ans, bin(x)[2:].count('1'))

print(ans)



Measured memory_bytes: 3572
#include <bits/stdc++.h>
     
    #define REP(i,n) for(ll i=0;i<(ll)(n);++i)
    #define FOR(i,m,n) for(ll i=((ll)(m));i<(ll)(n);++i)
     
    using namespace std;
    typedef long long ll;
     
    int main(){
        ll N;
        cin >> N;

        ll sn = (ll)sqrt(N);
        ll ret = N+2; 
        FOR(i,1,sn+1){
            if(N%i == 0){
                ll x = i;
                ll y = N/i;
                if (ret > x+y-2) ret = x+y-2;
            }
        }

        cout << ret << endl;
    	return 0;
    }

Measured memory_bytes: 256
//header{{{
//#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
//#include<boost/multiprecision/cpp_int.hpp>
//#include<boost/math/common_factor_rt.hpp>
//#include<boost/multiprecision/cpp_dec_float.hpp>
  
using namespace std;
//using namespace boost;
//using namespace multiprecision;  

#define rep(i,n) for(int i=0;i<(n);++i)
#define reps(i,n) for(int i=1;i<=(n);++i)
#define all(x) (x).begin(),(x).end()
#define Fixed fixed << setprecision(12)
#define int int64_t
using pii = pair<int,int>;
constexpr int INF  = 0x3f3f3f3f;
constexpr long long LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int mod1 = 1e9+7; 
constexpr int mod2 = 998244353;

template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }

template <class T> using min_heap = priority_queue<T,vector<T>,greater<T> >;
template <class T> using max_heap = priority_queue<T>;
template <class A, class B> using umap = unordered_map<A,B>;
  
inline int square(int a){ return a * a;}
inline int updiv(int a,int b){ return (a + b - 1) / b; }

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

signed main(){
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);

    string s;
    cin >> s;
    string t = s;

    string a,b;
    for(int i = 0; i < s.size() / 2; ++i){
        a += string(1,s[i]);
    }
    for(int i = (s.size() + 3 / 2) - 1; i < s.size(); ++i){
        b += string(1,s[i]);
    }
    string c,d;
    c = a;
    d = b;
    reverse(all(a));
    reverse(all(b));
    reverse(all(s));

    if(s == t && a == c && b == d){
        cout << "Yes\n";
    }else{
        cout << "No\n";
    }



    return 0;
}


Measured memory_bytes: 256
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

/**
 * 解説通りに作成したソースコード
 * 
 * https://atcoder.jp/contests/abc110/submissions/15896552 にも参考
 */
public class Main {

	public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			char[] s = scanner.next().toCharArray(), t = scanner.next().toCharArray();
			Map<Character, Character> sMap = new HashMap<>(), tMap = new HashMap<>();
			boolean result = true;
			for (int i = 0; i < s.length; i++) {
				if (sMap.containsKey(s[i])) {
					if (sMap.get(s[i]) != t[i]) {
						result = false;
						break;
					}
				} else {
					sMap.put(s[i], t[i]);
				}
				if (tMap.containsKey(t[i])) {
					if (tMap.get(t[i]) != s[i]) {
						result = false;
						break;
					}
				} else {
					tMap.put(t[i], s[i]);
				}
			}
			System.out.println(result ? "Yes" : "No");
		}
	}
}


Measured memory_bytes: 42492
/*#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<map>
#include<cstdio>
#include<stack>
#include<queue>
#include<fstream>
#include<cstdio>
#include<deque>
#include<iomanip>
#include <numeric>*/
#include<bits/stdc++.h>

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

typedef vector<int> vi;
typedef vector<string> vs;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef deque<ll> dll;
typedef pair<ll, ll> P;
const ll mod = 1e9 + 7;
ll dx[4] = {1,0,-1,0};
ll dy[4] = {0,1,0,-1};

int main(){
    ll a,b,c,d,ans = 0;
	cin >> a >> b >> c >> d;
	vll v(101);
	rep(i,101){
		if(a <= i && i < b) v[i]++;
		if(c <= i && i < d) v[i]++;
	}
	rep(i,101){
		if(v[i] == 2) ans++;
		//cout << v[i] << endl;
	}
	cout << ans << endl;
}  


Measured memory_bytes: 256
import java.util.*;

public class Main {
  public static void main(String args[]) {
    Scanner sc = new Scanner(System.in);
    
    int N = sc.nextInt();
    String S = sc.next();
    
    if (N % 2 == 0) {
	  if (S.substring(0, N / 2).equals(S.substring(N / 2, N))) {
        System.out.println("Yes");
        return;
      }
    }
    System.out.println("No");
  }
}

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

using namespace std;
#define inf             0x3f3f3f3f
#define INF             2e18
#define eps             1e-9

#define FastRead        ios_base::sync_with_stdio(0);cin.tie(0)
#define fRead           freopen("input.txt","r",stdin)
#define fWrite          freopen("output.txt","w",stdout)

#define LL              long long
#define ull            unsigned long long
#define PI              acos(-1.0)
#define pb              push_back
#define mk              make_pair
#define pii             pair<int,int>
#define pLL             pair<LL,LL>
#define ff              first
#define ss              second
#define all(a)          a.begin(),a.end()
#define SQR(a)          ((a)*(a))
#define min3(a,b,c)     min(a,min(b,c))
#define max3(a,b,c)     max(a,max(b,c))
#define min4(a,b,c,d)   min(min(a,b),min(c,d))
#define max4(a,b,c,d)   max(max(a,b),max(c,d))
#define max5(a,b,c,d,e) max(max3(a,b,c),max(d,e))
#define min5(a,b,c,d,e) min(min3(a,b,c),min(d,e))
#define vi              vector <int>
#define vL              vector <LL>
#define LB(a,x)         (lower_bound(all(a),x)-a.begin()) //  first element in the range [first,last) which does not compare less than val.
#define UB(a,x)         (upper_bound(all(a),x)-a.begin()) //  first element in the range [first,last) which compares greater than val.
#define prec(n)         fixed << setprecision(n)

#define MEM(a,x)        memset(a,x,sizeof(a))
#define SORT(v)         sort(v.begin(),v.end())
#define REV(v)          reverse(v.begin(),v.end())
#define Unique(a)       sort(all(a)),a.erase(unique(all(a)),a.end())

#define FOR(i,a,b)      for(int i=a;i<=b;i++)
#define ROF(i,a,b)      for(int i=a;i>=b;i--)
#define REP(i,b)        for(int i=0;i<b;i++)
#define IT(it,x)	    for(it=x.begin();it!=x.end();it++)
int main()
{
    LL n,m;
    cin>>n>>m;
    LL s=0;
    LL a[n];
    for(LL i=0; i<n; i++)
    {

        cin>>a[i];
        s+=a[i];
    }
    LL x=(s+4*m-1)/(4*m);
    LL cnt=0;
    for(LL i=0; i<n; i++)
    {
        if(x>a[i])
        {


        }
        else

    cnt++;
    }
    if(cnt>=m)
    cout<<"Yes";
    else

        cout<<"No";
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
  int n,q,h,t,sum=0;
  pair<string,int> a[200000];
  cin>>n>>q;
  for(int i=0;i<n;i++)cin>>a[i].first>>a[i].second;
  h=0;
  t=n-1;
  while(1){
    if(h==t){
      cout<<a[h].first<<' '<<sum+a[h].second<<endl;
      break;
    }
    if(a[h].second-q<=0){
      sum+=a[h].second;
      cout<<a[h].first<<' '<<sum<<endl;
      h++;
    }
      else{
	a[h].second-=q;
	sum+=q;
	if(t+1==200000)t=-1;
	a[++t].first=a[h].first;
	a[t].second=a[h++].second;
	if(h+1==200000)h=0;
      }
  }
  return 0;
}



Measured memory_bytes: 8468
#include<bits/stdc++.h>
using namespace std;
long long a,b,c,d,e,n;
int main(){
    ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
    cin>>n>>a>>b;
    if(a==0){
        cout<<0;
        return 0;
    }
    if(b==0){
        cout<<n;
        return 0;
    }
    c=n/(a+b)*a+min(n%(a+b),a);
    cout<<c;
    return 0;
}

Measured memory_bytes: 256
x,k,d=map(int,input().split())
x=abs(x)
ans=0
if x>k*d:
    ans=x-(k*d)
else:
    if k%2==(x//d)%2:
        ans=x%d
    else:
        ans=min(abs(x%d-d),abs(x%d+d))
print(ans)

Measured memory_bytes: 9200
use std::vec::Vec;

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>().split_whitespace().map(|e| e.parse().ok().unwrap()).collect()
}

fn read_touple<T: std::str::FromStr + Copy>() -> (T, T) {
  let v: Vec<T> = read_vec();
  assert_eq!(v.len(), 2);
  (v[0], v[1])
}

fn main() {
    let n: usize = read();
    let mut ans = "No";

    for i in 1..10 {
      if n % i == 0 && (n/i)/10 == 0 {
         ans = "Yes";
         break
      }
    }

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


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

int main (){
  int A,B,C,D,Left,Right;
  cin >> A >> B >> C >> D;
  Left = A + B;
  Right = C + D;

  if (Left > Right){
    cout << "Left" << endl;
  }
  else if (Left == Right){
    cout << "Balanced" << endl;
  }
  else{
    cout << "Right" << endl;
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
using namespace std;
int main(){
  int n;
  vector<int> score[3];
  
  cin >> n;
  for(int i = 0 ; i < n ; i++){
    int a,b,c;
    cin >> a >> b >> c;
    score[0].push_back(a);
    score[1].push_back(b);
    score[2].push_back(c);
  }
  int ans[1001] = {0}; 
  for(int i = 0 ; i < 3 ; i++ ){
  int a[1001] = {0};
    for(int j = 0 ; j < n ; j++ )++a[score[i][j]];
    for(int j = 0 ; j < n ; j++ )if(a[score[i][j]] < 2)ans[j] += score[i][j];
  }
  for(int i = 0 ; i < n ; i++ )cout << ans[i] << endl;
  return 0;
}

Measured memory_bytes: 1232
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace test
{
    class Program
    {
        static void Main(string[] args)
        {
            var S = Console.ReadLine();
            var K = long.Parse(Console.ReadLine());
            var num = 1;
            var idx = 0;
            for(var i = 0; i < S.Length; i++)
            {
                var tmp = int.Parse(S.Substring(i, 1));
                if (tmp != 1)
                {
                    num = tmp;
                    idx = i;
                    break;
                }
            }

            Console.WriteLine(idx > K - 1 ? 1 : num);
        }
    }
}

Measured memory_bytes: 13140
using System;
class Program
{
    static void Main()
    {
        string x = Console.ReadLine();
        int a = int.Parse(x)/3600;
        int b = int.Parse(x) / 60 % 60;
        int c = int.Parse(x) % 60;


        Console.WriteLine(a+":"+b+":"+c);
    }
}


Measured memory_bytes: 15948
n,k=map(int,input().split())
h=list(map(int,input().split()))
dp=[0]*n
rage=range #lol
for i in rage(1,n):
    dp[i]=10**9;
    for j in range(1,k+1):
        if i-j<0:
            break;
        dp[i]=min(dp[i],dp[i-j]+abs(h[i]-h[i-j]))
print(dp[-1])


Measured memory_bytes: 84736
#include <iostream>
#include <algorithm>
#include <cmath>
#define lli long long int
#define fio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
using namespace std;
lli n,dp[3][100001];
int result (lli *arr,lli *brr,lli *crr,lli i,lli k)
{
    if (k>=n)
    {
        return 0;
    }
    if (dp[i][k]!=-1)
    {
        return dp[i][k];
    }
    if (dp[i][k]==-1)
    {
        lli maxi=0;
        if (i!=0)
        maxi=max(maxi,arr[k]+result(arr,brr,crr,0,k+1));
        if (i!=1)
        maxi=max(maxi,brr[k]+result(arr,brr,crr,1,k+1));
        if (i!=2)
        maxi=max(maxi,crr[k]+result(arr,brr,crr,2,k+1));
        dp[i][k]=maxi;
        return dp[i][k];
    }
}
int main() 
{
    fio;
    cin>>n;
    lli arr[n],brr[n],crr[n];
    for (int i=0;i<n;i++)
    cin>>arr[i]>>brr[i]>>crr[i];
    for (int i=0;i<3;i++)
    {
        for (int j=0;j<100001;j++)
        dp[i][j]=-1;
    }
    lli maxi=0;
    maxi=max(maxi,arr[0]+result(arr,brr,crr,0,1));
    maxi=max(maxi,brr[0]+result(arr,brr,crr,1,1));
    maxi=max(maxi,crr[0]+result(arr,brr,crr,2,1));
    cout<<maxi;
	return 0;
}

Measured memory_bytes: 14336
#pragma gcc optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(V) (V).begin(),(V).end()
#define SORT(V) sort(ALL(V)) //小さい方からソート
#define REV(V) reverse(ALL(V)) //リバース
#define RSORT(V) SORT(V);REV(V) //大きい方からソート
#define NPN(V) next_permutation(ALL(V)) //順列
#define pb(n) push_back(n)
#define endl '\n'
#define Endl '\n'
#define DUMP(x)  cout << #x << " = " << (x) << endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define yes(n) cout << ((n) ? "yes" : "no"  ) << endl
#define Yay(n) cout << ((n) ? "Yay!": ":(") << endl
#define RAPID cin.tie(0);ios::sync_with_stdio(false)
#define VSUM(V) accumulate(ALL(V), 0)
#define MID(a,b,c) (a) < (b) && (b) < (c)
#define MIDe(a,b,c) (a) <= (b) && (b) <= (c)
#define IN(n) cin >> n
#define IN2(a,b) cin >> a >> b
#define IN3(a,b,c) cin >> a >> b >> c 
#define IN4(a,b,c,d) cin >> a >> b >> c >> d
#define VIN(V) for(int i = 0; i < (V).size(); i++) {cin >> (V).at(i);}
#define OUT(n) cout << n << endl
#define VOUT(V) REP(i, (V).size()) {cout << (V)[i] << endl;}
#define VOUT2(V) REP(i, (V).size()) {cout << (V)[i] << " ";} cout<<endl;
#define FIX cout << fixed << setprecision(15)

// 型マクロ定義
#define int long long
#define P pair<ll,ll>
#define Vi vector<ll>
#define VVi vector<vector<ll>>
#define Vd vector<double>
#define Vb vector<bool>
#define Vs vector<string>
#define Vc vector<char>
#define M map<ll,ll>
#define S set<ll>
#define PQ priority_queue<ll>
#define PQG priority_queue<ll,V,greater<ll>
//

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

using ll = long long;
using Graph = vector<vector<int>>;

const int MOD = 1000000007;
const int INF = 1061109567;
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

int gcd(int a,int b){return b != 0 ? gcd(b, a % b) : a;} //最大公約数
int lcm(int a, int b){return a * b / gcd(a, b);}
string toStrUp(string str){char diff = 'A'-'a';REP(i,str.size()) str[i] += diff;return str;}
string gCh(string str, int key){return str.substr(key,1);}

signed main() {
  RAPID;
  // デフォルト変数定義
  int n=0,m=0,a=0,b=0,c=0,d=0,x=0,y=0,z=0;
  string s="",t="";
  //

  // ここから
  IN(x);
  int i = 1;
  while(x > 0){
    x -= i;
    i++;
  }
  OUT(--i);
}

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

using namespace std;

int main() {
  int N, K;
  cin >> N >> K;
  int answer = 0;
  for (int i = 0; i < N; i++) {
    int x;
    cin >> x;
    answer += min(x, abs(K - x)) * 2;
  }
  cout << answer;

  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner stdIn=new Scanner(System.in);
		int c[][]=new int[3][3];
		int z=0,y=0,fin=0,a1=0,a2=0;
		while(z<3){
			while(y<3){
				c[z][y]=stdIn.nextInt();
				y++;
			}y=0;
			z++;
		}z=1;
		a1=c[0][0]-c[0][1];
		a2=c[0][1]-c[0][2];
		while(z<3){
			if(c[z][0]-c[z][1]!=a1){
				fin=1;
				break;
			}
			if(c[z][1]-c[z][2]!=a2){
				fin=1;
				break;
			}
			z++;
		}
		if(fin==1)
			System.out.println("No");
		else
			System.out.println("Yes");
	}

}

Measured memory_bytes: 22736
//khodaya khodet komak kon
#include <bits/stdc++.h>

#define F first
#define S second
#define pb push_back
#define all(x) x.begin(), x.end()
#pragma GCC optimise ("ofast")
#pragma GCC optimise("unroll-loops")

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;

const int N = 100 + 10;
const ll MOD = 1000000000 + 7;
const ll INF = 1000000000000000000;
const ll LOG = 25;

int n, m,dp[N][N], a[N][N];

int OK(int x, int y){
	if (x != y && y == 1) return 1;
	return 0;
}

int32_t main(){
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	cin >> n >> m;
	for (int i = 1; i <= n; i++) for (int j = 1; j <= m; j++){
		char c;
		cin >> c;
		if (c == '.') a[i][j] = 0;
		else a[i][j] = 1;
	}
	memset(dp, 31, sizeof dp);
	if (a[1][1] == 1) dp[1][1] = 1;
	else dp[1][1] = 0;
  	//cout << OK(a[2][2], a[2][3]) << '\n';
	for (int i = 1; i <= n; i++){
		for (int j = 1; j <= m; j++){
			if (i * j == 1) continue;
			if (i != 1 && j != 1) dp[i][j] = min(dp[i - 1][j] + OK(a[i - 1][j], a[i][j]), dp[i][j - 1] + OK(a[i][j - 1], a[i][j]));
			else if (i == 1) dp[i][j] = dp[i][j - 1] + OK(a[i][j - 1], a[i][j]);
			else dp[i][j] = dp[i - 1][j] + OK(a[i - 1][j], a[i][j]);
			//cout << i << ' ' << j << ' ' << dp[i][j] << '\n';
		}
	}
	cout << dp[n][m];









	return 0;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define ll long long
#define vll vector<ll>
#define nloop(i,n) for(int i=0;i<n;i++)
#define loop(i,a,b) for(int i=a;i<=b;i++)
#define rloop(i,a,b) for(int i=a;i>=b;i--)
#define fill(i,n) memset(i,n,sizeof i)
#define all(a) a.begin(),a.end()
#define pb(x) push_back(x)
#define sz() size()
#define T(n) while(n--)
#define pll pair<ll,ll>
#define mp(x,y) make_pair(x,y)
#define fi first
#define se second
#define endl '\n'
#define nfs  ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
ll bin_expo(ll a, ll b, ll m){ll res = 1LL;while (b > 0){if(b % 2 == 1){res = (res * a) % m;}a = (a * a) % m; b = b/ 2;}return res;}

const  int MAXn= 3e5+5;
const  long long INF= 1e18;

int main(){
    int t=1;
    //cin>>t;
    T(t){
        ll n;
				cin>>n;
				vll v(n,0);
				bool flag=true;
				nloop(i,n) cin>>v[i];
				loop(i,1,n-1){
					if(v[i]<v[i-1]){
						if(abs(v[i]-v[i-1])==1) v[i]++;
						else {
							flag=false;
							break;
						}
						
					}
				}
				if(flag)cout<<"Yes";
				else cout<<"No";
    }
}

Measured memory_bytes: 1024
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int size = 0, time = 0, minij, b = 0;
        size = sc.nextInt();
        int[] a = new int[size];
        for (int i = 0; i < size; i++) {
            a[i] = sc.nextInt();
        }
        for (int v = 0; v < size; v++) {
            minij = v;
            for (int w = v; w < size; w++) {
                if (a[w] < a[minij]) minij = w;
            }
            if (v != minij) {
                b = a[v];
                a[v] = a[minij];
                a[minij] = b;
                time++;
            }
        }

        for (int k = 0; k < size; k++) {
            System.out.print(a[k]);
            if (k != (size - 1)) System.out.print(" ");
        }
        System.out.print("\n");
        System.out.println(time);


    }
}



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

public class Main {
	static long d = (long)Math.pow(2, 31) - 1;
	static long[]node;
	static int N;
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int q = scan.nextInt();
		N = 1;
		while(N < n) {
			N = N * 2;
		}
		node = new long[2 * N - 1];
		Arrays.fill(node, d);

		for(int i = 0; i < q; i++) {
			int com = scan.nextInt();
			if(com == 0) {
				int x = scan.nextInt();
				int y = scan.nextInt();
				update(x, y);
			}else {
				int x = scan.nextInt();
				int y = scan.nextInt();
				long k = getMin(x, y + 1, 0, 0, N);
				System.out.println(k);
			}
		}
		scan.close();
	}
	static void update(int k, int a) {
		k += N - 1;
		node[k] = a;
		while(k > 0) {
			k = (k - 1) / 2;
			node[k] = Math.min(node[2 * k + 1], node[2 * k + 2]);
		}
	}
	static long getMin(int a, int b, int k, int l, int r) {
		if(r <= a || b <= l) {
			return d;
		}
		if(a <= l && r <= b) {
			return node[k];
		}else {
			long vl = getMin(a, b, 2 * k + 1, l, (l + r) / 2);
			long vr = getMin(a, b, 2 * k + 2, (l + r) / 2, r);
			return Math.min(vl, vr);
		}
	}
}


Measured memory_bytes: 107136
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000


int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N; cin >> N;
    int A[N];
    rep(i, N) cin >> A[i];
    int sum = abs(0 - A[0]) + abs(A[N-1] - 0);
    rep(i, N-1) sum += abs(A[i] - A[i+1]);
    cout << sum - abs(0 - A[0]) - abs(A[0] - A[1]) + abs(0 - A[1]) << endl;
    rep(i, N-2) {
        cout << sum - abs(A[i] - A[i+1]) - abs(A[i+1] - A[i+2]) + abs(A[i] - A[i+2]) << endl;
    }
    cout << sum - abs(A[N-2] - A[N-1]) - abs(A[N-1] - 0) + abs(A[N-2] - 0) << endl;

    return 0;
}


Measured memory_bytes: 1664
#include <iostream>
#include <list>
#include <cstdint>
#include <string>
#include <algorithm>
 
typedef std::list<std::uint64_t> DType;
 
int main() {
    DType D;
    std::uint64_t N;
    std::uint64_t C;
    std::string S;
    std::cin >> C;
 
    for (std::size_t i = 0; i < C; i++) {
        if (!(std::cin >> S)) break;
        if (S[0] == 'i' ||S[0] == 'I') {//insert
            std::cin >> N;        
            D.insert(D.begin(),N);
            continue;
        }
        if (S.size() == 6) {//delete
            std::cin >> N;    
            auto it=std::find(D.begin(), D.end(), N);
            if(it!= D.end())D.erase(it);
            continue;
        }
        if (S.size() == 11) {//deletefirst
            D.pop_front();
            continue;
        }
        if (S.size() == 10) {//deletelast
            D.pop_back();
            continue;
        }
    }
 
    for (auto it = D.begin(); it != D.end(); it++) {
        if(it!=D.begin())std::cout << ' ';
 
        std::cout << *it;
    }
 
    std::cout<<std::endl;
 
    return 0;
}

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

int main() {
    int a,b,ans=0;
    cin>>a>>b;

    if (a > 2*b) ans = a-2*b;

    cout<<ans<<endl;
}


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

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int a,b; cin>>a>>b;
  if(a==1){
    if(b==2)cout<<3<<endl;
    if(b==3)cout<<2<<endl;
  }else if(a==2){
    if(b==1)cout<<3<<endl;
    if(b==3)cout<<1<<endl;
  }else{
    if(b==1)cout<<2<<endl;
    if(b==2)cout<<1<<endl;
  }
}


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

int main() {
    int r, d, x_def ;
    cin >> r >> d >> x_def;

    for ( int i = 0; i < 10; i++ ) {
        cout << r * x_def - d << endl;
        x_def = r * x_def - d;
    }

    return 0;
}

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

typedef unsigned long long int ull;
typedef long double ldb;
typedef long long int ll;

#define MOD1        1000000007
#define MOD2        998244353
#define PI          3.1415926535897932384626433832795
#define FILL(a, value) memset(a, value, sizeof(a))
#define BOOST       ios_base::sync_with_stdio(false); cin.tie(NULL)
#define what_is(x)  cerr << #x << " is " << x << endl;
#define ASSERT(left,operator,right) { if(!((left) operator (right))){ std::cerr << "ASSERT FAILED: " << #left << #operator << #right << " @ " << __FILE__ << " (" << __LINE__ << "). " << #left << "=" << (left) << "; " << #right << "=" << (right) << std::endl; } }

#define rep01(k,n)      for (ll i=k; i<n; i++)
#define rep02(k,n)      for (ll j=k; j<n; j++)
#define rep03(k,n)      for (ll k=k; k<n; k++)
#define rep11(k,n)      for (ll i=k; i<=n; i++)
#define rep12(k,n)      for (ll j=k; j<=n; j++)
#define rep13(k,n)      for (ll k=k; k<=n; k++)
#define repIT(c,it)     for(typeof(c.begin()) it = c.begin(); it != c.end(); ++it)
#define all(c)      c.begin(), c.end()

using namespace std;

const double pi = acos(-1.0);
const double epsilon = 1e-9;        // Add epsilon when casting double to int to avoid rounding pitfall issues, eg, 0.94*8178 in int
const int maxn = 1e6+10;


void solve()
{
    ll a, b, c;
    cin >> a >> b >> c;

    unordered_map<ll, ll> mp1, mp2, mp3;
    
    ll ct = 0;
    while(!(a % 2) && !(b % 2) && !(c % 2))
    {
        if(mp1[a] && (mp2[b] == mp3[c] && mp2[b] == mp1[a]))
        {
            cout << "-1";
            return;
        }

        mp1[a] = mp2[b] = mp3[c] = ct++;
        ll ta = b/2 + c/2;
        ll tb = a/2 + c/2;
        ll tc = a/2 + b/2;

        a = ta;
        b = tb;
        c = tc;
    }
    //cout << a << " " << b << " " << c << "\n";
    cout << ct;
}

int main()
{
    int t = 1;
    //cin >> t;
    while(t--)
        solve();

    cerr << "Time elapsed: " << clock() / (double)CLOCKS_PER_SEC << endl;
    return 0;
}

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

int main() {
    int X, Y, A, B, C;
    cin >> X >> Y >> A >> B >> C;

    vector<P> v;
    rep(i, A) {
        int tmp;
        cin >> tmp;
        v.push_back(make_pair(tmp, 0));
    }
    rep(i, B) {
        int tmp;
        cin >> tmp;
        v.push_back(make_pair(tmp, 1));
    }
    rep(i, C) {
        int tmp;
        cin >> tmp;
        v.push_back(make_pair(tmp, 2));
    }

    sort(v.begin(), v.end());
    reverse(v.begin(), v.end());

    ll sum = 0;
    int x = 0;
    int y = 0;
    int count = 0;
    for (int i = 0; count < (X + Y); i++) {
        if (v[i].second == 0) {
            if (x < X) {
                sum += v[i].first;
                x++;
                count++;
            }
        } else if (v[i].second == 1) {
            if (y < Y) {
                sum += v[i].first;
                y++;
                count++;
            }
        } else {
            sum += v[i].first;
            count++;
        }
    }
    cout << sum << endl;

    return 0;
}


Measured memory_bytes: 7472