akhauriyash/Code-Regression huggingface dataset:
#define  _CRT_SECURE_NO_WARNINGS
#pragma comment (linker, "/STACK:526000000")

#include "bits/stdc++.h"

using namespace std;
typedef string::const_iterator State;
#define eps 1e-11L
#define MAX_MOD 1000000007LL
#define GYAKU 500000004LL

#define MOD 998244353LL
#define seg_size 262144*2LL
#define pb push_back
#define mp make_pair
typedef long long ll;
#define REP(a,b) for(long long (a) = 0;(a) < (b);++(a))
#define ALL(x) (x).begin(),(x).end()

unsigned long xor128() {
	static unsigned long x = 123456789, y = 362436069, z = 521288629, w = time(NULL);
	unsigned long t = (x ^ (x << 11));
	x = y; y = z; z = w;
	return (w = (w ^ (w >> 19)) ^ (t ^ (t >> 8)));
}

void init() {
	iostream::sync_with_stdio(false);
	cout << fixed << setprecision(10);
}

#define int ll
void solve() {
	while (true) {
		int n, m, turn;
		cin >> n >> m >> turn;
		if (n == 0) return;
		vector<pair<int, int>> inputs;
		REP(i, turn) {
			int a, b;
			cin >> a >> b;
			a--; b--;
			inputs.push_back(mp(a, b));
		}
		int ok = 0;
		int cnt[10][10][10] = {};
		REP(i, 10) {
			REP(q, 10) {
				REP(j, 10) {
					cnt[i][q][j] = -1;
				}
			}
		}
		REP(i, inputs.size()) {
			REP(j, 10) {
				if (cnt[inputs[i].first][inputs[i].second][j] == -1) {
					cnt[inputs[i].first][inputs[i].second][j] = i % 2;
					int dx[3] = { 1,0,-1 };
					int going = 0;
					REP(q, 3) {
						REP(p, 3) {
							REP(t, 3) {
								if (q == 1 && p == 1 && t == 1) continue;
								int cnter = 0;
								REP(steps, 100) {
									int x = inputs[i].first + dx[q] * steps;
									int y = inputs[i].second + dx[p] * steps;
									int z = j + dx[t] * steps;
									if (x >= 0 && x < n && y >= 0 && y < n && z >= 0 && z < n) {
										if (cnt[inputs[i].first][inputs[i].second][j] != cnt[x][y][z]) {
											break;
										}
										cnter++;
									}
									else break;
								}
								REP(steps, 100) {
									int x = inputs[i].first - dx[q] * steps;
									int y = inputs[i].second - dx[p] * steps;
									int z = j - dx[t] * steps;
									if (x >= 0 && x < n && y >= 0 && y < n && z >= 0 && z < n) {
										if (cnt[inputs[i].first][inputs[i].second][j] != cnt[x][y][z]) {
											break;
										}
										cnter++;
									}
									else break;
								}
								cnter--;
								if (cnter >= m) going = 1;
							}
						}
					}
					if (going == 1) {
						if (i % 2 == 0) {
							cout << "Black";
						}
						else cout << "White";
						cout << " " << i+1 << endl;
						ok = 1;
					}
					break;
				}
			}
			if (ok == 1) break;
		}
		if (ok == 0) {
			cout << "Draw" << endl;
		}
	}
}
#undef int
int main() {
	init();
	solve();
}


Measured memory_bytes: 3044
#include<vector>
#include<iostream>
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include <iostream>
#include <algorithm>
#define INF 100000000000000
using namespace std;
typedef long long llong;

//int isalpha(char ch): ch がアルファベットなら true を返す
//int isdigit(char ch): ch が数字なら true を返す
//int islower(char ch): ch が小文字なら true を返す
//int isupper(char ch): ch が大文字なら true を返す
//int tolower(char ch): ch の小文字を返す
//int toupper(char ch): ch の大文字を返す

//string型
//size()	文字数を返す
//insert()	（指定した場所に）文字・文字列を挿入する
//erase()	（指定した場所の）文字・文字列を削除する
//clear()	すべての文字を削除する
//substr()	文字列の（指定した）部分文字列を返す
//replace()	（指定した）部分文字列を新しい文字列に置換する
//文字列の比較は、<=や==などを使え
//replace関数を使い、簡単に文字列を置換
//リバース関数：reverse(str.begin(), str.end());

//グラフ理論用変数
//vector<vector<llong> > graph(N);


int main(){
    llong x[5];
    for(int i=0; i<5; i++){
        cin >> x[i];
    }

    for(int i=0; i<5; i++){
        if(x[i]==0){
            cout << i+1 << endl;
        }
    }

}

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

using namespace std;

int main(){
  int N;
  string color;
  bool answer;
  answer = false;
  
  cin >> N;
  for (int i = 0; i < N ; i++){
  	cin >> color;
    	if(color == "Y"){
          answer = true;
          break;
        }
  }
  if (answer == true){cout << "Four" << endl;}
  else {cout << "Three" << endl;}
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n{},div=1;
  bool flag = true;
  cin >> n;
  int ans = n;
  if(n > 81 ) flag = false;
  for(int i=1;i<10;i++){
    if(ans % i == 0) div = max(div,i);
 }
 ans/=div;
 if(ans < 10) cout << "Yes" << endl;
 else cout << "No" << endl;


}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define endl '\n'

signed main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	ll ans = 1e17;
	ll n, m, x;cin>>n>>m>>x;
	vector<ll> v[n], cost(n, 0);
	for(int i = 0; i < n; ++i){
		cin>>cost[i];
		for(int j = 0; j < m; ++j){
			int x;cin>>x;
			v[i].push_back(x);
		}
	}
	for(int i = 0; i < (1<<n); ++i){
		ll hash[m] = {0}, cst = 0;
		for(int j = 0; j < n; ++j){
			if(i & (1<<j)){
				cst += cost[j];
				for(int k = 0; k < m; ++k){
					hash[k] += v[j][k];
				}
			}
		}
		bool ok = true;
		for(int i = 0; i < m; ++i){
			ok &= (hash[i] >= x);
		}
		if(ok){
			ans = min(ans, cst);
		}
	}
	if(ans==1e17) ans = -1;
	cout<<ans<<endl;
	return 0;
}




Measured memory_bytes: 3660
#include <iostream>
#include <algorithm>

