akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <unordered_map>
#include <map>
#include <algorithm>
#include <set>
#include <unordered_set>
#include <deque>
#include <cmath>
#include <stack>
#include <queue>
#include <string>
#include <locale>
#include <iomanip>

#define nl '\n';

using namespace std;

string s, t;
string c;

string operation(string s){
    c = s[s.length()-1];
    s.pop_back();
    s.insert(0,c);
    return s;
}

int main(){

    cin >> s >> t;

    for(int i = 0; i < s.length()+1; i++){
        if(s == t){
            cout << "Yes";
            return 0;
        }
        s = operation(s);
    }

    cout << "No";




}

//g++ -std=c++14 comp.cpp -o b; ./b.exe
//g++ -std=c++14 comp.cpp && ./a.out

// char** arr = new char*[r];
// for(long long i = 0; i < r; i++) arr[i] = new char[c];

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

signed main(){
  string S;
  int ans=0;
  cin>>S;
  int N=S.size()/2,size=S.size();
  rep(i,N){
    if(S[i]!=S[size-1-i])ans+=1;
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 3560
#include "bits/stdc++.h"
//complication terminated
using namespace std;
int main()
{
	string s;
	cin>>s;
	int standing;
	cin>>standing;//第几个子字符串 
	set<string> ans;//子字符串 
	for(int i=0;i<s.size();i++)
	{
		string cnt = "";//初始化 
		for(int j = i;j<i+standing;j++)//最长能length 
		{
			if(j<s.size())//
				cnt+=s[j],ans.insert(cnt);//把字符串存起来 
//			cout<<"the substring="<<cnt<<endl;
		} 
	}
	int run = 0;
	for(set<string>::iterator it = ans.begin();it!=ans.end();it++,run++)
	{
		if(run == standing-1)//如果到了第standing个，输出。 
		{
			cout<<*it<<endl;
			break;
		}
	}
	return 0;
}

Measured memory_bytes: 1664
import std.stdio, std.conv, std.range, std.array;

void main() {
  immutable string[char] tb =
    [' ': "101",
     '\'': "000000",
     ',': "000011",
     '-': "10010001",
     '.': "010001",
     '?': "000001",
     'A': "100101",
     'B': "10011010",
     'C': "0101",
     'D': "0001",
     'E': "110",
     'F': "01001",
     'G': "10011011",
     'H': "010000",
     'I': "0111",
     'J': "10011000",
     'K': "0110",
     'L': "00100",
     'M': "10011001",
     'N': "10011110",
     'O': "00101",
     'P': "111",
     'Q': "10011111",
     'R': "1000",
     'S': "00110",
     'T': "00111",
     'U': "10011100",
     'V': "10011101",
     'W': "000010",
     'X': "10010010",
     'Y': "10010011",
     'Z': "10010000"];
  immutable char[string] rev_tb =
    ["00000": 'A',
     "00001": 'B',
     "00010": 'C',
     "00011": 'D',
     "00100": 'E',
     "00101": 'F',
     "00110": 'G',
     "00111": 'H',
     "01000": 'I',
     "01001": 'J',
     "01010": 'K',
     "01011": 'L',
     "01100": 'M',
     "01101": 'N',
     "01110": 'O',
     "01111": 'P',
     "10000": 'Q',
     "10001": 'R',
     "10010": 'S',
     "10011": 'T',
     "10100": 'U',
     "10101": 'V',
     "10110": 'W',
     "10111": 'X',
     "11000": 'Y',
     "11001": 'Z',
     "11010": ' ',
     "11011": '.',
     "11100": ',',
     "11101": '-',
     "11110": '\'',
     "11111": '?'];
  for(string line; readf("%s\n", &line);) {
    char[] content = line.to!(char[]);
    char[] in_stream, out_stream;
    foreach(c; content)
      in_stream ~= tb[c];
    size_t s = in_stream.length % 5;
    if (s != 0) in_stream ~= repeat('0').take(5 - s).array;    
    for(int i = 0; i < in_stream.length; i += 5) {
      out_stream ~= rev_tb[in_stream[i..(i + 5)]];
    }
    writeln(out_stream);
  }
}

Measured memory_bytes: 1240
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;
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; }

const ll INF = 1e18;

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	ll x;
	cin >> n >> x;
	vector<ll> a(n);
	vector<vector<ll>> b(n, vector<ll>(n, INF));
	rep(i,n) cin >> a[i];
	rep(i,n){
		b[i][0] = a[i];
		for(int j = 1; j < n; ++j){
			int nj = (n + i - j) % n;
			b[i][j] = min(b[i][j-1], a[nj]);
		}
	}
	ll ans = INF;
	rep(j,n){
		ll cost = x * j;
		rep(i,n){
			cost += b[i][j];
		}
		chmin(ans, cost);
	}
	cout << ans << endl;
	return 0;
}

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

int main()
{
    int a,b,x;
    cin>>a>>b>>x;
    if(a>x)
    {
        cout<<"NO"<<endl;
    }
    else
    {
        if(x-a<=b)
            cout<<"YES"<<endl;
        else
            cout<<"NO"<<endl;
    }
    return 0;
}


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

using namespace std;

using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG

/**
 * For DEBUG
 * https://github.com/ta7uw/cpp-pyprint
 */
#include "cpp-pyprint/pyprint.h"

#endif

void solve() {
    string N;
    cin >> N;
    ll s = 0;
    rep(i, N.size()) {
        s += N[i] - '0';
    }
    if (s % 9) {
        cout << "No" << '\n';
    } else {
        cout << "Yes" << '\n';
    }
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    solve();
    return 0;
}


