akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
using namespace std;

int main() {
  int h, w;
  cin >> h >> w;
  vector<string> s(h);

//入力
  for (int i = 0; i < h; i++) {
	cin >> s[i];
  }

//出力
  for (int i = 0; i < h; i++) {
	cout << s[i] << endl << s[i] << endl;
  }
  
  return 0;
}



Measured memory_bytes: 256
iH,iW,iA,iB = [int(x) for x in input().split()]
iD = 10**9+7 #法

#初等整数論勉強して解説通りキッチリ実装したった

#二分累乗法 iDを法として
def fBiPow(iX,iN,iD):
    iY = 1
    while iN > 0:
        if iN % 2 == 0:
            iX = iX * iX % iD
            iN = iN // 2
        else:
            iY = iX * iY % iD
            iN = iN - 1
    return iY

#nCr = n!/r!(n-r)!
#ループ回すだけ版や
def fFr(iX,iR=1):
    if iR == 0 or iX == 0:
        return 1
    else :
        iRet = 1
        for i in range(iR,iX+1):
            iRet *= i
        return iRet

def fnCr(iN,iR):
    if iR == 0:
        return 1
    else:
        return fFr(iN,iR+1) // fFr(iN-iR)

#階乗(iDを法とした)の配列
aM = [1]*(iH+iW-1)
for i in range(1,iH+iW-1):
    aM[i]=aM[i-1]*i %iD
#各階乗のiDを法とした逆元の配列
aInvM = [1]*(iH+iW-1)
aInvM[iH+iW-2] = fBiPow(aM[iH+iW-2],iD-2,iD)
for i in range(iH+iW-2,0,-1):
    aInvM[i-1]=aInvM[i]*i % iD

iRet = 0
for iL in range(0,iH-iA):
    #iRet += (fnCr(iL+iB-1,iL) * fnCr(iW-iB+iH-iL-2,iW-iB-1))%iD
    iRet += (aM[iL+iB-1]*aInvM[iL]*aInvM[iB-1]) % iD * (aM[iW-iB+iH-iL-2]*aInvM[iW-iB-1]*aInvM[iH-iL-1])%iD
    iRet %= iD
iRet %= iD
print(iRet)


Measured memory_bytes: 18804
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <map>
#include <string>
using namespace std;
typedef long long LL;
const LL N = 998244353;

map <string,LL> mp[2];
string u;

LL f(LL id,string s){
//	cout << id << ' ' << s << endl;
	if(mp[id].find(s) != mp[id].end()) return mp[id][s];
	LL ret = 0,len;
	len = s.length();
	if(id){
		for(LL i = 0;i < len;i ++) ret = (ret + f(1,s.substr(0,i)) * f(0,s.substr(i,len))) % N;
		mp[id][s] = ret; return ret;
	}
	else{
		for(LL i = 1;i < len;i ++){
			if(len % i) continue;
			string t = "";
			for(LL j = 0;j < i;j ++) t += '1';
			for(LL j = 0;j < len;j += i){
				for(LL k = 0;k < i;k ++){
					if(s[j + k] == '0') t[k] = '0';
				}
			}
//			cout << t << ',' << f(1,t) << endl;
			ret += f(1,t); ret %= N;
		}
		mp[id][s] = ret; return ret;
	}
}

int main(){
	mp[0][""] = mp[1][""] = 1;
	mp[0]["0"] = 1; mp[0]["1"] = 2;
	mp[1]["0"] = 1; mp[1]["1"] = 2;
	cin >> u;
	cout << f(1,u) << '\n';
	return 0;
}

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

using ui = unsigned int;

int n;
ui temp, mask;
std::vector<ui> given, solution;
std::vector<int> bitCount(32, 0);

int main(){
    std::cin >> n;
    given.resize(n);

    for(int i = 0;i < n;++i){
        scanf("%u", &temp);
        given[i] = temp;
    }

    for(int b = 0;b < 32;++b){
        mask = (ui)1 << b;
        for(int i = 0;i < given.size();++i){
            bitCount[b] += !!(given[i] & mask);
        }
    }

    for(int i = 0;i < given.size();++i){
        temp = 0;
        for(int b = 0;b < 32;++b){
            mask = (ui)1 << b;
            temp |= ((bitCount[b] - !!(mask & given[i])) & 0x1) << b;
        }
        solution.push_back(temp);
    }

    for(auto& it : solution){
        std::cout << it << " ";
    }
    std::cout << std::endl;
    
    return 0;
}

Measured memory_bytes: 5200
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<stack>
#include<string>
#include<map>
#include<set>
#include<tuple>
#include<cmath>
#include<iomanip>


using namespace std;
typedef long long ll;
typedef vector<ll> v;
typedef vector<vector<ll>> vv;


#define MOD 1000000007
#define INF 1001001001
#define MIN -1001001001
#define rep(i,k,N) for(int i=k;i<N;i++)
#define MP make_pair
#define MT make_tuple //tie,make_tuple は別物
#define PB push_back
#define PF push_front
#define all(x) (x).begin(),(x).end()


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

void YN(bool ans){
    if(ans)cout<<"Yes"<<endl;
    else cout <<"No"<<endl;
    return;
}
int main(){
    ll A,B,C,K;
    cin>>A>>B>>C>>K;
    ll ans = 0;
    if(A<K){
        ans += A;
        K-=A;
    }
    else{
        ans = K;
        K=0;
    }
    if(B<K){
        K-=B;
    }
    else{K=0;}
    ans-=K;
    cout<<ans;
    return 0;
}

Measured memory_bytes: 3636
/* ---------- STL Libraries ---------- */
// IO library
#include <cstdio>
#include <fstream>
#include <iomanip>
#include <ios>
#include <iostream>

// algorithm library
#include <algorithm>
#include <cmath>
#include <numeric>
#include <random>
#include <cstring>

// container library
#include <array>
#include <bitset>
#include <deque>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <string>
#include <tuple>
#include <vector>
#include <stack>

/* ---------- Namespace ---------- */
using namespace std;

/* ---------- Type ---------- */
using ll = long long;
#define int ll
#define P pair<ll, ll>

/* ---------- Constants  */
const double PI = 3.141592653589793238462643383279;
const ll MOD = 1e9 + 7;
const int INF = 1LL << 55;