#define int long long

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPS(i,n) for(int i=1, i##_len=(n); i<=i##_len; ++i)

#define INF (1e9)

using namespace std;

int A, B, K;

signed main()
{
    cin >> A >> B >> K;
    int aa = min(A + K - 1, B);
    int bb = max(A, B - K + 1);

    for (int i = A; i <= B; ++i)
    {
        if (i <= aa || bb <= i)
        {
            cout << i << endl;
        }
    }

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main() {
  int N, T;
  cin >> N >> T;
  set<int> q;
  for(auto i=0; i<N; ++i) {
    int t;
    cin >> t;
    q.emplace(t);
  }

  q.emplace(INT_MAX);
  auto res = 0;
  auto s = 0, g = 0;
  for(auto x: q) {
    if(g < x) {
      res += g - s;
      s = x;
    }
    g = x+T;
  }
  cout << res << endl;
}


Measured memory_bytes: 9600
#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>;

void Main()
{
  int N;
  cin >> N;
  vector<int> v(N);
  rep(i,N){ cin >> v[i]; }
  sort(v.begin(), v.end());
  
  long double mix = v[0];
  rep(i,N-1) {
    mix = (mix + (long double)v[i+1])/2.0; 
  }
  cout << mix << endl;
}

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

Measured memory_bytes: 256
#![allow(unused_imports)]
use {
   proconio::{fastout, input, marker::*},
   std::cmp::*,
   std::collections::*,
};

#[fastout]
fn main() {
   input! {
      n:usize,
      ab:[(Usize1, Usize1); n-1],
      m:usize,
      uv:[(Usize1, Usize1); m]
   }

   let mut map = BTreeMap::new();
   let mut to = vec![vec![]; n];
   for (i, &(a, b)) in ab.iter().enumerate() {
      to[a].push(b);
      to[b].push(a);
      map.insert((a, b), i);
      map.insert((b, a), i);
   }
   let mut root = vec![vec![]; n];
   dfs(0, 0, &to, &mut root);
   let mut eset = vec![0usize; m];
   for k in 0..m {
      let (u, v) = uv[k];
      let mut i = 0;
      if u != 0 {
         while root[u][i] == root[v][i]
            && i + 1 < root[u].len()
            && i + 1 < root[v].len()
            && root[u][i + 1] == root[v][i + 1]
         {
            i += 1;
         }
      }
      for j in i..root[u].len() - 1 {
         eset[k] |= 1usize << map.get(&(root[u][j], root[u][j + 1])).unwrap();
      }
      for j in i..root[v].len() - 1 {
         eset[k] |= 1usize << map.get(&(root[v][j], root[v][j + 1])).unwrap();
      }
   }

   let mut ans: i64 = 0;
   for i in 0..1 << m {
      let mut mask = 0usize;
      let mut c: i64 = 1;
      for j in 0..m {
         if i >> j & 1 == 1 {
            mask |= eset[j];
            c *= -1;
         }
      }
      let white: usize = (0..n - 1).map(|i| mask >> i & 1).sum();
      ans += c * (1 << (n - 1 - white));
   }
   println!("{}", ans);
}

fn dfs(v: usize, p: usize, to: &Vec<Vec<usize>>, root: &mut Vec<Vec<usize>>) {
   root[v].push(v);
   for &u in to[v].iter() {
      if u == p {
         continue;
      }
      root[u] = root[v].clone();
      dfs(u, v, to, root);
   }
}


Measured memory_bytes: 2208
import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

in_n = lambda: int(readline())
in_nn = lambda: map(int, readline().split())
in_s = lambda: readline().rstrip().decode('utf-8')
in_nl = lambda: list(map(int, readline().split()))
in_nl2 = lambda H: [in_nl() for _ in range(H)]
in_map = lambda: [s == ord('.') for s in readline() if s != ord('\n')]
in_map2 = lambda H: [in_map() for _ in range(H)]
in_all = lambda: map(int, read().split())


def main():

    N = in_n()
    A = in_nl() + [0]

    money = 1000
    kabu = 0

    ind = -1
    for i in range(N):
        if A[i] < A[i + 1]:
            if ind != 0:
                t = money // A[i]
                kabu += t
                money -= t * A[i]
            ind = 0
        elif A[i] >= A[i + 1]:
            if ind == 0:
                money += kabu * A[i]
                kabu = 0
            ind = 1

        # print(kabu, money)

    print(money)


if __name__ == '__main__':
    main()


Measured memory_bytes: 9324
n, m = map(int, input().split())
ab = [list(map(int, input().split())) for i in range(m)]
ba = []
for i in ab:
    ba.append(i[::-1])
ba.sort()
cnt = 1
broken = ba[0][0] - 1
for i in ba[1::]:
    if i[1] > broken:
        broken = i[0] - 1
        cnt += 1
print(cnt)

Measured memory_bytes: 74872
#include <iostream>
#include <string>
#include <algorithm>

using namespace std;

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

    string ans;
    while(N--) {
        ans.push_back('a' + N%26);
        N /= 26;
    }

    reverse(ans.begin(), ans.end());
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3628
#include <iostream>
#include <iomanip>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <cfloat>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <numeric>
#include <iterator>

using namespace std;

typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int,int> PII;
typedef vector<PII> VPII;
typedef stringstream SS;
template < typename T > inline T fromString( const string &s ){ T res; istringstream iss( s ); iss >> res; return res; };
template < typename T > inline string toString( const T &a ){ ostringstream oss; oss << a; return oss.str(); };

#define REP( i, m, n ) for ( int i = (int)( m ); i < (int)( n ); ++i )
#define FOR( v, c ) for ( auto &v : c )
#define EACH( it, c ) for ( auto it = c.begin(); it != c.end(); ++it )
#define ALL( c ) (c).begin(), (c).end()
#define DRANGE( c, p ) (c).begin(), (c).begin() + p, (c).end()

#define PB( n ) push_back( n )
#define MP( a, b ) make_pair( ( a ), ( b ) )
#define EXIST( c, e ) ( (c).find( e ) != (c).end() )

#define fst first
#define snd second

#define DUMP( x ) cerr << #x << " = " << ( x ) << endl

map<char,char> dir = {
	{ 'T', 'a' },
	{ 'L', 'i' },
	{ 'U', 'u' },
	{ 'R', 'e' },
	{ 'D', 'o' }
};

constexpr char cons[] = "w\0kstnhmyr";

int main()
{
	cin.tie( 0 );

	for ( char n, d; cin >> n >> d; )
	{
		if ( n == '0' && d == 'U' )
		{
			cout << "nn";
		}
		else
		{
			if ( n != '1' )
			{
				cout << cons[ n - '0' ];
			}
			cout << dir[d];
		}
	}
	cout << endl;

	return 0;
}

Measured memory_bytes: 1172
nums = [int(s) for s in input().split(' ')]
if nums[0]>nums[1]:
  a = nums[0]
  b = nums[1]
else:
  a = nums[1]
  b = nums[0]
c= nums[2]

while b>0:
  tmp = a%b
  a = b
  b = tmp

count=0
for i in range(a,0,-1):
  if a%i==0:
    count+=1
    if count==c:
      print(i)
      break


Measured memory_bytes: 3060
#include <algorithm>
#include <climits>
#include <iostream>
#include <string>
#include <utility>
#include <vector>
#include <cmath>

using namespace std;
using ll = long long int;

template <class T> ostream &operator<<(ostream &os, vector<T> &v) {
  for (auto i = v.begin(); i != v.end(); i++) {
    os << *i << " ";
  }
  return os;
}

ll gcd(ll a, ll b) {
  ll tmp;
  if ( b > a) {
    tmp = a;
    a = b;
    b = tmp;
  }
  while (a % b !=0) {
    tmp = b;
    b = a % b;
    a = tmp;
  }
  return b;
}

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

int main(void) {
  double n, d;
  cin>>n>>d;
  // std::cout << n/(d*2+1) << std::endl;
  // std::cout << floor(n/(d*2+1)) << std::endl;
  std::cout << ceil((double)n/(d*2+1)) << std::endl;
  return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <bitset>
#include <complex>
#include <functional>

// output
#define SPBR(w, n) std::cout<<(w + 1 == n ? '\n' : ' ');
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
// utility
#define ALL(i) (i).begin(), (i).end()
#define FOR(i, a, n) for(int i=(a);i<(n);++i)
#define RFOR(i, a, n) for(int i=(n)-1;i>=(a);--i)
#define REP(i, n) for(int i=0;i<int(n);++i)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define IN(a, x, b) (a<=x && x<b)
#define OUT(a, x, b) (x<a || b<=x)
template<class T> inline T chmax(T & a, const T b) { return a = (a < b) ? b : a; }
template<class T> inline T chmin(T& a, const T b) { return a = (a > b) ? b : a; }

// type/const
#define int ll
using ll = long long;
using ull = unsigned long long;
using ld = long double;
const int MOD = 1000000007;
/* const int MOD = 1000000007; */
const int INF = 1e18;
const double PI = acos(-1);

using namespace std;


signed main() {
  int N, K;
  cin >> N >> K;

  vector<int> A(N);
  REP(i, N) cin >> A[i];
  
  // 負け
  vector<bool> dp(K+1, false);

  REP(i, K+1){
    bool flag = true;
    REP(j, N){
      if(i < A[j]) continue;
      if(dp[i-A[j]]) flag = false;
    }
    if(flag) dp[i] = true;
  }

  if(!dp[K]) cout << "First" << endl;
  else cout << "Second" << endl;

  return 0;
}

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

using lnt = long long;
using Real = long double;

#define ALL(obj) (obj).begin(),(obj).end()
#define RALL(obj) (obj).rbegin(),(obj).rend()
#define REP(i, n) for(lnt i=0;i<(n);++i)
#define RANGE(i, a, b) for(lnt i=(a);i<(b);++i)
#define RREP(i, n) for(lnt i=(n)-1;i>= 0;--i)

#define ln '\n'
#define pb push_back
#define eb emplace_back
#define pque priority_queue
#define umap unordered_map
#define uset unordered_set
#define dcout cout<<fixed<<setprecision(20)
#define summon_tourist cin.tie(0);ios::sync_with_stdio(false)

constexpr int dx[]={1,0,-1,0,1,1,-1,-1}, dy[]={0,-1,0,1,1,-1,1,-1};
constexpr Real eps = 1e-9; const Real pi = acosl(-1);
constexpr lnt BIG = INT_MAX/10, BBIG = LLONG_MAX/10;

template<class T> inline T GCD(T a,T b){T c;while(b!=0){c=a%b;a=b;b=c;}return a;}
template<class T> inline T LCM(T a,T b){T c=GCD(a,b);a/=c;return a*b;}
template<class T> inline T nCr(T a,T b){T i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
template<class T> inline T nHr(T a,T b){return nCr(a+b-1,b);}
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;}

using pint = pair<int, int>; using plnt = pair<lnt, lnt>;
using vint = vector<int>; using vlnt = vector<lnt>;
constexpr lnt MOD = 1e9+7;

int main(){
	summon_tourist;

	int K; cin >> K;
	REP(i, K){
		cout << "ACL";
	}
	cout << ln;
}

Measured memory_bytes: 3676
function Main(input) {
    input = input.trim().split("\n").map(function(x) { return x.split(" ")});    
	var a=[1,4,10,20,35,56,84,120,165,220,286,364,455,560,680,816,969,1140,1330,1540,1771,2024,2300,2600,2925,3276,3654,4060,4495,4960,5456,5984,6545,7140,7770,8436,9139,9880,10660,11480,12341,13244,14190,15180,16215,17296,18424,19600,20825,22100,23426,24804,26235,27720,29260,30856,32509,34220,35990,37820,39711,41664,43680,45760,47905,50116,52394,54740,57155,59640,62196,64824,67525,70300,73150,76076,79079,82160,85320,88560,91881,95284,98770,102340,105995,109736,113564,117480,121485,125580,129766,134044,138415,142880,147440,152096,156849,161700,166650,171700,176851,182104,187460,192920,198485,204156,209934,215820,221815,227920,234136,240464,246905,253460,260130,266916,273819,280840,287980,295240,302621,310124,317750,325500,333375,341376,349504,357760,366145,374660,383306,392084,400995,410040,419220,428536,437989,447580,457310,467180,477191,487344,497640,508080,518665,529396,540274,551300,562475,573800,585276,596904,608685,620620,632710,644956,657359,669920,682640,695520,708561,721764,735130,748660,762355,776216,790244,804440,818805,833340,848046,862924,877975,893200,908600,924176,939929,955860,971970,988260];
	var b=[1,35,165,455,969,1771,2925,4495,6545,9139,12341,16215,20825,26235,32509,39711,47905,57155,67525,79079,91881,105995,121485,138415,156849,176851,198485,221815,246905,273819,302621,333375,366145,400995,437989,477191,518665,562475,608685,657359,708561,762355,818805,877975,939929];
	var dpA = [];
	var dpB = [];
	var max = 1e+6;
	for(var i = 0;i < max; i++) dpA[i]=Infinity;
	for(var i = 0;i < max; i++) dpB[i]=Infinity;
	dpA[0] = 0;
	dpB[0] = 0;
	for(var i = 0; i < 1000000; i++){
		for(var j = 0; j < a.length; j++){
			if(i - a[j] >= 0) dpA[i] = Math.min(dpA[i - a[j]] + 1, dpA[i]);
		}
		for(var j = 0; j < b.length; j++){
			if(i - b[j] >= 0) dpB[i] = Math.min(dpB[i - b[j]] + 1, dpB[i]);
		}
	}
	while(true){
	   var n = input.shift();
	   if(n[0] === '0') break;
	   console.log(dpA[n]+" "+dpB[n]);
	}
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));




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

#define rep(X,N) for(ll X = 0; X < (N); X++)
#define PI (acos(-1.0))
#define pback push_back
#define mpair make_pair
#define MODN 1000000007
#define ALL(V) (V).begin(),(V).end()
#define CERR if(false) cerr
#define INT_MAX_HALF (INT_MAX / 2)
#define EPS (1e-10)

using namespace std;

typedef long long ll;


int main(){

    int n,k;
    cin >> n >> k;

    cout << floor(log2(n) / log2(k)) + 1 << endl;
    return 0;
}


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

using namespace std;


//repetition
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define euc_dis(x, y) sqrt(x*x + y*y)

#define MOD 1e9+7
#define sp ' '


using ll = long long;


ll mod(ll a, ll b){return (a%b+b)%b;}
ll gcd(ll a, ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b){return a*b/gcd(a,b);}
void Yes(){cout << "Yes" << endl;}
void No(){cout << "No" << endl;}
void Judge(bool b){b?Yes():No();}
void YES(){cout << "YES" << endl;}
void NO(){cout << "NO" << endl;}
void JUDGE(bool b){b?YES():NO();}
ll powMod(ll b, ll e, ll m){ll r=1;while(e>0){if(e&1)r=(r%m)*(b%m)%m;b=(b%m)*(b%m)%m;e>>=1;}return r;}
double distance(ll x1, ll y1, ll x2, ll y2){return sqrt((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2));}

template<typename T>
void ppp(T n){cout << n << endl;}

int main(){

    cin.tie(0);
    ios::sync_with_stdio(false);

    int a, b;
    cin >> a >> b;
    if(b%a == 0){
        ppp(a+b);
    }
    else{
        ppp(b-a);
    }
        

    return 0;
}


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

using namespace std;

int main(void)
{
  int key[100];
  int n;
  string str;
  while(cin>>n,n)
  {
    for(int i = 0;i<n;i++)
      cin>>key[i];
    cin>>str;
    for(int i = 0;i<str.length();i++)
    {
      for(int j = 0;j<key[i%n];j++)
      {  
        str[i] = str[i] - 1;
        if(str[i] < 'a' && str[i]>'Z')
          str[i] = 'Z'+(str[i] - 'a')+1;
        if(str[i] < 'A')
         str[i] = 'z'+(str[i] - 'A')+1;
      }
    }
  
    cout<<str<<endl;
  }
  return 0;
}

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

#define pb push_back
#define fi first
#define se second
#define ll long long
#define pq priority_queue
#define mp make_pair
#define pii pair<int,int>
const int mod=1e9+7;

int lowbit(int x) {return x&(-x);}

int h,w;
char g[1010][1010];
int f[1010][1010];

int main(){
	scanf("%d%d",&h,&w);
	for (int i=0;i<h;i++) scanf("%s",g[i]);
	for (int i=0;i<h;i++)
		for (int j=0;j<w;j++) {
			if (i==0&&j==0) f[i][j]=1;
			else if (i==0) f[i][j]=f[i][j-1];
			else if (j==0) f[i][j]=f[i-1][j];
			else f[i][j]=(f[i-1][j]+f[i][j-1])%mod;
			if (g[i][j]=='#') f[i][j]=0;
		}
	printf("%d",f[h-1][w-1]);
	return 0;
}


Measured memory_bytes: 5248
#include<bits/stdc++.h>
#define x first
#define y second
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pll;
const ll MAX=204;
const ll MOD=998244353;
pll pt[MAX];
ll chk[MAX][MAX],ans,n;
vector<int> tmp;
ll power(ll x,ll y){
    if(y==0) return 1;
    ll t=power(x,y/2);
    if(y%2) return t*t%MOD*x%MOD;
    return t*t%MOD;
}
ll func(ll x){
    return (power(2,x)-x*(x-1)/2-x-1+MOD)%MOD;
}
main(){
    scanf("%lld",&n);
    ans=func(n);
    for(ll i=0;i<n;i++) scanf("%lld%lld",&pt[i].x,&pt[i].y);
    for(ll i=0;i<n;i++) for(ll j=i+1;j<n;j++) if(chk[i][j]==0){
        ll cnt=2;
        tmp.push_back(i),tmp.push_back(j);
        for(ll k=j+1;k<n;k++) if((pt[k].x-pt[j].x)*(pt[j].y-pt[i].y)==(pt[k].y-pt[j].y)*(pt[j].x-pt[i].x)){
            tmp.push_back(k);
        }
        for(ll k=0;k<tmp.size();k++) for(ll l=0;l<tmp.size();l++) chk[tmp[k]][tmp[l]]=1;
        if(tmp.size()>=3) ans+=MOD-func(tmp.size()),ans%=MOD;
        tmp.clear();
    }
    printf("%lld\n",ans);
}


Measured memory_bytes: 512
#include <stdio.h>
int main(void)
{
          int a , b , c ;
          scanf("%d" , &a ) ;
          scanf("%d" , &b) ;
          scanf( "%d" , &c) ;
           if ((a == b && a != c)||
                    (a == c && a!=b ) ||
                    (b == c && b!= a))
          {
                    printf("Yes") ;
          }
          else printf("No") ;

                    return 0 ;
}


Measured memory_bytes: 128
import java.util.*;
import java.lang.*;

class Main{
  public static void main(String[] args) {
      Scanner sc = new Scanner(System.in);
      int N = Integer.parseInt(sc.next());
      HashMap<Integer,Integer> map = new HashMap<>();
      for(int i = 0; i<N; i++){
        int c = Integer.parseInt(sc.next());
        if(!map.containsKey(c)) map.put(c,1);
        else{
          int num = map.get(c);
          map.put(c,++num);
        }
      }
      long res = 0;
      for(Map.Entry<Integer, Integer> entry : map.entrySet()){
        int c = entry.getKey();
        int cnt = entry.getValue();
        if(cnt<c) res+=cnt;
        else res+=(cnt-c);
      }
      System.out.println(res);
  }
}

Measured memory_bytes: 48068
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <algorithm>
#include <utility>
#include <climits>

using namespace std;

typedef unsigned long ulong;

long solve() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);

    ulong n;
    vector<ulong> as;
    ulong sum_accumulation = 0;
    ulong xor_accumulation = 0;
    ulong l = 0;
    ulong r = 0;
    ulong r_prev = 0;
    ulong ans = 0;

    auto l_increment = [&]() {
        sum_accumulation -= as[l];
        xor_accumulation ^= as[l];
        ++l;
    };
    auto r_increment = [&]() {
        sum_accumulation += as[r];
        xor_accumulation ^= as[r];
        ++r;
    };
    auto r_decrement = [&]() {
        --r;
        sum_accumulation -= as[r];
        xor_accumulation ^= as[r];
    };

    cin >> n;
    as.resize(n + 1);
    for (ulong i = 0; i < n; ++i) {
        cin >> as[i];
    }

    while (r < n ) {
        r_prev = r;
        r_increment();
        while (sum_accumulation != xor_accumulation) {
            l_increment();
        };
        while (sum_accumulation == xor_accumulation) {
            if (r >= n) goto last;
            r_increment();
        }
        r_decrement();

        last:
        auto diff1 = r - l;
        auto diff2 = r_prev - l;
        ans = ans + diff1 * (diff1 + 1) / 2 - diff2 * (diff2 + 1) / 2;
    }
    return ans;
}

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

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define rep(i,n)    for(long long i = 0; i < (n) ; ++i)
#define orep(i,n)   for(long long i = 1; i <= (n); ++i)   // one rep
#define drep(i,n)   for(long long i = (n)-1; i >= 0; --i) // down rep
#define srep(i,s,t) for(long long i = (s); i < (t); ++i)  // set rep
#define rng(x)  (x).begin(),(x).end()

  // range