Measured memory_bytes: 3716
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#include<time.h>
#include<ctype.h>
int main(){
    long long n, b, r, turns, rem_balls, cnt;
    while(~scanf("%lld%lld%lld", &n, &b, &r)){
        turns=n/(b+r);
        rem_balls=n%(b+r);
        if(rem_balls<=b)
            cnt=turns*b+rem_balls;
        else
            cnt=turns*b+b;

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

return 0;
}

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

public class Main
{
	public static void main(String [] Args)
	{
		Scanner in=new Scanner(System.in);
		int n=in.nextInt();
		int d=in.nextInt();
		System.out.println((n-1)/(2*d+1)+1);
	}
}
	

Measured memory_bytes: 23252
# define _CRT_SECURE_NO_WARNINGS 1
# include <iostream>
# include <numeric>
# include <string>
# include <bitset>
# include <vector>
# include <algorithm>
# include <cstdlib>
# include <cstdio>
# include <cstring>
# include <cstdlib>
# include <iomanip>
# include <queue>
# include <sstream>
# include <climits>
# include <cmath>
# include <list>
# include <functional>
# include <string>
# include <ctime>
# include <set>
# include <forward_list>
# include <map>
# include <stack>
using namespace std;
//# define M_PI 3.141592
# define INF ((int)(1<<30))
# define FOR(i,n) for(int i=0;i<(int)n;i++)
# define FORI(i,k,n) for(int i=k;i<(int)n;i++)
# define toRad 2.0*M_PI/360.0
# define inin(x) int x;cin>>x;
# define all(x) x.begin(),x.end()
# define debug(x) cout<<#x<<" :"<<x<<endl;
# define rep(i,n) for(int i=0;i<(int)n;i++)
# define EPS 1e-12
# define CHECK(i,a) FOR(i,a.size())cout<<#a<<"["<<i<<"] : "<<a[i]<<endl; 
typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef pair<int, pii> piii;
int dx[4] = { 0,-1,1,0 }, dy[4] = { 1,0,0,-1 };


int f(int N, int K)
{
	if (N == 1)return 0;
	return (f(N - 1, K) + K) % N;
}

int main()
{
	int n, k, m;
	while (cin >> n >> k >> m&&n&&k&&m)
	{
		n--;
		int ans = (f(n, k)+m+1)%(n+1);
		if (!ans)ans = n + 1;
		cout << ans << endl;

	}

}

Measured memory_bytes: 3432
#include <bits/stdc++.h>
using namespace std;
/*#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
Apparently, the tree supports the same operations as the set 
(at least I haven't any problems with them before), but also there are two new features — 
find_by_order() — The first returns an iterator to the k-th largest element (counting from zero)
order_of_key() — the number of items in a set that are strictly smaller than our item. 
https://codeforces.com/blog/entry/11080
using namespace __gnu_pbds; */
using namespace std;
#define test() int t;cin>>t;for(int test=1;test<=t;test++)
#define int long long
#define MOD 1000000007
#define pb push_back 
#define ins insert
#define fast(); ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define ld long double
#define endl '\n'
int m(int a) {
    return ((a%MOD)+MOD)%MOD;
}
int p(int a, int b) {
    int res = 1;
    while(b > 0){
        if(b&1) res = m(m(res)*m(a));
        a = m(m(a)*m(a));
        b >>= 1;
    }
    return res;
}
// vector<int> fac; //precompute fac array
// fac.resize(n+1);
// fac[0] = 1; 
// for (int i=1; i<=n; i++)   fac[i] = m(m(fac[i-1])*m(i));
// int modInverse(int n){ 
// return p(n, MOD-2); 
// }  
// int nCr(int n, int r){   
//     if(r == 0)  return 1; 
//     return m(m(m(fac[n])*m(modInverse(fac[r])))*m(modInverse(fac[n-r]))); 
// } 
signed main(){
    fast();
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    int ans = max(a*c, b*d);
    ans = max(ans, max(a*d, b*c));
    // ans = amx(ans, max(b*c, a*d));
    cout << ans << endl;
    cerr << "\nTime elapsed : " << 1000 * clock() / CLOCKS_PER_SEC << " ms\n";
}

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

int main(){
    //input
    long long N, W;
    cin >> N >> W;
    long long i, j;
    long long v[N+1], w[N+1];
    for(i = 1; i <= N; i++){
        cin >> v[i] >> w[i];
    }

    //calc
    long long dp[N+1][W+1];
    for(i = 0; i <= N; i++){
        dp[i][0] = 0;
    }
    for(j = 0; j <= W; j++){
        dp[0][j] = 0;
    }
    for(i = 1; i <= N; i++){
        for(j = 1; j <= W; j++){
            if(j < w[i]){
                dp[i][j] = dp[i-1][j];
            }else{
                dp[i][j] = max(dp[i-1][j],dp[i-1][j-w[i]] + v[i]);
            }
        }
    }

    //answer
    cout << dp[N][W] << endl;
    return 0;
}


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

int w,h,n;
int mp[102][102];

int x,y,a;

int main(){
	memset(mp,-1,sizeof(mp));
	cin>>w>>h>>n;
	for(int i=0;i<n;i++){
		cin>>x>>y>>a;
		if(a==1)for(int j=0;j<x;j++)for(int k=0;k<h;k++)mp[k][j]=1;
		if(a==2)for(int j=x;j<w;j++)for(int k=0;k<h;k++)mp[k][j]=1;
		if(a==3)for(int j=0;j<y;j++)for(int k=0;k<w;k++)mp[j][k]=1;
		if(a==4)for(int j=y;j<h;j++)for(int k=0;k<w;k++)mp[j][k]=1;
		

		
		
		
	}

	

	int cnt=0;
	for(int i=h-1;i>=0;i--){
		for(int j=0;j<w;j++){
			if(mp[i][j]==-1)cnt++;
			//cout<<mp[i][j]<<" ";
		}
		//cout<<endl;
	}
	cout<<cnt<<endl;
}


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

const int maxN = 100000;
const int64_t inf = (1LL << 50);

int h[maxN];
int64_t dp[maxN];

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

  for (int i = 0; i < n; i++) {
    cin >> h[i];
  }

  fill(dp, dp + n, inf);
  dp[0] = 0;

  for (int i = 1; i < n; i++) {
    for (int j = i - 2; j < i; j++) {
      if (j >= 0) dp[i] = min(dp[i], dp[j] + abs(h[i] - h[j]));
    }
  }
  cout << dp[n - 1] << endl;

  return 0;
}

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

using namespace std;

void calc(int n)
{
  cout<<(n + (n*n) + (n*n*n))<<endl;
}

int main()
{
  #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    freopen("err.txt","w",stderr);
  #endif
    int n;
    cin>>n;
    calc(n);
}

Measured memory_bytes: 3588
#include<iostream>
using namespace std;
int main() { 
    int n,res=0;
    cin >> n;
    for (int i = 0; i <= n / 4;i++){
      for (int k = 0; k <= n / 7;k++){
        if (4*i + 7*k == n) res++;
      }
    }
    if (res != 0) cout << "Yes" << endl;
    else
      cout << "No" << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <cmath>
typedef long long ll;
using namespace std;
#define bhasad ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);;
#define mod 1000000007
#define pi 3.14159265358979323846
int power(int x, int y) 
{ 
    int res = 1;      // Initialize result 
  
    x = x % mod;  // 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) % mod; 
  
        // y must be even now 
        y = y>>1; // y = y/2 
        x = (x*x) % mod; 
    } 
    return res; 
} 
  