/* v-v-v-v-v-v-v-v-v Main Part v-v-v-v-v-v-v-v-v */
signed main() {
    int N;
    cin >> N;
    vector<P> C(N);
    for (int i = 0; i < N; i++) {
        int a, b;
        cin >> a >> b;
        C[i] = P(b, a);
    }
    sort(C.begin(), C.end());

    int now = 0;
    for (P work : C) {
        now += work.second;
        if (now > work.first) {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 3328
fun main(args: Array<String>) {
    val n = readLine()!!.toInt()
    val hList =  readLine()!!.split(" ").map(String::toDouble)
    var count = 0
    var maxCount = 0
    for (i in 0 until n-1) {
        if (hList[i] >= hList[i+1]) {
            count += 1
        } else {
            maxCount = Math.max(maxCount, count)
            count = 0
        }
    }
    maxCount = Math.max(maxCount, count)
    println(maxCount)
}

Measured memory_bytes: 64184
require 'matrix'

n = gets.split.map(&:to_i)
a = Matrix.rows(n[0].times.map { gets.split.map(&:to_i) })
b = Matrix.rows(n[1].times.map { gets.split.map(&:to_i) })
(a * b).to_a.each { |v| puts v * ' ' }

Measured memory_bytes: 7436
#include<bits/stdc++.h>
using namespace std;
int main()
{
    string a;
    cin>>a;
    int x=a.length();
    if(a[x-1]=='2' || a[x-1]=='4' || a[x-1]=='5' || a[x-1]=='7' || a[x-1]=='9')
        cout<<"hon"<<endl;
    else if(a[x-1]=='0' || a[x-1]=='1' || a[x-1]=='6' || a[x-1]=='8')
        cout<<"pon"<<endl;
    else
        cout<<"bon"<<endl;

    return 0;
}


Measured memory_bytes: 3600
#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 req(i,n) for(long long i=n-1; i>=0; i--)
#define range(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 onBoard(y,x) (y>=0 && y<h && x>=0 && x<w)
#define pri_que priority_queue
#define vint vector<int>
#define vvint vector<vector<int>>
#define vi vector<int>
#define vvi vector<vector<int>>
#define vs vector<string>
#define vvc vector<vector<char>>
#define vc vector<char>
#define vp vector<pair<int,int>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
#define show(x) cout<<#x<<"="<<x<<endl;
#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/gcd(a,b)*b;}
const long long dx[8]={1,0,-1,0,1,-1,-1,1};
const long long dy[8]={0,1,0,-1,1,1,-1,-1};
const long long INF = 1e15;
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];

    rep(i,n-1){
        if(a[i]<a[i+1]) a[i+1]--;
        if(a[i]>a[i+1]){
            coutn; return 0;
        }
    }
    couty;
}

Measured memory_bytes: 3940
#include <iostream>
#include <vector>
#include <iomanip>
#include <cstring>
#include <string.h>
#include <iterator>
#include <math.h>
#include <set>
#include <queue>
#include <stack>
#include <algorithm>
#include <tuple>
#include <limits.h>
#include <string>
#include <bitset>
#include <map>
#include <numeric>
#include<unordered_map>


#define endl cout<<"\n"
#define lli long long int
#define ld long double
#define M_PI (3.14159265358979323846264338327950288)
#define MOD (10e9 + 7)

using namespace std;

//fast-exponentiation-lli
unsigned lli expo_fast(lli a, lli b) {
	a = a;
	lli result = 1;
	while (b) {
		//multiplyint(tos(result), a);
		if (b & 1)result = (result * a);
		b >>= 1;
		a = (a*a);
	}
	return (result);
}


void take_in(vector<lli> *arr) {
	for (int i = 0; i < arr->size(); i++)cin >> (*(arr))[i];
}


lli gcd(lli a, lli b)
{
	if (b == 0)
		return a;
	return gcd(b, a % b);

}

/* Iterative Function to calculate (x^y)%p in O(log y) */
unsigned lli power(lli x, unsigned lli y, lli p)
{
	lli res = 1;      // Initialize result 
	x = x % p;  // Update x if it is more than or equal to p 
	while (y > 0) {
		// If y is odd, multiply x with result 
		if (y & 1)res = (res*x) % p;
		// y must be even now 
		y = y >> 1;
		x = (x*x) % p;
	}
	return res;
}


int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	int n,w; cin >> n>>w;
	vector<lli>weight(n + 1), val(n + 1);
	for (int i = 1; i <= n; i++)cin >> weight[i] >> val[i];
	vector<vector<lli>> dp(n + 1, vector<lli>(w + 1,0));
	for (int i = 1; i <= n; i++) {
		for (int wt = 0; wt <= w; wt++) {
			dp[i][wt] = (weight[i] > wt) ? dp[i - 1][wt] : max(dp[i - 1][wt], val[i] + dp[i - 1][wt - weight[i]]);
		}
	}
	cout << dp[n][w];
	//system("PAUSE");
}

Measured memory_bytes: 80256
/*
                         ----------------------------
                              Ankur Kumar Singh    
                         ----------------------------
*/


#include <bits/stdc++.h>
using namespace std;
# define ll  long long  int
# define ld  long double
# define pb push_back
# define pp pop_back
# define ff first
# define ss second
# define mp make_pair
# define ac accumulate
# define mod 1000000007
# define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
# define trace1(x)                cerr << #x << ": " << x << "\n";
# define trace2(x, y)             cerr << #x << ": " << x << " | " << #y << ": " << y << "\n";
# define trace3(x, y, z)          cerr << #x << ": " << x << " | " << #y << ": " << y << " | " << #z << ": " << z << "\n";
# define trace4(a, b, c, d)       cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << "\n";

int  main()
{

   IOS;
   ll h,n;
   cin>>h>>n;
   ll sum=0;
   for(ll i=1;i<=n;i++)
   {
      ll x;
      cin>>x;
      sum+=x;
   }
   if(sum<h)
   {
      cout<<"No";

   }
   else
      cout<<"Yes";
   

}


Measured memory_bytes: 256
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

namespace ABC150_B
{
    public class Program
    {
        public static void Main(string[] args)
        {
            new Program().Solve(new ConsoleInput(Console.In, ' '));
        }