#define rrng(a) (a).rbegin(),(a).rend() // reverse range
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define ru(x,y) (((x)+(y)-1)/(y)) // round up
#define fi first
#define se second
#define eb emplace_back
#define fcout cout << fixed << setprecision(15)


using namespace std;
using ll  = long long;
using P   = pair<int,int>;
using vi  = vector<int>;
using vvi = vector<vi>;
using vp  = vector<P>;
using vl  = vector<ll>;

template<typename T> void Yes(T flag) {
  cout << (flag ? "Yes" : "No") << endl;
}

template<typename T> void pv(vector<T> vec) {
  cout << "[";
  for(auto& v : vec) { cout << v << ","; }
  cout << "]" << endl;
}

template<>
void pv(vector<P> vec) {
  cout << "[";
  for(auto& v : vec) {
    cout << "<" << v.fi << ","<< v.se << ">" << ",";
  }
  cout << "]" << endl;
}

template<typename T> void pv2(vector<vector<T>> vec) {
  for(auto& v : vec) pv(v);
}


int sieve[10000005];
int main() {
  int n;
  cin >> n;
  srep(i,2,n + 1) {
    int ni = i;
    while(ni < n+4) {
      sieve[ni]++;
      ni += i;
    }
  }

  ll ans = 0;
  orep(i,n) {
     ans += (sieve[i]+1)*i;
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 42700
from itertools import accumulate

S = list(map(ord, input().strip()))
N = len(S)

atype = set()
seg = [0]*N
seg[-1] = 1
for i in range(N-1, -1, -1):
    atype.add(S[i])
    if len(atype) == 26:
        atype = set()
        seg[i] = 1

inf = 1<<32
idx = [[inf]*N for _ in range(26)]
for i in range(N-1, -1, -1):
    s = S[i] - 97
    idx[s][i] = i

for s in range(26):
    for i in range(N-2, -1, -1):
        idx[s][i] = min(idx[s][i], idx[s][i+1])



seg = list(accumulate(seg[::-1]))[::-1]
seg.append(1)
L = seg[0]
ans = []
cnt = -1
for i in range(L):
    for c in range(26):
        k = idx[c][cnt+1]
        if k == inf:
            ans.append(97+c)
            break
        if seg[k+1] + i + 1 <= L:
            ans.append(97+c)
            cnt = k
            break
        

print(''.join(map(chr, ans)))

Measured memory_bytes: 105208
#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 _ << " " <<

typedef long long ll;
typedef pair<int, int> point;

bool rek(int a, int b, bool red) {

}

int main() {
  int n, a, b; cin >> n >> a >> b;

  if(a == 1 && b == 2) {
    cout << "Borys";
  }
  else if((b - a) % 2) {
    cout << "Borys";
  }
  else {
    cout << "Alice";
  }

}


Measured memory_bytes: 256
// Problem: C - Step
// Contest: AtCoder - AtCoder Beginner Contest 176
// URL: https://atcoder.jp/contests/abc176/tasks/abc176_c
// Memory Limit: 1024 MB
// Time Limit: 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<typename T>inline void read(T &FF){
	T RR=1;FF=0;char CH=getchar();
	for(;!isdigit(CH);CH=getchar())if(CH=='-')RR=-1;
	for(;isdigit(CH);CH=getchar())FF=(FF<<1)+(FF<<3)+(CH^48);
	FF*=RR;
}
int main(){
	ll s=0,n,maxn=0;read(n);
	for(int i=1;i<=n;i++){
		ll x;read(x);
		s+=max(0ll,maxn-x);
		maxn=max(maxn,x);
	}cout<<s;
	return 0;
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
ll sum[505][505];
ll N,M,Q;
int main(){
  cin>>N>>M>>Q;
  for(ll i=0;i<M;i++){
  ll l,r;cin>>l>>r;
    sum[l][r]++;
  }for(ll i=0;i<=N;i++)
    for(ll j=1;j<=N;j++)
      sum[i][j]+=sum[i][j-1];
  for(ll j=0;j<=N;j++)
    for(ll i=1;i<=N;i++)
      sum[i][j]+=sum[i-1][j];
  for(ll i=0;i<Q;i++){
  ll p,q;cin>>p>>q;
    ll ans=sum[N][q]-sum[p-1][q];
    cout<<ans<<endl;
  }
    
  return 0;
}

Measured memory_bytes: 5580
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
#define rep(i , j , n) for(long long i = j ; i <= n ; i++)
#define per(i , j , n) for(long long i = j ; i >= n ; i--)
 
const ll N = 3534567;
const ll mod = 1e9 + 7;
const ld eps = 1e-6;
const ld pi = 3.1415926535;

map < ll , ll > primeFactors(ll n)  {  
	map < ll , ll > ans;
    while (n % 2 == 0) {
    	ans[2]++;
    	n = n / 2;
    }  
    for (ll i = 3; i <= (long long)sqrt(n) + 1 ; i = i + 2) {  
        while (n % i == 0) { 
            ans[i]++;
            n = n / i;
        }  
    }  
    if(n >= 2)
	    ans[n]++;

    return ans;
}  

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
 
    cout << fixed << setprecision(12);

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

    map< ll , ll > A = primeFactors(a);
    map< ll , ll > B = primeFactors(b);

    int cnt = 0;

    for(auto j : A) {
    	if(B.find(j.first) != B.end()) cnt++;
    }

    cout << cnt + 1 << endl;
    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cassert>
#include <iostream>
#include <vector>
#include <cstdio>
#include <complex>
#include <cstring>

using namespace std;

const int N = 500 + 5;

int n;
char a[N][N];
int can[N];

void solve()
{
    cin >> n;
    for(int i = 0; i < n; ++ i) {
        scanf("%s", a[i]);
        can[i] = -1;
    }
    int allb = false;
    for(int i = 0; i < n; ++ i) {
        int have = false;
        for(int j = 0; j < n; ++ j) {
            if (a[i][j] == '.') {
                have = true;
            } else {
                can[j] = 0;
                if (can[i] < 0) {
                    can[i] = 1;
                }
            }
        }
        if (! have) {
            allb = true;
        }
    }

    int bcol = 0;
    for(int j = 0; j < n; ++ j) {
        int have = false;
        for(int i = 0; i < n; ++ i) {
            if (a[i][j] == '.')
                have = true;
        }
        if (! have) {
            bcol ++;
        }
    }

    if (allb) {
        cout << n - bcol << endl;
        return;
    }

    int ret = -1;
    for(int i = 0; i < n; ++ i) {
        if (can[i] >= 0) {
            int cnt = 0;
            for(int j = 0; j < n; ++ j) {
                if (a[i][j] == '.') {
                    cnt ++;
                }
            }
            if (ret < 0 || ret > can[i] + cnt + n - bcol) {
                ret = can[i] + cnt + n - bcol;
            }
        } 
    }
    cout << ret << endl;
}

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


Measured memory_bytes: 512
#include<bits/stdc++.h>
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define int long long
#define vec(a,n) vector<int> (a)((n))
#define Vec(a,n) vector<string> (a)((n))
#define P pair<int,int>
#define PQ(n) priority_queue<P,vector<P>,greater<P>> (n)
#define pq(n) priority_queue<int> (n)
using namespace std;

signed main(){
    int n;
    cin >> n;
    vec(a,n);
    int total=0;
    REP(i,n){
        cin >> a[i];
        total += a[i];
    }
    vec(b,n);
    REP(i,n){
        b[i] = abs(a[i]*n-total);
    }
    sort(b.begin(),b.end());
    REP(i,n){
        int t = abs(a[i]*n-total);
        if(t == b[0]){
            cout << i;
            break;
        }
    }
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
int main(int argc, char *argv[])
{
	char a[30];
	int i,j,flag=0;
	scanf("%s",a);
	for(i=0;i<strlen(a);i++)
	{
		for(j=i+1;j<strlen(a);j++)
		{
			if(a[i]==a[j])
			flag=1;	
		}
	}
	if(flag==1)printf("no");
	else printf("yes");
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define all(x) (x).begin(), (x).end()
typedef long long ll;
using namespace std;

int main() {
    int H, W;
    cin >> H >> W;
    vector<vector<int>> S(H, vector<int>(W));
    rep(h, H) {
        string s;
        cin >> s;
        rep(w, W) {
            if (s[w] == '#') {
                S[h][w] = 0;
            }
            else {
                S[h][w] = 1;
            }
        }
    }

    vector<vector<int>> hor(H, vector<int>(W));
    vector<vector<int>> ver(H, vector<int>(W));

    // 横と縦の合計を求めていく
    rep(h, H) {
        rep(w, W) {
            if (S[h][w] == 0) {
                hor[h][w] = 0;
                ver[h][w] = 0;
                continue;
            }
            if (w == 0 && h == 0) {
                hor[h][w] = S[h][w];
                ver[h][w] = S[h][w];
            }
            else if (h == 0) {
                hor[h][w] = hor[h][w - 1] + S[h][w];
                ver[h][w] = S[h][w];
            }
            else if (w == 0) {
                hor[h][w] = S[h][w];
                ver[h][w] = ver[h - 1][w] + S[h][w];
            }
            else {
                hor[h][w] = hor[h][w - 1] + S[h][w];
                ver[h][w] = ver[h - 1][w] + S[h][w];
            }
        }
    }
    for (int h = H - 1; h >= 0; h--)
        for (int w = W - 1; w >= 0; w--) {
            if (S[h][w] == 0) {
                hor[h][w] = 0;
                ver[h][w] = 0;
                continue;
            }
            if (h == H - 1 && w == W - 1) {
                continue;
            }
            else if (h == H - 1) {
                hor[h][w] = max(hor[h][w + 1], hor[h][w]);
            }
            else if (w == W - 1) {
                ver[h][w] = max(ver[h + 1][w], ver[h][w]);
            }
            else {
                hor[h][w] = max(hor[h][w + 1], hor[h][w]);
                ver[h][w] = max(ver[h + 1][w], ver[h][w]);
            }
        }

    int ans = 0;
    rep(h, H) rep(w, W) {
        ans = max(ans, hor[h][w] + ver[h][w]);
    }

    cout << ans - 1 << endl;
}

Measured memory_bytes: 47360
#include <bits/extc++.h>

#ifndef DUMP
#define DUMP(...) (void)0
#endif

using namespace std;

int main() {
  cin.tie(nullptr)->sync_with_stdio(false);
  int h, w, k;
  cin >> h >> w >> k;
  vector v(h, vector<int>(w));
  while (k--) {
    int i, j;
    cin >> i >> j;
    --i, --j;
    cin >> v[i][j];
  }
  vector dp(4, vector(h, vector<int64_t>(w, -1e18)));
  dp[0][0][0] = 0;
  dp[1][0][0] = v[0][0];
  for (int i = 0; i < h; ++i) {
    for (int j = 0; j < w; ++j) {
      for (int x = 0; x < 4; ++x) {
        if (i + 1 < h) {
          dp[0][i + 1][j] = max(dp[0][i + 1][j], dp[x][i][j]);
          dp[1][i + 1][j] = max(dp[1][i + 1][j], dp[x][i][j] + v[i + 1][j]);
        }
        if (j + 1 < w) {
          dp[x][i][j + 1] = max(dp[x][i][j + 1], dp[x][i][j]);
          if (x < 3) {
            dp[x + 1][i][j + 1] =
                max(dp[x + 1][i][j + 1], dp[x][i][j] + v[i][j + 1]);
          }
        }
      }
    }
  }
  auto res = numeric_limits<int64_t>::min();
  for (int x = 0; x < 4; ++x) res = max(res, dp[x].back().back());
  cout << res << '\n';
}


Measured memory_bytes: 390372
#include <stdio.h>

int main()
{
    int a,b, c;
    int x = 0 ;


    scanf("%d %d", &a , &b);


    while(a!=0)
    {
        c=a%b;
        a=a/b;
        x++ ;
    }
    printf("%d", x) ;
    return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
#define fast ios::sync_with_stdio(NULL);cin.tie(0);cout.tie(0);
#define make_pair mp
#define pb push_back
#define ALL(s) s.begin(), s.end()
using namespace std;
typedef long long ll;
const int maxn = 1<<21;
const int mod = 1e9+7;
const int INF = 1e9+5;
int h[100005];
vector<int> dp(3);
int main()
{
	int n;
	cin >> n;
	for(int i=0;i<n;i++){
		vector<int> c(3);
		vector<int> new_dp(3,0);
		for(int i=0;i<3;i++)cin >> c[i];
		for(int i=0;i<3;i++){
			for(int j=0;j<3;j++){
				if(i!=j){
					new_dp[j] = max(new_dp[j],dp[i]+c[j]);
				}
			}
		}
		dp = new_dp;
	}
	cout << max(dp[0],max(dp[1],dp[2])) << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define INF 0x3f3f3f3f
using namespace std;
typedef long long ll;
inline ll min(ll x, ll y) { return x < y ? x : y; }
inline ll max(ll x, ll y) { return x > y ? x : y; }
const int Maxn = 105, Mod = 1e9 + 7;
int h, w, k;
ll f[105][10], fib[10];
int main()
{
	fib[0] = fib[1] = 1;
	for (int i = 2; i <= 10; i++)
		fib[i] = fib[i - 1] + fib[i - 2];
	cin >> h >> w >> k;
	if (w == 1)
	{
		puts("1");
		return 0;
	}
	f[0][1] = 1;
	for (int i = 1; i <= h; i++)
		for (int j = 1; j <= w; j++)
			f[i][j] = ((j == 1 ? 0 : (f[i - 1][j - 1] * fib[j - 2] % Mod * fib[w - j] % Mod)) + (j == w ? 0 : (f[i - 1][j + 1] * fib[j - 1] % Mod * fib[w - j - 1] % Mod)) + f[i - 1][j] * fib[j - 1]%Mod * fib[w - j] % Mod) % Mod;
	cout << f[h][k] << endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>

#ifdef RUBICK
#include "dbg.h"
#else
#define dbg(exp) /* nop; */
#endif

using namespace std;
using namespace __gnu_pbds;

template<class T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

typedef long long ll;

int main() {
    int x, t;
    cin >> x >> t;

    if (x > t) {
        cout << (x - t) << '\n';
    } else {
        cout << "0\n";
    }

    return 0;
}



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

int main(){
  int N,K,X,Y;
  cin >> N >> K >> X >> Y;
  if(N > K)
    cout << (X * K) + (Y * (N - K)) << endl;
  else
    cout << X * N << endl;
  return 0;
}


Measured memory_bytes: 256
#define _USE_MAT_DEFINES
#include<iostream>
#include <iomanip>
#include<stdio.h>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include <queue>
#include <utility>
#include <map>
#include <set>
#include <stack>
#include <deque>
#include <numeric>
#include <functional>
using namespace std;

static const int MOD = 1e9 + 7;

int main() {

    int N,sum=0;
    cin >> N;
    vector<int>d(N);
    for (int i = 0; i < N; i++) {
        cin >> d[i];
        sum += d[i];
    }

    int ans = 0;
    for (int i = 0; i <N ; i++) {
        ans += d[i] * (sum - d[i]);
    }

    cout << ans/2;
}

Measured memory_bytes: 256
module m1
  implicit none

  type :: edge
     integer ix
     integer,allocatable :: v(:)
  end type edge

  type :: res
     integer d, v
  end type res

  logical,allocatable :: visited(:)
end module m1

program agc033c
  use m1
  implicit none
  integer a, b, i, n
  integer,allocatable :: v1(:), v2(:), cnt(:)
  type(edge),allocatable :: e(:)
  type(res) r

  read *, n
  allocate(v1(n-1),v2(n-1),cnt(n),e(n),visited(n))

  v1 = 0
  v2 = 0
  cnt = 0
  visited = .false.

  do i = 1,n-1
     read *, a,b
     v1(i) = a
     v2(i) = b
     cnt(a) = cnt(a) + 1
     cnt(b) = cnt(b) + 1
  end do

  do i = 1,n
     e(i)%ix = 1
     allocate(e(i)%v(cnt(i)))
  end do

  do i = 1,n-1
     e(v1(i))%v(e(v1(i))%ix) = v2(i)
     e(v2(i))%v(e(v2(i))%ix) = v1(i)
     e(v1(i))%ix = e(v1(i))%ix + 1
     e(v2(i))%ix = e(v2(i))%ix + 1
  end do

  r = visit(1)
  r = visit(r%v)

  if (mod(r%d,3) == 1) then
     print *, 'Second'
  else
     print *, 'First'
  end if

contains

  recursive function visit(vertex) result(r)
    integer,intent(in) :: vertex
    type(res) r, t
    integer i

    r%d = 0
    r%v = vertex

    visited(vertex) = .true.

    do i = 1,size(e(vertex)%v)
       if (.not.visited(e(vertex)%v(i))) then
          t = visit(e(vertex)%v(i))
          if (r%d <= t%d) then
             r%d = t%d + 1
             r%v = t%v
          end if
       end if
    end do

    visited(vertex) = .false.
  end function visit

end program agc033c


Measured memory_bytes: 33024
#pragma GCC optimize("Ofast", "unroll-loops")

#include <bits/stdc++.h>

using namespace std;

#define ll long long
#define ld long double

int main(void){
	int N; cin >> N;
	ll res = 0;
	for (int i = 1; i <= N - 1; ++i){
		res += ((N - 1) / i);
	}
	cout << res << endl;
	return 0;
}

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

#define ll long long
#define INF 99999999
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()

template < typename T > std::string to_string( const T& n )
{
    std::ostringstream stm ;
    stm << n ;
    return stm.str() ;
}

int main()
{
    ll N;
    cin >> N;
    
    ll ans = INF;
    for(ll i = 1; i <= sqrt(N)+1;i++)
    {
        if( N%i != 0 ) continue;
        else
        {
            //cout << i << " " << N/i << endl;
            ll tmp = max(to_string(N/i).size(),to_string(i).size());
            if( ans > tmp ) ans = tmp;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cctype>
#include<algorithm>
using namespace std;
const int N=1e5;
int n,s,pos[N+1];
long long arr[N+1];
template<class T>T read()
{
	T ret=0;
	char c=getchar();
	while(!isdigit(c)) {
		c=getchar();
	}
	while(isdigit(c)) {
		ret=ret*10+c-'0';
		c=getchar();
	}
	return ret;
}
long long solve(int fro,int to,int end)
{
	if(s<=pos[fro]) {
		return pos[to]-s;
	}
	if(s>=pos[to]) {
		return s-pos[fro];
	}
	if(arr[fro]>=arr[to]) {
		arr[fro]+=arr[to];
		return solve(fro,to-1,fro)+(end==to?pos[to]-pos[fro]:0);
	} else {
		arr[to]+=arr[fro];
		return solve(fro+1,to,to)+(end==fro?pos[to]-pos[fro]:0);
	}
}
int main()
{
	n=read<int>(),s=read<int>();
	for(int i=1;i<=n;++i) {
		pos[i]=read<int>(),arr[i]=read<long long>();
	}
	printf("%lld\n",solve(1,n,arr[1]<arr[n]?1:n));
	return 0;
}


Measured memory_bytes: 7824
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <memory.h>
#include <cmath>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <ctime>
#include <iostream>
#include <functional>
#include <complex>
#include <iomanip>
#pragma comment(linker, "/STACK:836777216")

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
typedef pair<pii, int> p3i;
typedef vector<int> vi;
typedef vector<pii> vii;
typedef vector<pll> vll;
typedef vector<p3i> v3i;
typedef vector<vii> vvii;
typedef vector<p3i> vp3i;
typedef long double ld;
typedef vector<ld> vld;

#define pb push_back
#define mp make_pair
#define REP(i, n) for (int (i) = 0; (i) < (n); (i)++)
#define REPD(i, n) for (int (i) = (n) - 1; (i) >= 0; (i)--)
#define FOR(i, a, b) for (int (i) = (a); (i) < (b); (i)++)
#define FORD(i,a, b) for (int (i) = (a); (i) >= (b); (i)--)
#define sz(v) (int)(v).size()
#define all(v) (v).begin(), (v).end()
#define rv(v) reverse(all(v))
#define CL(v, val) memset((v), (val), sizeof((v)))
#define SORT(a) sort(all(a))
#define un(v) SORT(v), (v).resize(unique(all(v)) - (v).begin())
#define eps 1.0e-7
#define X first
#define Y second
#define bit(n) (1 << (n))
#define bit64(n) (ll(1) << (n))
#define sqr(n) ((n) * (n))

int main(void) {
  int d;
  while (scanf("%d", &d) == 1) {
    ll ans = 0;
    FOR(i, 1, 600 / d) {
      ans += (ll)d * sqr(i * d);
    }

    printf("%lld\n", ans);
  }
}

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

using namespace std;

int main()
{
  int n;
  cin >> n;
  vector< vector<int> > ans(12, vector<int> (10, 0));
  while(n > 0)
  {
    int b, f, r, v;
    cin >> b >> f >> r >> v;
    ans[(b - 1) * 3 + f - 1][r - 1] += v;
    n--;
  }
  for(int i = 1;i <= 12;i++)
  {
    for(int j = 0;j < 10;j++)
    {
      cout << " " << ans[i - 1][j];
    }
    cout << "\n";
    if(i % 3 == 0&&i != 12)
    {
      cout << "####################" << endl;
    }
  }
}


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

#define ll long long
#define vl vector<ll>
#define fo(i,a,b) for(ll i=a; i<b; i++)

int main(){
    ll N, M, hw;
    cin >> N >> M;
    fo(i, 0, M){
        cin >> hw;
        N -= hw;
    }

    if(N >= 0) cout << N << endl;
    else cout << -1 << endl;

}

/*
　 ◇　　　　 ミ ◇
　◇◇　 /￣|　 ◇◇
◇◇＼　 L＿| ◇◇
　　彡Ｏ(・＿・)/
　 　　ヽ Ｐ`Ｏ
　　 ／彡#_|ミ＼
　　　 </LL凵>
　　　　∪ ∪
pass system test !!
*/

Measured memory_bytes: 3628
bool debug=false;
#include <stdio.h>
const int N=3e3+10;
const long long int INF=1e16+10;
long long int max(long long int a,long long int b){return a>b?a:b;}
int ABS(int n){return n>=0?n:-n;}
long long int sv[N],s[N],le[N],dp[N][N];
int v[N],h[N],t[N],a[N],can[N];
void pre(int n,int m){
	s[0]=le[0]=0;
	s[1]=h[1];
	for(int i=2;i<=n;i++)s[i]=s[i-1]+h[i]+ABS(h[i]-h[i-1]);
	for(int i=1;i<n;i++)le[i]=le[i-1]+h[i]+ABS(h[i]-h[i+1]);
	le[n]=s[n];
	sv[0]=0;
	for(int i=1;i<=n;i++)sv[i]=sv[i-1]+v[i];
	can[0]=0;
	for(int i=1;i<=m;i++){
		can[i]=can[i-1];
		while(can[i]<n){
			if(sv[can[i]+1]<=t[i])can[i]++;
			else break;
		}
	}
	for(int i=0;i<=m;i++)for(int j=0;j<=n;j++)dp[i][j]=-INF;
	dp[0][0]=0;
	return ;
}
int main(){
	int n,m,pos=1;
	long long int nm;
	scanf("%d%d",&n,&m);
	for(int i=1;i<=n;i++)scanf("%d%d",&v[i],&h[i]);
	for(int i=1;i<=m;i++)scanf("%d%d",&t[i],&a[i]);
	pre(n,m);
	for(int i=1;i<=m;i++){
		nm=-INF;
		for(int j=pos;j<=can[i];j++){
			nm=max(nm,dp[i-1][j-1]);
			dp[i][j]=max(dp[i-1][j]+le[j],nm+s[j]);
		}
		for(int j=pos;j<=can[i];j++)if(dp[i][j]<a[i]){
		    pos++;
		    dp[i][j]=-INF;
		}
		for(int j=pos;j<=can[i];j++)dp[i][j]-=le[j];
	}
	if(pos<=n)printf("%lld\n",t[m]-sv[pos]);
	else printf("-1\n");
}



Measured memory_bytes: 26416
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<utility>
#include<map>
#include<queue>
#include<set>
#include<bitset>
#include<stdio.h>
#include<deque>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
typedef long long ll;
 
int main()
{
   string s;
   cin >> s;
   rep(i, 3){
       if(s[i] == '1'){
           s[i] = '9';
       }
       else s[i] = '1';
   }
   cout << s << endl;
   return 0;
}

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();
        int d = 0;
        for(int i=1; i<=n; i++){
        	if(sc.nextInt()!=i){
            	d++;
            }
        }
        System.out.println(d<=2 ? "YES" : "NO");
    }
}


Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
 
int main () {
  int N;
  long x;
  cin >> N >> x;
  vector<long> a(N);
  for (int i = 0; i < N; i++) {
    cin >> a.at(i);
  }
  long ans = 0;
  for (int i = 0; i < N-1; i++) {
    if (a.at(i) + a.at(i+1) > x) {
      long p = a.at(i) + a.at(i+1) -x;
      ans += p;
      if (a.at(i+1)-p > 0) a.at(i+1) -= p;
      else a.at(i+1) = 0;
    }
  }
 cout << ans << endl;
}

Measured memory_bytes: 1024
import java.util.Scanner;

class Main{
	public static void main(String[] arg){
	
		
		Scanner sc = new Scanner(System.in);
	        String str= sc.next().toLowerCase();   

                int cnt=0;
		 while(true){
			 String str2= sc.next();
			 if(str.equals(str2.toLowerCase())){
                                  cnt++;
				 
			 }if(str2.equals("END_OF_TEXT")){
				 break;
			 }
		 }
		 System.out.println(cnt);

		}}


Measured memory_bytes: 26140
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;

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

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

  int n, k; cin >> n >> k;
  vector<int> x(n);
  rep(i, n) cin >> x[i];

  int ans = 0;
  rep(i, n) {
    ans += 2*min(abs(x[i]), abs(x[i]-k));
  }
  cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 256
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;
int main()
{
  string s;
  int posb, pose;

  cin >> s;
  posb = s.find('A');
  pose = s.rfind('Z');

  cout << pose - posb + 1 << endl;

  return 0;
}


Measured memory_bytes: 640