// Returns n^(-1) mod p 
int modInverse(int n) 
{ 
    return power(n, 1e9-2); 
} 
  
// Returns nCr % p using Fermat's little 
// theorem. 
int nCrModPFermat(int n, int r) 
{ 
   // Base case 
   if (r==0) 
      return 1; 
  
    // Fill factorial array so that we 
    // can find all factorial of r, n 
    // and n-r 
    int fac[n+1]; 
    fac[0] = 1; 
    for (int i=1 ; i<=n; i++) 
        fac[i] = fac[i-1]*i%mod; 
  
    return (fac[n]* modInverse(fac[r]) % mod * 
            modInverse(fac[n-r]) % mod) % mod; 
} 
int main()
{
	bhasad
	int t=1;
	//cin>>t;
	while(t--)
	{
		int n;
		cin>>n;
		n=n%10;
		if(n==3)
		{
			cout<<"bon"<<endl;
			return 0;
		}
		if(n==2 ||n==4||n==5||n==7||n==9)
		{
			cout<<"hon"<<endl;
			return 0;
		}
		if(n==0 || n==1 ||n==6 || n==8)
		{
			cout<<"pon";
			return 0;
			
		}

	}
}

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

int main(int, char**) {
        int64_t N, A;
        std::cin >> N;
        std::vector<int> boss(N, 0);
        for (int i=0; i<N-1; i++) {
                std::cin >> A;
                boss.at(A-1) =boss.at(A-1)+1;
        }
        for (int i=0; i<N; i++) { 
                std::cout << boss.at(i) << std::endl;
        }

        return 0;
}


Measured memory_bytes: 4048
import sys
inputs = sys.stdin.readlines()
from functools import reduce
from operator import mul

n = int(inputs[0])
A = list(map(int, inputs[1].split()))
B = {0:0, 1:0, 2:0}
C = []
mod = 1000000007
for i in range(n):
    matches = [int(nb == A[i]) for nb in B.values()]
    if sum(matches) == 1:
        B[matches.index(1)] += 1
    elif sum(matches) == 2:
        B[matches.index(1)] += 1
        C.append(2)
    elif sum(matches) == 3:
        B[matches.index(1)] += 1
        C.append(3)
    else:
        print(0)
        break
else:
    print(reduce(mul, C) % mod)

Measured memory_bytes: 14572
import java.util.*;

 class Main
 {
   public static void main(String args[])
   { 
    input();
   }
   static void input()
   {
     Scanner sc = new Scanner(System.in);
     
     int n = sc.nextInt();
     
     int m = sc.nextInt();
     
     int l = sc.nextInt();
     
     long a[][] = new long[n][m];
     
     long b[][] = new long[m][l];
     
     long c[][] = new long[n][l];
     //input a
     for(int i = 0; i < n; i ++)
     {
       for(int j = 0; j < m; j ++)
       {
         a[i][j] = sc.nextLong();
       }
     }//input b
     for(int i = 0; i < m; i ++)
     {
       for(int j = 0; j < l; j ++)
       {
         b[i][j] = sc.nextLong();
       }
     }//a * b
     multiplication(a,b,c);
     
   }
   static void multiplication(long a[][],long b[][],long c[][])
   {
     for(int i = 0; i < c.length; i ++)
     {
       for(int j = 0; j < c[i].length; j ++)
       {
         for(int k = 0; k < b.length; k ++)
         {
           c[i][j] += a[i][k] * b[k][j];
         }
       }
     }
     output(c); 
   }
   static void output(long c[][])
   {
     for(int i = 0; i < c.length; i ++)
     {
       for(int j = 0; j < c[i].length; j ++)
       {
         if(j != 0)System.out.print(" ");
         
         System.out.print(c[i][j]);
       }
       System.out.println();
     }
   }
 }
    


Measured memory_bytes: 53568
def main():
    n = int(input())
    cs = input()

    white_l = n
    for i in range(n):
        if cs[i]=='W':
            white_l = i
            break
    red_r = -1
    for i in range(n-1, white_l, -1):
        if cs[i]=='R':
            red_r = i
            break

    manu = 0
    while white_l < red_r:
        manu += 1

        for i in range(white_l+1, n):
            if cs[i]=='W':
                white_l = i
                break
        else:
            break

        for i in range(red_r-1, white_l, -1):
            if cs[i]=='R':
                red_r = i
                break
        else:
            break

    print(manu)

main()

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

#include<bits/stdc++.h>

using namespace std;

void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

#define SPEED ios_base::sync_with_stdio(false);cin.tie(nullptr)
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define all(v) v.begin(), v.end()
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 ll = long long;
using ull = unsigned long long;
using P = pair<ll, ll>;

constexpr long double PI = 3.14159265358979323846264338327950288L;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());

class CForbiddenList {
public:
    void solve(istream& cin, ostream& cout) {
      SPEED;
      int x, n; cin >> x >> n;
      vector<int> cnt(201);
      rep(i, n) {
        int p; cin >> p;
        cnt[p]++;
      }
      int ret = -1;
      for(int i=0; i<=150; i++) {
        if (cnt[i] == 0 && abs(x-ret) > abs(x-i)) {
          ret = i;
        }
      }
      cout << ret << endl;
    }
};

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

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

int main() {
  int N;
  cin >> N;
  vector<tuple<string, int, int>> a(N);
  for (int i = 0; i < N; i++) {
    string s;
    int p;
    cin >> s >> p;
    a.at(i) = make_tuple(s, 100 - p, i);
  }
  sort(a.begin(), a.end());
  for (int i = 0; i < N; i++) {
    cout << get<2>(a.at(i)) + 1 << endl;
  }
}

Measured memory_bytes: 3516
import math
import re

a,b,t = raw_input().split()
#s = list(raw_input())

a = int(a)
b = int(b)
t = int(t)

now = a
total = 0
while True:
    if now < t + 0.5:
        total += b
        now += a
    else:
        break

print total

Measured memory_bytes: 2568
//#define __USE_MINGW_ANSI_STDIO 0
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef pair<int, int> PII;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
#define IN(a, b, x) (a<=x&&x<b)
#define MP make_pair
#define PB push_back
const int INF = (1LL<<30);
const ll LLINF = (1LL<<60);
const double PI = 3.14159265359;
const double EPS = 1e-12;
const int MOD = 1000000007;
//#define int ll