        public void Solve(ConsoleInput cin)
        {
            // 解答はココに書く
            var n = cin.ReadInt;
            var s = cin.Read;
            var count = 0;

            for (int i = 0; i < n - 2; i++)
            {
                if (s[i] == 'A' && s[i + 1] == 'B' && s[i + 2] == 'C') count++;
            }
            Console.Write(count);
        }
    }

    public class ConsoleInput
    {
        private readonly System.IO.TextReader _stream;
        private char _separator = ' ';
        private Queue<string> inputStream;
        public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
        {
            this._separator = separator;
            this._stream = stream;
            inputStream = new Queue<string>();
        }
        public string Read
        {
            get
            {
                if (inputStream.Count != 0) return inputStream.Dequeue();
                string[] tmp = _stream.ReadLine().Split(_separator);
                for (int i = 0; i < tmp.Length; ++i)
                    inputStream.Enqueue(tmp[i]);
                return inputStream.Dequeue();
            }
        }
        public string ReadLine { get { return _stream.ReadLine(); }}
        public int ReadInt { get { return int.Parse(Read); }}
        public long ReadLong { get { return long.Parse(Read); }}
        public double ReadDouble { get { return double.Parse(Read); }}
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret;}
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret;}
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret;}
    }
}

Measured memory_bytes: 11220
import java.util.*;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		
		int N = sc.nextInt();
		int tokuten[] =  new int[N+1];//得点の配列

		for(int i = 0;i<N*(N-1)/2;i++){//Nチームあるときの試合数まで繰り返す
			int a = sc.nextInt();
			int b = sc.nextInt();
			int a1 = sc.nextInt();
		    int b1 = sc.nextInt();
		    
		    if (a1 > b1){//aが勝った場合
		    	tokuten[a] += 3;
		    }else if (a1 < b1){//bが勝った場合
		    tokuten[b] += 3;
		    }else{//同点の場合
		    tokuten[a] += 1;
		    tokuten[b] += 1;
		    }
		}

		for(int i = 1; i < N+1; i++){
			int length = 1;
			for(int j = 0; j < N+1; j++){
				if(tokuten[i] < tokuten[j])
					length += 1;
			}
		    System.out.println(length);
		}
	}
}

Measured memory_bytes: 41988
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <iomanip>
#include <limits>
#include <list>
#include <queue>
#include <tuple>
#include <map>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define INF (int)(1123456789)
#define LINF (long long int)(112345678901234567)
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
#define all(v) v.begin(), v.end()

int main(void){
  int h,w,n;
  cin>>h>>w>>n;
  int sr,sc;
  cin>>sr>>sc;
  sr--;
  sc--;
  string s,t;
  cin>>s;
  cin>>t;

  int dl = -1, dr = w, du = -1, dd = h;
  REP(i,n){
    if(t[i] == 'L'){
      dr = min(w, dr+1);
    }
    if(t[i] == 'R'){
      dl = max(-1, dl-1);
    }
    if(t[i] == 'U'){
      dd = min(h, dd+1);
    }
    if(t[i] == 'D'){
      du = max(-1, du-1);
    }

    if(s[i] == 'L'){
      dl++;
    }
    if(s[i] == 'R'){
      dr--;
    }
    if(s[i] == 'U'){
      du++;
    }
    if(s[i] == 'D'){
      dd--;
    }

    if(dr-dl<=1 || dd-du <= 1){
      cout<<"NO"<<endl;
      return 0;
    }
  }
  if(sc <= dl || sc >= dr || sr <= du || sr >= dd){
    //cout<<sc<<" "<<dl<<" "<<dr<<" "<<sr<<" "<<du<<" "<<dd<<endl;
    cout<<"NO"<<endl;
  }else{
    //cout<<sc<<" "<<dl<<" "<<dr<<" "<<sr<<" "<<du<<" "<<dd<<endl;
    cout<<"YES"<<endl;
  }

  return 0;
}


Measured memory_bytes: 776
#include<algorithm>
#include <iostream>
#include<cstdio>
#include<cmath>
#include<iomanip>
#include<string>
using namespace std;
int main(){
    
    string s;
    cin>>s;
    
    string ans;
    int n,x;
    n=s.length();
    x=(n+1)/2;
    for(int i=0;i<x;i++){
        ans+=s[2*i];
    }
    
    cout<<ans<<endl;
    
   
    return 0;
}








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


typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++);
#define _GLIBCXX_DEBAC
/*map<Keyの型, Valueの型> 変数名;
queue<型> 変数名;
priority_queue<型> 変数名;
priority_queue<型, vector<型>, greater<型>> 変数名;*/

using namespace std;

int gcd(int a, int b) {
	int c;
	if (a < b) {
		c = a; a = b; b = c;
	}
	while (b != 0) {
		c = a % b; a = b; b = c;
	}
	return a;
}

int sort_greater(int m,int n) {
	vector<int> a(m);
	for (int i = 0; i < m; i++) {
		cin >> a[i];
	}
	sort(a.begin(), a.end(),greater<int>());
	for (int i = 0; i < n; i++) {
		cout << a[i];
	}
		return 0;
}

int bubblesort(int a[], int n) {
	int sw = 0;
	bool flag = 1;
	for (int i = 0; flag; i++) {
		flag = 0;
		for (int j = n - 1; j >= i + 1; j--) {
			if (a[j] < a[j - 1]) {
				swap(a[j], a[j - 1]);
				flag = 1;
				sw += 1;
			}
		}
	}
	return sw;
}

int a_z()
{
	for (int i = 0; i <= ('Z' - 'A'); i++) {
		cout << (char)('A' + i);
	}
	return 0;
}

int selecttionsort(int a[], int n) {
	int t,sw = 0, minj;
	for (int i = 0; i < n - 1; i++) {
		minj = i;
		for (int j = 0; j < n - 1; j++) {
			if (a[j] < a[minj]) {
				minj = j;
			}
		}
		t = a[i]; a[i] = a[minj]; a[minj] = t;
		if (i != minj) sw += 1;

	}
	return sw;
}
map<string, int> memo;


int main() {
	//sort(a.begin(),a.end());
	int a, b,ans=0;
	cin >> a >> b;
	while (ans <= 1000) {
		if ((int)(ans * 0.08) == a && (int)(ans * 0.1) == b) {
			cout << ans;
			return 0;
		}
		ans += 1;
	}
	cout << -1;
	return 0;
}