template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }

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

signed main(void)
{
  int n;
  cin >> n;
  int ret, ma = 0;
  REP(i, n) {
    int a, b;
    cin >> a >> b;
    if(a > ma) {
      ma = a;
      ret = a + b;
    }
  }
  cout << ret << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr ll MOD = 1e9 + 7;
//constexpr ll MOD = 998244353;
//constexpr ll MOD = ;
ll mod(ll A, ll M) {return (A % M + M) % M;}
constexpr ll INF = 1LL << 60;
template<class T> bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;}
template<class T> bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}
ll divceil(ll A, ll B) {return (A + (B - 1)) / B;}
#define FINALANS(A) do {cout << (A) << '\n'; exit(0);} while (false)

int main()
{
  ll H, W, h, w;
  cin >> H >> W >> h >> w;

  if (H % h == 0 && W % w == 0)
    FINALANS("No");

  bool swapped = false;
  if (W % w == 0)
  {
    swap(H, W), swap(h, w);
    swapped = true;
  }

  vector<vector<ll>> ans(H, vector<ll>(W));
  for (ll i = 0; i < H; i++)
  {
    ll a = divceil(W / w + 1, W % w);
    ll b = a * (w - 1) + 1;

    for (ll j = 0; j < W; j++)
    {
      ans.at(i).at(j) = ((j + 1) % w == 0) ? -b : a;
    }
  }

  cout << "Yes" << endl;
  if (swapped)
  {
    for (ll i = 0; i < W; i++)
    {
      for (ll j = 0; j < H; j++)
      {
        cout << ans.at(j).at(i) << ((j == H - 1) ? '\n' : ' ');
      }
    }
  }
  else
  {
    for (ll i = 0; i < H; i++)
    {
      for (ll j = 0; j < W; j++)
      {
        cout << ans.at(i).at(j) << ((j == W - 1) ? '\n' : ' ');
      }
    }
  }
}

Measured memory_bytes: 3328
#include<bits/stdc++.h>
using namespace std;
int main()
{

long long a,b,c;
long long count=0;
cin>>a>>b;

for (int i = 0; i < a; ++i)
{
	/* code */
	long long x,y;
	cin>>x>>y;

	double value=sqrt(x*x+y*y);

	if (value<=b)
	{
		/* code */
		count++;
	}
}
cout<<count<<endl;
return 0;
}


Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
#define ll long long
template <typename T>
bool PN(T x){ if (x <= 1) return false; if (x == 2) return true; for (int i = 2; i < sqrt(x) + 1; i++) if (x % i == 0) return false; return true;}
const ll MOD = 1e9+7;
long long Comb(int n, int i){long long ans = 1; if(i>n || i < 0) return 0; if(i == 0 || i == n) return 1; else {for(int j = 1; j <= i; ++j){
      ans *=(n+1-j);
      ans /= j;
      ans %= MOD;} }return ans;}

void solve(){
   string s; cin >> s;
   cout << "ABC" << s << endl;
}

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


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

typedef long long ll;
#define pii pair<int , int>
#define _FastIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define MAXX 1005

char c;
char b[5] = {'A' , 'C' , 'G' , 'T'};

int main()
{
    _FastIO;
    cin >> c;
    if(c == 'A'){
        cout << 'T' << endl;
        return 0;
    }
    if(c == 'C'){
        cout << 'G' << endl;
        return 0;
    }
    if(c == 'G'){
        cout << 'C' << endl;
        return 0;
    }
    cout << 'A' << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main()
{
	int x = 0 , l=1 ;
	int z ;
	cin >> z;
	int N[z];
	for (int i = 0; i < z; i++)
	{
		cin >> N[i];
		if (l % 2 != 0 && N[i] % 2 != 0)
		{
			x++;
			
		}
l++;
	}
	cout << x << endl;
return 0 ; 

}


Measured memory_bytes: 3600
n = int(input())
l = list(map(int, input().split(' ')))
d = {}  # key: index, val: count
for i in l:
    d[i] = d.get(i, 0) + 1
sums = 0
ans = 0
sorted_kv = sorted(d.items())
for i in range(len(sorted_kv)):
    key, val = sorted_kv[i]
    sums += val
    if sums == n // 2:
        ans = sorted_kv[i+1][0] - key
        break
print(ans)

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

using namespace std;
typedef long long ll;
int n;

main(){
  cin>>n;
  n %= 10;
  if(n == 3) cout<<"bon"<<endl;
  else if(n == 0 || n == 1 || n == 6 || n == 8) cout<<"pon"<<endl;
  else cout<<"hon"<<endl;
}


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

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

	string ans ="No";

	if ( a == b )
	{
		ans = "Yes";
	}

	if ( c == b )
	{
		ans = "Yes";
	}

	if ( a == c )
	{
		ans = "Yes";
	}

	if ( a == b && b == c)
	{
		ans = "No";
	}

	cout << ans << endl;
}

Measured memory_bytes: 256
#include <stdio.h>


int main(void)
{
    while(1){
        int i, j;
        int K = 0;
        int N = 0;
        int M[102];
        int p[102][102];
        int l[102];
        int found = 0;
        int member = 0;

        scanf("%d", &N);

        if(N == 0)
            break;

        for(i = 1; i <= N; i++){
            scanf("%d",M + i);
            for(j = 1; j <= M[i]; j++){
                scanf("%d", p[i] + j);
            }
        }

        scanf("%d", &K);
        for(i = 1; i <= K; i++){
            scanf("%d", l + i);
        }

        for(i = 1; i <= N; i++){
            int k;
            if(M[i] >= K){
                for(k = 1; k <= K; k++){
                    for(j = 1; j <= M[i]; j++){
                        if(l[k] == p[i][j]){
                            break;
                        }
                    }

                    if(j > M[i]){//not found
                        break;
                    }
                }

                if(k > K){//found
                    member = i;
                    found++;
                    if(found > 1)
                        break;
                }
            }
        }

        if(!found || found > 1){
            printf("-1\n");
        }else{
            printf("%d\n", member);
        }
    }

    return 0;
}

Measured memory_bytes: 652
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] a = new int[n];
        for (int i = 0 ; i < n ; i++) {
            a[i] = sc.nextInt();
        }
        int[] b = new int[n];
        int[] c = new int[n - 1];
        int count = 0;
        for (int i = 0 ; i < n ; i++) {
            b[i] = sc.nextInt();
            count += b[i];
        }
        for (int i = 0 ; i < n - 1 ; i++) {
            c[i] = sc.nextInt();
        }


        for (int i = 0 ; i < n - 1 ; i++) {
            if (a[i + 1] == a[i] + 1 ) {
                count += c[a[i] - 1];
            }
        }

        System.out.println(count);
    }

}


Measured memory_bytes: 21588
#include<bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize ("-ffloat-store")  
#pragma GCC optimize ("-fno-defer-pop")
#define all(a) a.begin(),a.end()
#define bs binary_search
#define ll long long int
#define ld long double
ll power(ll a,ll b,ll m){ if(b==0) return 1; if(b==1) return a%m; ll t=power(a,b/2,m); t=(t*t)%m; if(b&1)t=(t*a)%m; return t;}
ll modInverse(ll a, ll m) { return power(a, m-2, m); }
#define ipr pair<ll,ll>
#define ps push_back
#define fs first
#define sc second
#define mkp make_pair
#define mod 1000000007
int main(){
	ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	
	ll i,j,k,a,b,c;
	cin>>a>>b>>c;

	k=b/a;
	cout<<min(k,c);
	
	return 0;
}

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

const int MX = 4322;
int n , k , x , y ;
int bit[2][MX][MX] , all[2];
char c[2];

void add(int t,int x,int y){
            bit[t][x][y]++;
}

int get(int t,int x,int y)
{
if( x<1000 || y < 1000 )return 0;
return bit[t][x][y];
}

int get0(int x,int y,int t){
int tt = 1-t;
int tmp = get(t ,x,y)     -get(t ,x-k,y)    -get(t ,x,y-k)    +get(t ,x-k,y-k);
    tmp-= get(tt,x,y)     -get(tt,x-k,y)    -get(tt,x,y-k)    +get(tt,x-k,y-k);
return tmp;
}

int main()
{

    scanf("%d %d",&n,&k);
    for(int i=0; i<n; i++){
        scanf("%d %d %s",&x,&y,c);
        x%=(2*k);  y%=(2*k);
        x+=1001;   y+=1001;
        add(c[0]=='W',x,y);
        all[c[0]=='W']++;
    }

for(int t=0;t<2;t++){
    for(int i=0;i<MX;i++)
    for(int j=0;j<MX;j++){
        if( i )bit[t][i][j]+=bit[t][i-1][j];
        if( j )bit[t][i][j]+=bit[t][i][j-1];
        if(i*j)bit[t][i][j]-=bit[t][i-1][j-1];
    }
}

    int ans=0,tmp=0;
    for(int x=1001; x<1001+k; x++)
        for(int y=1001; y<1001+k; y++)
            for(int t=0; t< 2  ; t++)
            {
                tmp = 0;
                tmp+= get0(x    ,y    ,t);
                tmp+= get0(x+k  ,y+k  ,t);
                tmp+= get0(x+k  ,y-k  ,t);
                tmp+= get0(x+k+k,y    ,t);
                tmp+= get0(x    ,y+k+k,t);
                tmp+= get0(x+k+k,y+k+k,t);
                tmp+= all[1-t];
                ans=max(ans,tmp);
                if( ans == n )
                {
                    printf("%d\n",ans);
                    return 0;
                }

            }
    printf("%d\n",ans);
    return 0;
}


Measured memory_bytes: 146176
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
#define Rep(i, n) for (int i = 0; i < (int)(n); i++)
#define BitRep(i, n) for (int i = 0; i < (int)(1 << n); i++)
#define All(vec) vec.begin(), vec.end()
#define Sum(vec) accumulate(vec.begin(), vec.end(), 0)
#define Sort(vec) sort(vec.begin(), vec.end())
#define Reverse(vec) reverse(vec.begin(), vec.end())
#define Next_permutation(vec) next_permutation(vec.begin(), vec.end())
#define PI acos(-1)

int main() {
    int N;
    cin >> N;
    deque<int> num;
    int mod = N % 2;
    for (int i = 1; i <= N;i++) {
        int a;
        cin >> a;
        if (i % 2 == mod) num.push_front(a);
        else num.push_back(a);
    }
    for (int i = 0; i < N; i++) {
        if (i) cout << " ";
        cout << num.front();
        num.pop_front();
    }
    return 0;
}

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

#define fa(x,v) for(auto x:v)
#define f(i,a,b) for(ll i=(ll)a;i<=(ll)b;i++)
#define rf(i,a,b) for(ll i=(ll)a;i>=(ll)b;i--)
#define spc " "
#define endl '\n'
#define ll long long
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define len(s) (ll)int(s.length())
#define sz(v) (ll)int(v.size())
#define MOD 1000000007

void Fast_IO() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    #ifndef ONLINE_JUDGE
    freopen("input.in","r",stdin);
    freopen("output.out","w",stdout);
    freopen("debug.out","w",stderr);
    #endif
} 

// Code Here