Measured memory_bytes: 256
# E - Three Substrings

a = list(input())
b = list(input())
c = list(input())

A, B, C = len(a), len(b), len(c)

M = max(A, B, C)
cons = 6*M
a_not_match_b = [False] * 2 * cons
b_not_match_c = [False] * 2 * cons
a_not_match_c = [False] * 2 * cons

def fill_match_list(d1, d2, l):
    for i in range(len(d1)):
        for j in range(len(d2)):
            if d1[i] != d2[j] and d1[i] != "?" and d2[j] != "?":
                l[i-j+cons] = True
    return l

a_not_match_b = fill_match_list(a, b, a_not_match_b)
b_not_match_c = fill_match_list(b, c, b_not_match_c)
a_not_match_c = fill_match_list(a, c, a_not_match_c)

ans = 3*M
for b_idx in range(-2*M, 2*M):
    for c_idx in range(-2*M, 2*M):
        if not a_not_match_b[b_idx + cons] and not a_not_match_c[c_idx + cons] and not b_not_match_c[c_idx - b_idx + cons]:
            ans = min(ans, max(A, B + b_idx, C + c_idx) - min(0, b_idx, c_idx))

print(ans)

Measured memory_bytes: 47796
#include <numeric>
#include<iostream>
#include<set>
#include <bitset>
#include<queue>
#include<vector>
#include<map>
#include<stack>
#include <cstdio>
#include<algorithm>
#include <sstream>
#include<string>
#include<string.h>
#include <cmath>
#include <iomanip>
#include <string>
#include<list>
using namespace std;
#define int long long
#define inf  114514
#define rep(i,j,n) for(int i=j;i<n;i++)
typedef pair<int,int>  P;
double pi = 3.141592653589793;
//使うやつはここから下に置こうな
signed main(){
    int n;cin>>n;
    if(n<1000)cout<<"ABC"<<endl;
    else cout<<"ABD"<<endl;
    return 0;
}

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

int main() {
	int n;
	cin >> n;
	string ss;
	map<string,int> s;
	int mx = -1;
	for(int i = 0;i < n;i++)
	{
		cin >> ss;
		s[ss]++;
		mx = max(mx,s[ss]);
	}
	for(auto i = s.begin();i != s.end();++i)
	{
		if(i->second == mx)
		{
			cout << i->first << endl;
		}
	}
	return 0;
}


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

int main() {
  int N;
  cin >> N;
  vector<int> h(N);
  for(int i = 0;i<N;i++){
    cin >> h[i];
  }
  int res = 0;
  while(*max_element(h.begin(),h.end()) >0){//hの全要素が0になるまでやる
    for(int i = 0;i<N;i++){
      if(h[i] != 0){
        res++;
        while(i<N){
          if(h[i] != 0){
            h[i]--;
            i++;
          }
          if(h[i] == 0) break;
        }
      }
    }
  }
  cout << res << endl;
}
      

Measured memory_bytes: 256
// Kab khoon khaulega re tera?

#include<bits/stdc++.h>
#define ll long long
#define F first
#define S second
using namespace std;

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif

const int N = 3e5 + 5;
ll a[N];
int main()
{
    ios_base ::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
    ll x;
    cin >> x;
    string y;
    cin >> y;
    ll yy = 0;
    int pos = 0;
    for(int i = 0; i < (int)y.size(); i++){
        if(y[i] == '.'){
            continue;
        }
        yy *= 10;
        yy += (y[i] - '0');
    }
    ll ans = x * yy;
    ans /= 100;
    cout << ans;
return 0;
}


Measured memory_bytes: 3652
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <vector>
#include <set>
#include <queue>
#include <unordered_map>
#include <string>

#define rep(i, a, b) for ( int i = (a); i < (b); i++ )
#define per(i, a, b) for ( int i = (b)-1; i >= (a); i--)
#define pb push_back
#define mp make_pair
#define bg begin()
#define en end()


using namespace std;

typedef long long ll;

static const long long MOD = 1000000007;


int N;
ll A[200005], ans;

int main(void) {
  cin >> N;
  rep(i,0,N) scanf("%lld", &A[i]);
  int s = 0, t = 0;
  ll S = 0, X = 0;
  while(s<N) {
    while(t<N&&((S+A[t])==(X^A[t]))) {
      S += A[t];
      X ^= A[t];
      t++;
    }
    ans += t-s;
    S -= A[s];
    X ^= A[s];
    s++;
  }
  
  printf("%lld\n", ans);
  
	return 0;
}


Measured memory_bytes: 1792
a, b, c, k = map(int, input().split())
if (k % 2 == 1):
	tmp = a
	a = b
	b = tmp
c = c*k
a = a+c
b = b+c
if (abs(a - b) > 10**18):
	print("Unfair")
else:
	print(a-b)

Measured memory_bytes: 3060
def multMat(x, y)
  ret = Array.new();
  
  x.length.times do |i|
    arr = Array.new();
    y[0].length.times do |j|
      s = 0
      y.length.times do |k|
        s += x[i][k]*y[k][j]
      end
      arr << s
    end
    ret << arr
  end

  return ret
end

n, m, l = gets.split.map(&:to_i)
a = Array.new;
b = Array.new;

n.times do |i|
  a << gets.split.map(&:to_i)
end

m.times do |i|
  b << gets.split.map(&:to_i)
end

c = multMat(a,b)

n.times do |i|
  l.times do |j|
    print c[i][j], (j==l-1?"\n":" ")
  end
end

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

int main() {
	int N;
	cin >> N;
	int* s = new int[N];
	int sum = 0;
	for (int i = 0; i < N; i++)
	{
		int temp;
		cin >> temp;
		s[i] = temp;
		sum += temp;

	}
	sort(s, s + N);
	if (sum % 10 != 0)
	{
		cout << sum << endl;
	}
	else
	{
		bool in = false;
		for (int i = 0; i < N; i++)
		{
			if (s[i] % 10 != 0)
			{
				sum -= s[i];
				in = true;
				break;
			}
		}
		if (in == false)
		{
			cout << 0 << endl;
		}
		else
		{
			cout << sum << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 504
#include<stdio.h>
#include<stdlib.h>
typedef long long int ll;
ll myabs(ll x){return x<0?-x:x;}
int main(){
    static ll n,k,h[200000];

    scanf("%lld %lld",&n,&k);
    for(int i=0;i<n;i++){
        scanf("%lld",&h[i]);
    }

    static ll dp[200000]={};
    ll x;
    ll min=999999999;
    dp[1]=myabs(h[1]-h[0]);
    for(int i=2;i<n;i++){
        min=999999999;
        for(int j=i-1,cnt=0;j>=0&&cnt<k;j--,cnt++){
            x=dp[j]+myabs(h[i]-h[j]);
            if(min>x){
                min=x;
            }
        }
        dp[i]=min;
        //printf("dp[%d]==%lld\n",i,dp[i]);
    }

    printf("%lld\n",dp[n-1]);

    return 0;
}

Measured memory_bytes: 1792
#include <stdio.h>
#include <stdlib.h>
#include <math.h>

int main(void) {

	int a, b;
	scanf("%c %c", &a, &b);
	if (a < b) printf("<\n");
	else if (a == b) printf("=\n");
	else printf(">\n");

	return 0;
}

Measured memory_bytes: 128
// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_11_A
// Graph I - Breadth First Search

#define SUBMIT

#include <utility>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <vector>
#include <stack>
#include <limits>
#include <numeric>
#include <functional>
#include <set>
#include <cmath>
#include <cstring>
#include <climits>
#include <memory>
#include <queue>

using namespace std;
using ui64 = unsigned long long;
using i64 = long long;

const ui64 MAX_N = 100;

enum class color_type {
    white,
    gray
};

const int NIL = -1;

int adj[MAX_N][MAX_N];
color_type color[MAX_N];
int dist[MAX_N];
int n;
queue<int> q;

void bfs(int u) {
    q.push(u);

    while (!q.empty()) {
        u = q.front();
        q.pop();

        for (int v = 0; v < n; ++v) {
            if (adj[u][v] == 1 && color[v] == color_type::white) {
                q.push(v);
                color[v] = color_type::gray;
                dist[v] = dist[u] + 1;
            }
        }
    }
}

void start_bfs() {
    while (!q.empty()) q.pop();

    dist[0] = 0;
    color[0] = color_type::gray;
    bfs(0);
}

int main() {
    memset(adj, 0, sizeof(adj));
    memset(dist, NIL, sizeof(dist));
    cin >> n;

    int u, degree;
    for (int i = 0; i < n; ++i) {
        cin >> u >> degree;
        u--; // 0-origin

        int v;
        for (int j = 0; j < degree; ++j) {
            cin >> v;
            v--; //0-origin
            adj[u][v] = 1;
        }
    }

    start_bfs();
    for (int v = 0; v < n; ++v) cout << v + 1 << " " << dist[v] << endl;
    return 0;
}


Measured memory_bytes: 3156
#include <stdio.h>
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
#include <functional>
#include <map>
#include <iomanip>
#include <math.h> 

using namespace std;

int main() {
	map<int, int>mp;
	int num1, num2 ,num3;

	cin >> num1;
	mp[num1]++;
	cin >> num2;
	mp[num2]++;

	cin >> num3;
	mp[num3]++;

	if (mp[num1] == 1) {
		cout << num1 << endl;
	}else if (mp[num2] == 1) {
		cout << num2 << endl;
	}else if (mp[num3] == 1) {
		cout << num3 << endl;
	}





	return 0;
}

Measured memory_bytes: 256
import Control.Applicative ((<$>))
import Control.Monad (unless)
import Data.ByteString.Char8 (ByteString)
import qualified Data.ByteString.Char8 as B

import Data.List (unfoldr)
import Data.List (foldl')
import Data.Bool (bool)

import Data.Char (isSpace)

import Data.IntMap (IntMap)
import qualified Data.IntMap as IM

main :: IO ()
main = do
  n <- readLn
  unless (n == 0) $ do
    solve n <$> readil B.readInt <$> B.getLine >>= putStrLn
    main

solve :: Int -> [Int] -> String
solve n xs = bool "NO COLOR" (show k) $ v > (n `div` 2)
  where mp = foldl' (\m x -> IM.insertWith (+) x 1 m) IM.empty xs
        (k,v) = IM.foldlWithKey (\(k', v') k v -> if v' < v then (k, v) else (k', v')) (0,0) mp

readil :: Integral a =>  (ByteString -> Maybe (a, ByteString)) -> ByteString -> [a]
readil f = unfoldr g
  where g s = do
          (n, s') <- f s
          return (n, B.dropWhile isSpace s')



Measured memory_bytes: 206688
N = int(input())

A_ary = []
for _ in range(N):
  A = int(input())
  ans_ary = []
  for _ in range(A):
    x, y = map(int, input().split())
    ans_ary.append([x, y])
  A_ary.append(ans_ary)

counts = []
for n in range(2 ** N):
  
  contExists = False
  for i, a in enumerate(A_ary):
    if not((n >> i) & 1):
      continue
    for xy in a:
      shift_num = xy[0] - 1
      if (((n >> shift_num) & 1) != xy[1]):
        contExists = True
        break

    if (contExists == True):
      break
  
  if (contExists == True):
    continue
  else:
    counts.append(bin(n).count("1"))

print(max(counts))


Measured memory_bytes: 3444
function Main(input){
  
  var str = input.trim();
    var h = str.split(" ");
  var n = h[0];
  var k = h[1];

  var kekka = 0;
  
  var kekka = n-k+1;
  
  console.log(kekka);
 
}//function end
 
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 22080
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0;i<n;i++)
#define rep2(i,a,n) for(int i=a;i<n;i++)
#define been(ix) (ix).begin(),(ix).end()
using namespace std;
typedef long long ll; 
typedef vector<int> vi;
typedef vector<long long> vl;
const ll INFL = 1e18;
const int INF = 1001001001; 
typedef pair<int,int> P;
#define foreach(ix,i) for(auto& (ix) : (i))
typedef long double ld;
const int mod =1000000007;
const double PI = acos(-1);

int main(){
	int n;cin>>n;
	string s;cin>>s;
	vi me(26,1);
	rep(i,n){
		me[s[i]-'a']++;
	}
	ll ans =1;
	rep(i,26){
		ans*=max(1,me[i]);
		ans%=mod;
	}
	cout<<ans-1<<endl;
}

Measured memory_bytes: 512
#include<cstdio>
#include<map>
using namespace std;

int n, p, mod[200000];
char s[200001];
map<int, long> ma;

int main() {
    scanf("%d %d", &n, &p);
    scanf("%s", s);
    mod[0] = 1;
    long ans = 0;
    for (int i = 1; i < n; i++) mod[i] = mod[i - 1] * 10 % p;
    for (int i = n - 1, j = 1, sum = 0; i >= 0; i--) {
        sum = (sum + (s[i] - '0') * mod[n - 1 - i]) % p;
        if (sum % p == 0) ans++;
        if (ma.find(sum % p) != ma.end()) ans += ma[sum % p];
        ma[sum % p] += 1;
    }
    if (p == 2 || p == 5) {
        for (int i = 0; i < n - 1; i++) {
            if ((s[i] - '0') % p != 0) {
                ans -= i + 1; 
            }
        }
    }
    printf("%ld\n", ans);
    return 0;
}


Measured memory_bytes: 1792
//  Copyright © 2020 Diego Garcia Rodriguez del Campo. All rights reserved.
#include<bits/stdc++.h>
#define MAX 3005
#define optimiza_io cin.tie(0); ios_base::sync_with_stdio(0);
#define what_is(x) cerr << #x << " is " << x << endl;
#define pii pair < ll , ll >
#define fi first
#define se second
using namespace std;
typedef long long ll;

ll a[MAX], N, S, ans;
ll memo[MAX][MAX];
const ll MOD = 998244353;

ll dp(ll x, ll sm){
    if(x > N){
        if(sm != S)
            return 0;
        return 1;
    }
    if(sm > S)
        return 0;
    if(memo[x][sm] != -1)
        return memo[x][sm];
        
    ll ans = 0;
    ans += dp(x + 1, sm + a[x]);
    ans += dp(x + 1, sm) * 2;
    ans %= MOD;
    return memo[x][sm] = ans;
}

int main()
{
    optimiza_io
    cin >> N >> S;
    for(ll i = 1; i <= N; i ++)
        cin >> a[i];
    memset(memo, -1, sizeof memo);
    cout << dp(1, 0) << "\n";
    return 0;
}

// CHECAR LIMITES 

Measured memory_bytes: 74348
//
//  AT3874 [ABC086B] 1 21.cpp
//  Algorithm
//
//  Created by SkyGao on 2020/2/13.
//  Copyright © 2020 skygao. All rights reserved.
//

#include <stdio.h>
#include <cstdlib>
#include <cstring>
#include <string>
#include <iostream>
#include <algorithm>
#include <cmath>
using namespace std;
int main()
{
    int a,b,k=1000;
    scanf("%d%d",&a,&b);
    if(b/10==0)
        k=10;
    else if(b/100==0)
        k=100;
    a=a*k+b;
    int tmp=sqrt(a);
    if(tmp*tmp!=a)
        printf("No");
    else
        printf("Yes");
    return 0;
}


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

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

	int little = 0, big = 0;
	bool bit = false;

	for(auto&& c : s) {
		if(c - '0' != bit) {
			little++;
		}
		bit = !bit;
	}

	bit = true;
	for(auto&& c : s) {
		if(c - '0' != bit) {
			big++;
		}
		bit = !bit;
	}

	cout << min(little, big) << endl;

	return 0;
}


Measured memory_bytes: 512
sa = str(input())
sb = str(input())
sc = str(input())

ia = 0
ib = 0
ic = 0

turn = "a"
winner = ""
while True:
    if turn == "a":
        if ia >= len(sa):
            winner = "A"
            break
        turn = sa[ia]
        ia += 1
    elif turn == "b":
        if ib >= len(sb):
            winner = "B"
            break
        turn = sb[ib]
        ib += 1
    else:
        if ic >= len(sc):
            winner = "C"
            break
        turn = sc[ic]
        ic += 1
print(winner)

Measured memory_bytes: 3064
#include "bits/stdc++.h"
using namespace std;

#define ASC(vec) vec.begin(), vec.end()		// 昇順ソート 例：sort(ASC(vec));
#define DESC(vec) vec.rbegin(), vec.rend()	// 降順ソート 例:sort(DESC(vec));
#define rep(i, n) for(int i = 0; i < (n); i++)
#define Rep(i, n) for(int i = 1; i < n; i++)
#define REP(i, vec) for(auto i = vec.begin(); i != vec.end(); ++i)

const int mod = 1000000007;
const int inf = (1 << 21);
const long long INF = 1LL << 60;

using ii = pair<int, int>;
using ll = long long;
using vi = vector<int>;
using vd = vector<double>;
using vb = vector<bool>;
using vl = vector<ll>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;
using vvb = vector<vector<bool>>;
using vii = vector<pair<int, int>>;
using vll = vector<pair<ll, 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; }
template<class T> inline T GCD(T a, T b) { return b ? GCD(b, a % b) : a; }
template<class T> inline T LCM(T a, T b) { return (a + (b - 1)) / b; }

int round_int(int a, int b) { return (a + (b - 1)) / b; }

constexpr array<int, 9> dx = { 0, 1, 0, -1, -1, 1, 1, -1, 0 };
constexpr array<int, 9> dy = { 1, 0, -1, 0, 1, 1, -1, -1, 0 };

// ──────────────────────────────────────────────────────────────────

int main() {
	list<char> a;
	string s;
	cin >> s;

	rep(i, s.size()) {
		a.push_back(s[i]);
	}

	int q;
	cin >> q;
	int cnt = 0;
	rep(i, q) {
		int p;
		cin >> p;

		if (p == 1) cnt++;
		else {
			int f;
			char c;
			cin >> f >> c;
			if (f == 1) {
				if (cnt % 2 == 0) a.push_front(c);
				else a.push_back(c);
			}
			else {
				if (cnt % 2 == 0) a.push_back(c);
				else a.push_front(c);
			}
		}
	}

	if (cnt % 2 == 1) reverse(ASC(a));

	REP(i, a) {
		cout << *i;
	}
	cout << endl;
}

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

void solve(long long N, std::vector<long long> A)
{
    ll ans = 0;
    ll max_ = A[0];
    for (ll i = 1; i < A.size(); i++)
    {
        if (max_ > A[i])
        {
            ans += max_ - A[i];
        }
        max_ = max(A[i], max_);
    }
    cout << ans << endl;
}

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


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

int main() {
    int A,B;
    cin >> A >> B;
    int cnt = 0;

    if (B == 1){
        cout << 0 << endl;
    }

    if (B!= 1){
        if (B-A >= 0){
            cnt++;
            B -= A;
        }

        while (B > 0){
            B -= (A - 1);
            cnt++;
        }
        cout << cnt << endl;
    }
}


Measured memory_bytes: 3648
//お勉強中

//#include<bits/stdc++.h>
#include<cstdio>
#include<algorithm>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define Would
#define you
#define please

const int cm = 1 << 17;
char cn[cm], * ci = cn + cm, ct;
inline char getcha() {
	if (ci - cn == cm) { fread(cn, 1, cm, stdin); ci = cn; }
	return *ci++;
}
inline int getint() {
	int A = 0;
	if (ci - cn + 16 > cm) while ((ct = getcha()) >= '0') A = A * 10 + ct - '0';
	else while ((ct = *ci++) >= '0') A = A * 10 + ct - '0';
	return A;
}

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


	int N = getint();
	int n = 1 << N;
	int dp1[1 << 18], dp2[1 << 18];
	rep(i, n) {
		dp1[i] = getint();
		dp2[i] = 0;
	}

	rep(k, N) {
		for (int i = n - 1; i >= 0; i--) {
			if (i >> k & 1) {
				int j = i & ~(1 << k);
				int k = min(dp1[i], dp1[j]);
				dp1[i] = max(dp1[i], dp1[j]);
				dp2[i] = max(dp2[i], k);
				dp2[i] = max(dp2[i], dp2[j]);
			}
		}
	}

	int saidai = 0;
	rep1(i, n - 1) {
		saidai = max(saidai, dp1[i] + dp2[i]);
		printf("%d\n", saidai);
	}

	Would you please return 0;
}

Measured memory_bytes: 5120
n = int(input())
v = list(map(int,input().split(" ")))
c = list(map(int,input().split(" ")))


i = 0
total = 0

while i < n:
    if v[i] > c[i]:
        total = total + (v[i]-c[i])
    i = i + 1
print(total)
    

Measured memory_bytes: 3060
while True:
    t=[]
    n=int(input())
    if n==0:
        break
    for i in range(n):
        m=int(input())
        t.append(m)
    a=t.count(0)
    if a>0:
        print(a*'*')
    else:
        print('-')
    b=t.count(1)
    if b>0:
        print(b*'*')
    else:
        print('-')
    c=t.count(2)
    if c>0:
        print(c*'*')
    else:
        print('-')
    d=t.count(3)
    if d>0:
        print(d*'*')
    else:
        print('-')  
    e=t.count(4)
    if e>0:
        print(e*'*')
    else:
        print('-')    
    f=t.count(5)
    if f>0:
        print(f*'*')
    else:
        print('-')    
    g=t.count(6)
    if g>0:
         print(g*'*')
    else:
        print('-')    
    h=t.count(7)
    if h>0:
         print(h*'*')
    else:
        print('-')    
    i=t.count(8)
    if i>0:
        print(i*'*')
    else:
        print('-')  
    j=t.count(9)
    if j>0:
        print(j*'*') 
    else:
        print('-') 
    
    


Measured memory_bytes: 5708
def main():
  MOD = int(1e9 + 7)
  n = int(input())
  print((pow(10,n,MOD) - 2*pow(9 , n , MOD)%MOD + pow(8 , n , MOD) + MOD)%MOD)
 
if __name__ == "__main__":
  main()

Measured memory_bytes: 9100
import java.util.*;

class Main{
	public static void main(String args[]){
		Scanner scan = new Scanner(System.in);
		int[] arr = {scan.nextInt(),scan.nextInt(),scan.nextInt()};
		Arrays.sort(arr);
		System.out.println(arr[0] + " " + arr[1] + " " + arr[2]);
	}
}

Measured memory_bytes: 26420
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<cstdlib>
using namespace std;
char a[100001];
char false1[10001],false2[10001];
int main()
{
	int js1=0,js2=1;
	cin>>false1>>false2;
	int na=strlen(false1),nb=strlen(false2);
	for(int sum1=0;sum1<na;++sum1,js1+=2)
		a[js1]=false1[sum1];
	for(int sum2=0;sum2<nb;++sum2,js2+=2)
		a[js2]=false2[sum2];
	int maxx=max(js1,js2);
	for(int i=0;i<=maxx;++i)
		if(a[i]!='\0') cout<<a[i];
	return 0;
}

Measured memory_bytes: 256
N = int(input())
monsters = list(map(int, input().split()))
yusha_power = list(map(int, input().split()))

count = 0
for yusha_index in range(len(yusha_power)):
    beaten = min(yusha_power[yusha_index], monsters[yusha_index])
    yusha_power[yusha_index] -= beaten
    monsters[yusha_index] -= beaten
    count += beaten

    beaten = min(yusha_power[yusha_index], monsters[yusha_index+1])
    yusha_power[yusha_index] -= beaten
    monsters[yusha_index+1] -= beaten
    count += beaten
print(count)

Measured memory_bytes: 19116
#include <bits/stdc++.h>
using namespace std;
#define pr(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
#define all(v) (v).begin(), (v).end()
#define int long long
#define sz(v) (int)(v).size()
#define mod 1000000007 // ((a- b)% mod+ mod)% mod

void solve() {
        string a; cin >> a;
        int n= a.size();
        for (int i= 0; i< n; i++) cout << "x";

}

int32_t main(){
ios::sync_with_stdio(0), cin.tie(NULL), cout.tie(NULL);
        int T= 1;
        //cin >> T;
        while ( T-- ) {
                solve();
        }
return 0;
}


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

int main()
{
    int R;
    cin >> R;
    if (R < 1200)
    {
        cout << "ABC" << endl;
    }
    else if (R < 2800)
    {
        cout << "ARC" << endl;
    }
    else
    {
        cout << "AGC" << endl;
    }
}


Measured memory_bytes: 256
#ifndef LOCAL
#pragma GCC optimize("O3")
#endif
#include "bits/stdc++.h"
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
#define fastio ios_base::sync_with_stdio(false); cin.tie(0) ;
using ll = long long ;
const ll N = 1e5 + 10;
const ll INF = 1e9 + 10 ;
ll n ;
vector<ll> h;
ll dp[N] ;
ll dfs(ll x) {
    if ( x == n - 1 ) return 0 ; 
    if ( x >= n ) return INF ;
    if ( dp[x] != -1 ) return dp[x] ; 
    ll choice1 = abs(h[x + 1] - h[x]) + dfs(x + 1) ;
    ll choice2 = INF ; 
    if ( x + 2 < n )
        choice2 = abs(h[x + 2] - h[x]) + dfs(x + 2);
    ll ans = min(choice1, choice2) ; 
    return dp[x] = ans ; 
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0) ; 
    memset(dp, -1, sizeof dp) ; 
    cin >> n ; 
    h.resize(n) ;
    for(ll i = 0; i < n; i++){
        cin >> h[i] ; 
    }
    cout << dfs(0) << endl;
    return 0 ;
}


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

int f( int n ) {
	return (n & 1) ? (3*n + 1) : (n/2);
}

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

	int s;
	cin >> s;

	map<int, int> m;
	int result = 1;

	for( int i = 1; ; ++i ) {
		m[s] += 1;

		if( m[s] == 2 ) {
			result = i;
			break;
		}

		s = f( s );
	}

	cout << result << endl;
	return 0;
}


Measured memory_bytes: 256
n = int(input())
a = list(map(int,input().split()))
a.append(0)
a.insert(0,0)
ans = 0

for i in range(1,n+2):
    ans += abs(a[i]-a[i-1])

for i in range(1,n+1):
    if a[i-1]<=a[i]<=a[i+1] or a[i-1]>=a[i]>=a[i+1]:
        print(ans)
    elif a[i-1]<a[i]>a[i+1]:
        print(ans-2*(abs(a[i]-max(a[i-1],a[i+1]))))
    else:
        print(ans-2*(abs(a[i]-min(a[i-1],a[i+1]))))

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long

#pragma GCC optimize("Ofast")



using namespace std;

bool is_integer( float x ){
    return floor(x) == x;
}
bool is_integer(double x){
    return floor(x) == x;
}


int main() {

    int n; cin >> n;
    vector<ll> a(n);
    vector<pair<ll,ll>> m;
    int p = 0;
    int ans = 0;

    rep(i,n) cin >> a[i];
    sort(a.begin(),a.end());

    rep(i,n){
        if(m.empty()) m.push_back(make_pair(a[i],1));
        else if(a[i] == m[p].first) m[p].second ++;
        else{
            m.push_back(make_pair(a[i],1));
            p ++;
        }
    }

    rep(i,m.size()){
        if(m[i].second%2 == 1) ans ++;
    }
    cout << ans;

    return 0;
}











Measured memory_bytes: 5984
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long x = Long.parseLong(sc.next());
		long t = Long.parseLong(sc.next());
		System.out.println((x - t >= 0)? x - t : "0");
	}
}