int main()
{
    // Fast_IO();
    ll k, a, b; cin >> k >> a >> b;
    string ans = "NG";
    f(i,a,b) {
        if(i % k == 0) ans = "OK";
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 3628
import itertools
n = int(input())
li = [list(map(int, input().split())) for i in range(n)]
li_p = list(itertools.permutations(li, n))
li_a = []
for x in li_p:
  a = 0
  for i in range(n-1):
    a += ((x[i][0]-x[i+1][0])**2 + (x[i][1]-x[i+1][1])**2)**(1/2)
  li_a.append(a)
print(sum(li_a)/len(li_a))
    

Measured memory_bytes: 10612
import java.util.*;
import java.io.*;

public class Main{

	static class P implements Comparable {
		int x, y;
		P(int x, int y) {
			this.x = x;
			this.y = y;
		}

		public int compareTo(Object o) {
			P p = (P)o;
			if (this.x == p.x && this.y == p.y) return 0;
			if (this.x < p.x || (this.x == p.x && this.y < p.y)) return -1;
			return 1;
		}
	}

	public static void main(String[] args)throws IOException {
		Scanner sc = new Scanner(System.in);
		int V = sc.nextInt();
		int E = sc.nextInt();
		int R = sc.nextInt();
		ArrayList<ArrayList<Integer>> g = new ArrayList<ArrayList<Integer>>();
		ArrayList<ArrayList<Integer>> w = new ArrayList<ArrayList<Integer>>();
		for (int i = 0; i < V; i++) {
			g.add(new ArrayList<Integer>());
			w.add(new ArrayList<Integer>());
		}
		for (int i = 0; i < E; i++) {
			int s = sc.nextInt();
			int t = sc.nextInt();
			int d = sc.nextInt();
			g.get(s).add(t);
			w.get(s).add(d);
		}

		PriorityQueue<P> que = new PriorityQueue<P>();
		ArrayList<Integer> dist = new ArrayList<Integer>();
		for (int i = 0; i < V; i++) {
			dist.add(1500000007);
		}
		que.add(new P(0, R));

		while(!que.isEmpty()) {
			P p = que.poll();
			int d = p.x;
			int c = p.y;

			if (d > dist.get(c)) continue;
			dist.set(c, d);

			for (int i = 0; i < g.get(c).size(); i++) {
				int n = g.get(c).get(i);
				int ww = w.get(c).get(i);
				que.add(new P(d + ww, n));				
			}
		}

		for (int i = 0; i < V; i++) {
			if (dist.get(i) >= 1500000000) System.out.println("INF");
			else System.out.println(dist.get(i));
		}
	}
}




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

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

int main(){
    int N, A[100001];
    cin >> N;
    for(int i=1; i<=N; i++) cin >> A[i];

    int L[100002] = {0}, R[100002] = {0};
    for(int i=1; i<=N; i++) L[i] = gcd(A[i], L[i-1]);
    for(int i=N; i>=1; i--) R[i] = gcd(A[i], R[i+1]);

    int ans = 0;
    for(int i=0; i<=N; i++) ans = max(ans, gcd(L[i-1], R[i+1]));
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1408
#include <iostream>
using namespace std;
int main(void){
int a=0,b=0,g=0;
while(1){
    int l=0;
    cin>>a>>b;
    if(a==0&&b==0)break;
for ( int i = 1;i <=a;i++ ) {
    for (int j = i+1;j <=a;j++ ) {
        for (int k = j+1;k <=a;k++ ) {
          g = i+j+k;  
      if(g==b)
    l++;
        }
    }
}
cout<<l<<endl;
}

}



Measured memory_bytes: 3072
def bubblesort(N, A):
    C, flag = [] + A,  True
    while flag:
        flag = False
        for j in range(N-1, 0, -1):
            if int(C[j][1]) < int(C[j-1][1]):
                C[j], C[j-1] = C[j- 1], C[j]
                flag = True
    return C

def selectionSort(N, A):
    C = [] + A
    for i in range(N):
        minj = i
        for j in range(i,N):
            if int(C[j][1]) < int(C[minj][1]):
                minj = j
        C[i], C[minj] = C[minj], C[i]
    return C

N, A= int(input()), input().split()
Ab = bubblesort(N, A)
print(*Ab)
print('Stable')
As = selectionSort(N, A)
print(*As)
if Ab != As:
    print('Not stable')
else:
    print('Stable')

Measured memory_bytes: 7836
#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#include "debug.h"
#else
#define dump(...)
#endif
#define endl "\n"
#define ll long long
#define FOR(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define REP(i, x) for (int i = 0; i < (int)(x); i++)
#define REPS(i, x) for (int i = 1; i <= (int)(x); i++)
#define RREP(i, x) for (int i = ((int)(x)-1); i >= 0; i--)
#define RREPS(i, x) for (int i = ((int)(x)); i > 0; i--)
#define INF (1 << 30)
#define LLINF (1LL << 60)
#define vi vector<int>
#define vvi vector<vector<int>>
#define pi pair<int, int>
#define ALL(a) (a).begin(), (a).end()
#define BIT(n) (1LL << (n))
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end()) //sortしてからつかうこと
constexpr ll MOD = 1e9 + 7;
int dx[8] = { 1, 0, -1, 0, 1, 1, -1, -1 };
int dy[8] = { 0, 1, 0, -1, 1, -1, 1, -1 };
ll A, B, C, D, E, F, G, H, N, M, L, K, P, Q, R, W, X, Y, Z;
string S, T;
ll ans = 0;

template <typename T>
istream& operator>>(istream& is, vector<T>& vec) {
	for (T& x : vec)
		is >> x;
	return is;
}

signed main() {
	cin >> N;
	cout << N * N << endl;
}


Measured memory_bytes: 256
// B - Touitsu
#include <bits/stdc++.h>
using namespace std;
#define rp(i,s,e) for(int i=(s);i<(e);++i)
#define rpz(i,e) rp(i,0,e)

int main(){
	int N; cin>>N;
	string A,B,C; cin>>A>>B>>C;
	int count = 0;
	rpz(i, N) count += set<int>{A[i],B[i],C[i]}.size() - 1;
	cout<< count <<endl;
}

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

int main() {
  int N;
  cin>>N;
  if ((N%1000)%111==0)
    cout<<"Yes"<<endl;
  else if ((N-N%10)%1110==0)
    cout<<"Yes"<<endl;
  else 
    cout<<"No"<<endl;
  
}


Measured memory_bytes: 256
//#pragma GCC target ("1avx2")
#pragma GCC optimization ("O3")
//#pragma GCC optimization ("unroll-loops")
#include<bits/stdc++.h>
#define int long long
#define pii pair<int,int>
#define pb push_back 
const int M=10000000000;
using namespace std;
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

signed main()
{
  fastio;
  int t=1;
  //cin>>t;
  while(t--)
  {
    int n,sum=0;
    cin>>n;
    int arr[n];
    for(int i=0;i<n;i++)
    {
      cin>>arr[i];
      sum+=arr[i];
    }
    
    int m,p,x;
    cin>>m;
    for(int i=0;i<m;i++)
    {
      cin>>p>>x;
      cout<<sum+x-arr[p-1]<<"\n";
    }
  }
  return 0;
}


Measured memory_bytes: 3644
n = int(input())
a = list(map(int,input().split()))
b = []

for i in range(n):
    b.append(a[i]-i-1)
    
c = sorted(b)

if n%2 ==0:
    kas = c[int(n/2)]
else:
    kas = c[int((n+1)/2)-1]



ans = 0
for i in range(n):
    ans += abs(b[i]-kas)
    
print(ans)
    

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

int main() {
  int n;
  string s;
  cin >> n;
  cin >> s;
  int r = 0, b = 0;
  for (int i = 0; i < n; i++) {
    if (s[i] == 'R') {
      r++;
    }
    else {
      b++;
    }
  }
  if (r > b) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
def makelist(n, m):
    return [[0 for _ in range(m)] for _ in range(n)]

# n = int(input())
# a, b
# s = input()


# 最小公倍数
# ユークリッドの互除法
def lcm(a, b): 
    def gcd(a, b):  # a >= b
        if b == 0:
            return a
        else:
            return gcd(b, a % b)
    
    return a * b // gcd(a, b)



A, B, C, D = map(int, input().split())
A -= 1

E = lcm(C, D)

l = A - (A // C + A // D - A // E)
r = B - (B // C + B // D - B // E)

ans = r - l
print(ans)


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

namespace Acs
{
    class Program
    {
        static void Main( string[] args ) {
            var ab = Console.ReadLine().Split( ' ' ).Select( x => Int32.Parse( x ) ).ToArray();

            var a = ab[0];
            var b = ab[1];

            Console.WriteLine( ( a + b ) % 24 );
        }
    }
}


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

int	main(void)
{
	string s, t;
	cin >> s >> t;
	if (s.size() + 1 != t.size())
	{
		cout << "No" << endl;
		return (0);
	}
	for (int i = 0; i < s.size(); i++)
	{
		if (s[i] != t[i])
		{
			cout << "No" << endl;
			return (0);
		}
	}
	cout << "Yes" << endl;
	return (0);
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
//#define cerr if (false) cerr
#define db(x) cerr << #x << "=" << x << endl
#define db2(x, y) cerr << #x << "=" << x << "," << #y << "=" << y << endl
#define db3(x, y, z) cerr << #x << "=" << x << "," << #y << "=" << y << "," << #z << "=" << z << endl
#define dbv(v) cerr << #v << "="; for (auto _x : v) cerr << _x << ", "; cerr << endl
#define dba(a, n) cerr << #a << "="; for (int _i = 0; _i < (n); ++_i) cerr << a[_i] << ", "; cerr << endl
template <typename A, typename B>
ostream& operator<<(ostream& os, const pair<A, B>& x) {
	return os << "(" << x.first << "," << x.second << ")";
}
typedef long long ll;
typedef long double ld;
int main() {
	int T;
	scanf("%d", &T);
	while (T--) {
		int n;
		scanf("%d", &n);
		vector<pair<int, int>> vec;
		ll ans = 0;
		for (int i = 0; i < n; ++i) {
			int k, l, r;
			scanf("%d%d%d", &k, &l, &r);
			if (l > r) {
				vec.push_back({l - r, k});
				ans += r;
			} else {
				vec.push_back({r - l, -(n - k)});
				ans += l;
			}
		}
		sort(vec.rbegin(), vec.rend());
		set<int> E;
		for (int i = 1; i <= n; ++i) E.insert(i);
		auto f = [&](int m) {
			set<int> empty = E;
			ll score = 0;
			for (int i = 0; i < n; ++i) {
				int k = vec[i].second;
				if (k < 0) {
					// leftmost of last -k.
					auto it = empty.lower_bound(max(m + 1, n + k + 1));
					if (it == empty.end()) continue;
					empty.erase(it);
					score += vec[i].first;
				} else {
					// rightmost of first k.
					auto it = empty.upper_bound(min(m, k));
					if (it == empty.begin()) continue;
					--it;
					empty.erase(it);
					score += vec[i].first;
				}
			}
			return score;
		};
		int lo = 0, hi = n;
		while (lo < hi) {
			int m1 = (lo + hi) / 2;
			int m2 = m1 + 1;
			if (f(m1) < f(m2)) lo = m2;
			else hi = m1;
		}
		ans += f(lo);
		printf("%lld\n", ans);
	}
}


Measured memory_bytes: 23584
def input_multiple_number():
    return map(int, input().split())

N = int(input())


memo = [[-1]*10 for i in range(10)]
def getCount(head,tail):
    if memo[head][tail] != -1:
        return memo[head][tail]

    if head == 0 or tail == 0:
        memo[head][tail] = 0
        return 0

    cnt = 0

    #digit = 1
    if head == tail and head <= N:
        cnt += 1

    #digit = 2
    if head * 10 + tail <= N:
        cnt += 1 

    for i in range(1,7):
        for j in range(10**i):
            if int(str(head)+str(j).zfill(i)+str(tail))<= N:
                cnt += 1
            else:
                memo[head][tail] = cnt
                return cnt
    return cnt
def getHead(n):
    while n >= 10:
        n //= 10
    return n
def getTail(n):
    return n%10

ans = 0
for i in range(1,N+1):
    ans += getCount(getTail(i),getHead(i))
print(ans)



Measured memory_bytes: 3188
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <deque>
#include <queue>
#include <array>
#include <set>
#include <map>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <cassert>
#include <utility>
#include <functional>
#include <bitset>
#include <cstdint>

using namespace std;
using lli = long long int;
using i64 = int64_t;
using i32 = int32_t;
template<class T, class U> void init_n(vector<T>& v, size_t n, U x) 
{ v = vector<T>(n, x); }
template<class T> void init_n(vector<T>& v, size_t n) { init_n(v, n, T()); }
template<class T> void read_n(vector<T>& v, size_t n, size_t o = 0) 
{ v = vector<T>(n+o); for (size_t i=o; i<n+o; ++i) cin >> v[i]; }
template<class T> void read_n(T a[], size_t n, size_t o = 0)
{ for (size_t i=o; i<n+o; ++i) cin >> a[i]; }
template<class T> T gabs(const T& x) { return max(x, -x); }
#define abs gabs

i32 a, b;
int main() {
  scanf("%2d%2d", &a, &b);

  if ((a == 0 && b > 12) || (b == 0 && a > 12)
      || (a > 12 && b > 12) || (a == 0 && b == 0)) cout << "NA";
  else if (0 < a && a <= 12 && 0 < b && b <= 12) cout << "AMBIGUOUS";
  else if (0 < a && a <= 12) cout << "MMYY";
  else cout << "YYMM";
  cout << endl;
  return 0;
}


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

const int MAXN = 20005;

int n;
double d, x;

double comp(int n, double x, double d) {
    if (n == 1)
        return (x + d/2);
    return (x + (2*n-1)*d/2) + comp(n-1, (n+1)*x/n + 5*d/(2*n), d + 2*d/n);
}

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    
    cin >> n >> d >> x;
    cout << fixed << setprecision(10) << comp(n, d, x) << endl;
}

Measured memory_bytes: 6528
#include <bits/stdc++.h>
#define il inline
#define ri register int
#define pb push_back
#define mp make_pair
#define fir first
#define sec second
#define mid ((l+r)>>1)
#define MAXN 100050
#define MAXM
#define mod
#define inf (1<<30)
#define eps (1e-6)
#define alpha 0.75
#define rep(i, x, y) for(ri i = x; i <= y; ++i)
#define repd(i, x, y) for(ri i = x; i >= y; --i)
#define file(s) freopen(s".in", "r", stdin), freopen(s".out", "w", stdout)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair <int, int> pii;
typedef pair <ll, int> pli;
typedef pair <int, ll> pil;
typedef pair <ll, ll> pll;
template <typename T> il bool chkmin(T &x, T y) {return x > y ? x = y, 1 : 0;}
template <typename T> il bool chkmax(T &x, T y) {return x < y ? x = y, 1 : 0;}
template <typename T> il void read(T &x) {
	char ch = getchar(); int f = 1; x = 0;
	while(ch < '0' || ch > '9') {if(ch == '-') f = -1; ch = getchar();}
	while(ch >= '0' && ch <= '9') x = x*10+ch-'0', ch = getchar();
	x *= f;
}
template <typename T, typename... Args> il void read(T &x, Args &...args) {
	read(x), read(args...);
}
int n, l, a[MAXN];
int main() {
	int pos = 0;
	read(n, l);
	rep(i, 1, n) {
		read(a[i]);
		if(a[i] + a[i-1] >= l) pos = i;
	}
	if(!pos) return 0 * puts("Impossible");
	puts("Possible");
	repd(i, n-1, pos) cout << i << endl;
	rep(i, 1, pos-1) cout << i << endl;
	return 0;
}


Measured memory_bytes: 1152
A, B, C = map(int, input().split())
if A == B == C and A % 2 == 0:
    print(-1)
    exit()
i = 0
while 1:
    if A % 2 or B % 2 or C % 2:
        print(i)
        break
    a, b, c = A>>1, B>>1, C>>1
    A, B, C = b+c, a+c, a+b
    i += 1

Measured memory_bytes: 3060
using System;
using System.IO;
using System.Linq;
using System.Collections.Generic;

public class Program
{

	public void Proc()
	{
        int inputCount = int.Parse(Reader.ReadLine());
        string[] inpt = new String[inputCount];
        inpt = Reader.ReadLine().Split(' ').Reverse().ToArray();
        Console.WriteLine(string.Join(" ", inpt));
    }


    public class Reader
	{
		private static StringReader sr;
		public static bool IsDebug = false;
		public static string ReadLine()
		{
			if (IsDebug)
			{
				if (sr == null)
				{
					sr = new StringReader(InputText.Trim());
				}
				return sr.ReadLine();
			}
			else
			{
				return Console.ReadLine();
			}
		}
		private static string InputText = @"




5
1 2 3 4 5



";
	}

	public static void Main(string[] args)
	{
#if DEBUG
		Reader.IsDebug = true;
#endif
		Program prg = new Program();
		prg.Proc();
	}
}

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

long long n;

int main() {
  cin >> n;

  long long div_3 = 3 * (n / 3) * (n / 3 + 1) / 2;
  long long div_5 = 5 * (n / 5) * (n / 5 + 1) / 2;
  long long div_15 = 15 * (n / 15) * (n / 15 + 1) / 2;

  long long sum = n * (n + 1) / 2 - div_3 - div_5 + div_15;

  printf("%lld", sum);

  return 0;
}

Measured memory_bytes: 3668
import copy
H, W = map(int, input().split())
S = [input() for i in range(H)]
dd = ((-1, 1), (-1, 0), (-1, -1), (0, -1), (1, -1), (1, 0), (1, 1), (0, 1))
T = copy.deepcopy(S)
count = 0
for i in range(H):
    for j in range(W):
        if S[i][j] == '#':
            continue
        for dx, dy in dd:
            nx = j + dx; ny = i + dy
            if 0 <= nx < W and 0 <= ny < H:
                if S[ny][nx] == '#':
                    count += 1
        T[i] = list(T[i])
        T[i][j] = str(count)
        T[i] = "".join(T[i])
        count = 0
for k in range(len(T)):
    print(T[k])



Measured memory_bytes: 3440
use std::cmp;
use std::collections::HashMap;
use std::collections::VecDeque;
use std::usize::MAX;

macro_rules! input {(source = $s:expr, $($r:tt)*) => {let mut iter = $s.split_whitespace();let mut next = || { iter.next().unwrap() };input_inner!{next, $($r)*}};($($r:tt)*) => {let stdin = std::io::stdin();let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));let mut next = move || -> String{bytes.by_ref().map(|r|r.unwrap() as char).skip_while(|c|c.is_whitespace()).take_while(|c|!c.is_whitespace()).collect()};input_inner!{next, $($r)*}};}
macro_rules! input_inner {($next:expr) => {};($next:expr, ) => {};($next:expr, $var:ident : $t:tt $($r:tt)*) => {let $var = read_value!($next, $t);input_inner!{$next $($r)*}};}
macro_rules! read_value {($next:expr, ( $($t:tt),* )) => {( $(read_value!($next, $t)),* )};($next:expr, [ $t:tt ; $len:expr ]) => {(0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()};($next:expr, chars) => {read_value!($next, String).chars().collect::<Vec<char>>()};($next:expr, usize1) => {read_value!($next, usize) - 1};($next:expr, [ $t:tt ]) => {{let len = read_value!($next, usize);(0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()}};($next:expr, $t:ty) => {$next().parse::<$t>().expect("Parse error")};}

fn solve() {
    input! {
        s: chars
    }

    let mut before = s[0];

    let mut boole = false;
    for i in 1..3 {
        boole = if before != s[i] { true } else { false };
        if boole {
            break;
        }
    }

    println!("{}", if boole { "Yes" } else { "No" });
}

fn main() {
    let thd = std::thread::Builder::new().stack_size(104_857_600);
    thd.spawn(|| solve()).unwrap().join().unwrap();
}

const LARGE_PRIME: u64 = 1_000_000_007;

// @〜でsnippet


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

int main()
{
  int a,b,c,k;

  cin >> a >> b >> c >> k;

  if(k<=a){
    cout << k << endl;
  }
  else if(k<=a+b){
    cout << a << endl;
  }
  else{
    cout << a-(k-(a+b)) << endl;
  }

  return 0;
}

Measured memory_bytes: 3636