Measured memory_bytes: 21844
# -*- coding: utf-8 -*-


# 入力を整数に変換して受け取る
def input_int():
    return int(input())


# マイナス1した値を返却
def int1(x):
    return int(x) - 1


# 半角スペース区切り入力をIntに変換してMapで受け取る
def input_to_int_map():
    return map(int, input().split())


# 半角スペース区切り入力をIntに変換して受け取る
def input_to_int_tuple():
    return tuple(map(int, input().split()))


# 半角スペース区切り入力をIntに変換してマイナス1した値を受け取る
def input_to_int_tuple_minus1():
    return tuple(map(int1, input().split()))


def main():
    n, m = input_to_int_map()
    h = input_to_int_tuple()

    roads = [input_to_int_tuple() for i in range(m)]

    ret = set([i + 1 for i in range(n)])

    for road in roads:
        a_h = h[road[0] - 1]
        b_h = h[road[1] - 1]

        if a_h > b_h:
            ret -= set([road[1]])

        if b_h > a_h:
            ret -= set([road[0]])

        if b_h == a_h:
            ret -= set([road[0]])
            ret -= set([road[1]])

    print(len(ret))


if __name__ == "__main__":
    main()


Measured memory_bytes: 37096
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main() {
	int  a[50] = {}, b[50] = {}, c[50] = {}, d[50] = {}, N = 0, M = 0, mini[50] = {}, ans[50] = {};
	cin >> N >> M;
	for (int i = 0; i < 50; i++)
	{
		mini[i] = 300000001;
	}
	for (int i = 0; i < N; i++)
	{
		cin >> a[i] >> b[i];
	}
	for (int i = 0; i < M; i++)
	{
		cin >> c[i] >> d[i];
		for (int j = 0; j < N; j++)
		{
			if (mini[j] != min(mini[j], (abs(d[i] - b[j]) + abs(c[i] - a[j]))))
			{
				ans[j] = i+1;
				mini[j] = min(mini[j], abs(d[i] - b[j]) + abs(c[i] - a[j]));
			}
		}
	}
	for (int i = 0; i < N; i++)
	{
		cout << ans[i] << endl;
	}
	return 0;
}

Measured memory_bytes: 256
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,copy,functools
import time,random

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readlines()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)
def pe(s): return print(str(s), file=sys.stderr)
def JA(a, sep): return sep.join(map(str, a))
def JAA(a, s, t): return s.join(t.join(map(str, b)) for b in a)


def main():
    a,b = LI()
    g = fractions.gcd(a,b)
    s = set([1])
    while g % 2 == 0:
        s.add(2)
        g //= 2
    t = 3
    ss = int(g**0.5) + 1
    while g > t and t < ss:
        while g % t == 0:
            s.add(t)
            g //= t
        t += 2
    s.add(g)

    return len(s)


print(main())





Measured memory_bytes: 5588
s = list(input())

length = len(s)
s_before = s[:int((length-1)/2)]
check = True
for i,letter in enumerate(s):
	if s[i] != s[len(s)-i-1]:
		check = False

check_bofore = True
for i,letter in enumerate(s_before):
	if s_before[i] != s_before[len(s_before)-i-1]:
		check = False
if check and check_bofore:
  	print('Yes')
else:
  	print('No')

Measured memory_bytes: 3064