akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            new Program().Solve(new ConsoleInput(Console.In, ' '));
            System.Threading.Thread.Sleep(1000);
        }

        public void Solve(ConsoleInput cin)
        {
            int h = cin.ReadInt;
            int w = cin.ReadInt;

            string[,] map = new string[h, w];
            for (int i = 0; i < h; i++)
            {
                char[] l = cin.ReadLine.ToCharArray();
                for (int j = 0; j < w; j++)
                {
                    map[i, j] = l[j].ToString();
                }
            }

            bool can = true;
            for (int i = 0; i < h; i++)
                for (int j = 0; j < w; j++)
                {
                    if (map[i, j].Equals(".")) continue;
                    if (i > 0 && map[i - 1, j].Equals("#")) continue;
                    if (j > 0 && map[i, j - 1].Equals("#")) continue;
                    if (i < h-1 && map[i + 1, j].Equals("#")) continue;
                    if (j < w-1 && map[i, j + 1].Equals("#")) continue;
                    can = false;
                }

            Console.WriteLine(can ? "Yes" : "No");
        }
    }

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

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

#define int long long
#define double long double
#define ff first
#define ss second
#define endl '\n'
#define ii pair<int, int>
#define mp make_pair
#define mt make_tuple
#define DESYNC                      \
  ios_base::sync_with_stdio(false); \
  cin.tie(0);                       \
  cout.tie(0)
#define pb push_back
#define vi vector<int>
#define vii vector<ii>
#define all(x) x.begin(), x.end()
#define EPS 1e-9
#define INF 1e18
#define ROOT 1
#define M 1000000007
#define curtime chrono::steady_clock::now().time_since_epoch().count
#define rep(i, beg, n, s) for (int i = beg; i < n; i += s)
const double PI = acos(-1);

using namespace std;

inline int mod(int n, int m) {
  int ret = n % m;
  if (ret < 0) ret += m;
  return ret;
}

int gcd(int a, int b) {
  if (a == 0)
    return b;
  else
    return gcd(b % a, a);
}
// #define MULTIPLE_TEST_CASE
void solution() {
  char c;
  cin >> c;
  if (c >= 'A' && c <= 'Z')
    cout << 'A' << endl;
  else
    cout << "a" << endl;
}

int32_t main() {
  DESYNC;
  mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
  int t = 1;
#ifdef MULTIPLE_TEST_CASE
  cin >> t;
#endif
  while (t--) solution();
}


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

using namespace std;

int main(){
	int m[10];
	for (int i=0;i<10;i++){
		cin>>m[i];
	}
	sort(m,m+10);
	for (int i=0;i<3;i++){
		cout<<m[9-i]<<endl;
	}
	return 0;
}

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

int main(){
    string s;
    cin >> s;
    long long int ans = 0;
    for(int i=0;i<(1<<(s.size()-1));++i){
        for(int j=0;j<s.size();++j){
            long long int tmp = s[j] - '0';
            while((i&(1<<j)) == 0 && j<s.size()-1){
                j++;
                tmp *= 10;
                tmp += s[j] - '0';
            }
            ans += tmp;
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<iostream>
#include<queue>
#include<vector>
#include <bitset>
#include<math.h>
using namespace std;
#define INF 11000000000
#define MOD 1000000007
typedef long long ll;
typedef pair<ll,int> P;

ll d[1100][1100]; //d[u][v]は辺e=(u,v)のコスト(存在しない場合はINF，d[i][i]=0)
int V,perm[10]={0,1,2,3,4,5,6,7,8}; //頂点数

//(V^3)
void warshall_floyd(){
  V=10;
  for(int k=0;k<V;k++){
    for(int i=0;i<V;i++){
      for(int j=0;j<V;j++) d[i][j]=min(d[i][j],d[i][k]+d[k][j]);
    }
  }
}

int main(){
  int temp,need[10],H,W;
  ll ans=0;
  cin>>H>>W;
  for(int i=0;i<10;i++){
    for(int j=0;j<10;j++){
      cin>>temp;
      d[i][j]=temp;
    }
  }

  warshall_floyd();
  
  for(int i=0;i<10;i++) need[i]=d[i][1];
  //cout<<need[8]<<endl;


  for(int i=0;i<H;i++){
    for(int j=0;j<W;j++){
      cin>>temp;
      if(temp!=-1) ans+=need[temp];
    }
  }

  cout<<ans<<endl;
}


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

#define ll long long
#define rep(i,x,y) for(int i=x;i<y;i++)
#define rel(i,x,y) for(int i=x-1;i>=y;i--)
#define all(x) x.begin(),x.end()

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    ll h,w;
    cin >> h >> w;
    ll ans=h*w+1;
    if(h==1 || w==1) cout << 1 << endl;
    else cout << ans/(ll)2 << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define MOD 1000000007
#define PI 3.141592653589793
const int INF = 100000000;
int dx[] = {0,1,-1,0,1,-1,1,-1};
int dy[] = {1,0,0,-1,1,-1,-1,1};

int main(){
    int a, b, k;
    cin >> a >> b >> k;
    vector<int> cd;
    for(int i = 1; i <= min(a, b); i++){
        if(a % i + b % i == 0){
            cd.push_back(i);
        }
    }
    sort(cd.rbegin(), cd.rend());
    cout << cd[k-1] << endl;
}


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

#define CHOOSE(a) CHOOSE2 a
#define CHOOSE2(a0, a1, a2, a3, a4, x, ...) x
#define dump_1(x1) cerr << #x1 << ": " << x1 << endl
#define dump_2(x1, x2) \
  cerr << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << endl
#define dump_3(x1, x2, x3)                                                \
  cerr << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << ", " #x3 << ": " \
       << x3 << endl
#define dump_4(x1, x2, x3, x4)                                            \
  cerr << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << ", " #x3 << ": " \
       << x3 << ", " #x4 << ": " << x4 << endl
#define dump_5(x1, x2, x3, x4, x5)                                        \
  cerr << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << ", " #x3 << ": " \
       << x3 << ", " #x4 << ": " << x4 << ", " #x5 << ": " << x5 << endl
#define dump(...) \
  CHOOSE((__VA_ARGS__, dump_5, dump_4, dump_3, dump_2, dump_1, ~))(__VA_ARGS__)
#define check(s) cerr << s << endl

#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#define unique(v) v.erase(unique(v.begin(), v.end()), v.end());

using namespace std;

using ll = long long;

vector<int> dx = {0, 1, 0, -1};
vector<int> dy = {1, 0, -1, 0};

const ll LINF = 2e18;
const int INF = 1e9;

void solve(ll M, std::vector<ll> d, std::vector<ll> c) {
  ll D = 0, S = 0;

  rep(i, M) {
    S += d.at(i) * c.at(i);
    D += c.at(i);
  }

  cout << ll(D - 1 + floor((S - 1) / 9)) << endl;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  ll M;
  scanf("%lld", &M);
  std::vector<ll> d(M);
  std::vector<ll> c(M);
  for (int i = 0; i < M; i++) {
    scanf("%lld", &d[i]);
    scanf("%lld", &c[i]);
  }
  solve(M, std::move(d), std::move(c));
  return 0;
}


Measured memory_bytes: 6428
N, C, K = map(int, input().split())
t = []
for i in range(N):
    t.append(int(input()))
t.sort()

ans = 0
pt = t[0]
cnt = 1

for i, ct in enumerate(t[1:]):
    if ct - pt > K:
        ans += 1
        cnt = 1
        pt = ct
    elif ct - pt <= K and cnt <= C:
        if cnt == C:
            ans += 1
            cnt = 0
            pt = ct
        cnt += 1
        
if cnt > 0:
    ans += 1
    
print(ans)

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

int main() {
  int n, m;
  cin >> n >> m;
  dsu d(n);
  rep(i,m) {
    int a, b;
    cin >> a >> b;
    --a, --b;
    d.merge(a,b);
  }
  cout << d.groups().size()-1 << endl;

  return 0;
}

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

int main() {
    int a, b, d, r;
    double f;
    cin >> a >> b;
    d = a / b;
    r = a % b;
    f = double(a) / double(b);
    printf("%d %d %f \n", d, r, f);
    return 0;
}

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

int main() {
  int N;
  cin >> N;
  int64_t sum = 0;
  for (int i = 1; i <= N; i++) {
    if (i%3 != 0 && i%5 != 0) sum += i;
  }
  cout << sum << endl;
}


Measured memory_bytes: 3636
#include <ctype.h>
#include <limits.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <tgmath.h>

int main(int argc, char **argv)
{
    char s[101];
    scanf("%s", s);
    for (char *p = s; *p; p++) printf("x");
    printf("\n");
    return EXIT_SUCCESS;
}


Measured memory_bytes: 128
<?php


$n = trim(fgets(STDIN));
//$aline = trim(fgets(STDIN));

$n = explode(" ", $n);

if (($n[0] + $n[1] + $n[2]) > 21) {
    echo 'bust' . PHP_EOL;
} else {
    echo 'win' . PHP_EOL;
}


Measured memory_bytes: 4728
#include <cstdlib>
#include <algorithm>
#include <iostream>
#include <map>


template<
  typename Itr,
  typename F
>
static inline void
countSeq(const Itr& begin, const Itr& end, const F& f)
{
  int cnt = 0;
  auto c = *begin;
  for (auto itr = begin; itr != end; ++itr) {
    if (*itr != c) {
      f(c, cnt);
      c = *itr;
      cnt = 1;
    } else {
      cnt++;
    }
  }
  f(c, cnt);
}


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

  int n;
  std::cin >> n;

  std::map<char, int> charCntMap;

  // init
  std::string s;
  std::cin >> s;
  std::sort(std::begin(s), std::end(s));
  countSeq(std::cbegin(s), std::cend(s), [&charCntMap](auto c, auto cnt){
    charCntMap[c] = cnt;
  });

  for (int i = 0; i < n - 1; i++) {
    std::cin >> s;
    std::sort(std::begin(s), std::end(s));
    countSeq(std::cbegin(s), std::cend(s), [&s, &charCntMap](auto c, auto cnt){
      if (charCntMap.find(c) == std::cend(charCntMap)) {
        charCntMap[c] = 0;
      } else {
        charCntMap[c] = std::min(charCntMap[c], cnt);
      }
    });
    for (auto&& e : charCntMap) {
      if (s.find(e.first) == std::string::npos) {
        e.second = 0;
      }
    }
  }

  for (const auto& e : charCntMap) {
    for (decltype(e.second) i = 0; i < e.second; i++) {
      std::cout.put(e.first);
    }
  }
  std::cout << std::endl;

  return EXIT_SUCCESS;
}


Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
// #pragma GCC target("avx")
#include <bits/stdc++.h>
#define SIZE 300005
#define MOD 1000000007LL
#define MOD2 1000000014000000049LL
#define EPS 1e-10
#define INF 2147483647
#define LLINF 9223372036854775807LL
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define DOWN(i,b,a) for(int i=b;i>=a;i--)
#define SET(a,c) memset(a,c,sizeof a)
#define BIT(i,j) ((i)>>(j))&1
#define ALL(o) (o).begin(), (o).end()
#define ERASE(o) (o).erase(unique((o).begin(),(o).end()), (o).end())
#define SQ(x) ((x)*(x))
using namespace std;
typedef int_fast64_t ll;
typedef pair<ll,ll> Pll;
typedef pair<int, int> Pii;
typedef pair<double, double> Pdd;
typedef complex<double> dcomplex;
template<typename T> inline void priv(vector<T>a){REP(i,a.size()){cerr<<a[i]<<((i==a.size()-1)?"\n":" ");}}
inline void fastio(){cin.tie(nullptr); cout.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15);}
ll gcd(ll a,ll b){ll c=max(a,b);ll d=min(a,b);return c==0||d==0?c:gcd(c%d,d);}
ll lcm(ll a,ll b){return a==0||b==0?0:a*b/gcd(a,b);}

template<int N, typename T, T M>
struct ModFact {
    T inv[N+1];
    T fact[N+1];
    T ifact[N+1];
    constexpr ModFact() : fact(), ifact() {
        fact[0] = 1;
        for (int i = 0; i < N; i++)
            fact[i+1] = (fact[i]*(i+1))%M;
        ifact[N] = power(fact[N], M-2);
        for (int i = N-1; i >= 0; i--)
            ifact[i] = (ifact[i+1]*(i+1))%M;
        inv[0] = 0;
        for (int i = 0; i < N; i++)
            inv[i+1] = (fact[i]*ifact[i+1])%M;
    }
    constexpr T power(T a, T b) {
        T r = 1;
        while (b>0) {
            if((b&1)!=0) r = (r*a)%M;
            a = (a*a)%M;
            b >>= 1;
        }
        return r;
    }
    constexpr T comb(T n, T r) {
        return (((fact[n]*ifact[r])%M)*ifact[n-r])%M;
    }
};

const int cm = 1 << 17;
char cn[cm], * ci = cn + cm, ct;
inline char getcha() {
	if (ci - cn == cm) { fread_unlocked(cn, 1, cm, stdin); ci = cn; }
	return *ci++;
}

inline int getint() {
	int A = 0;
	if (ci - cn + 16 > cm) while ((ct = getcha()) >= '0') A = A * 10 + ct - '0';
	else while ((ct = *ci++) >= '0') A = A * 10 + ct - '0';
	return A;
}

ModFact<100000, ll, MOD> fact;

ll N;

int main() {
    ll ans = 0;
    int N, prev, now;
    N = getint();
    prev = getint();
    ll a = 0;
    REP(i, N-1) {
        now = getint();
        a += fact.inv[i+1];
        if(a > MOD) a -= MOD;
        ans += a * (now - prev);
        if(ans > MOD2) ans -= MOD2;
        prev = now;
    }
    printf("%lld\n", ((ans%MOD)*fact.fact[N-1])%MOD);
	return 0;
}


Measured memory_bytes: 2688
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long int n,d,x,y,ans=0;
    cin>>n>>d;
    while(n--)
    {
        cin>>x>>y;
        if(sqrt((x*x)+(y*y))<=d)
            ans+=1;
    }
    cout<<ans;
}


Measured memory_bytes: 3584
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;cin>>n;
  vector<int>a(n),b(n);
  for(int i=0;i<n;i++)
  {
    cin>>a.at(i);
    b.at(i)=a.at(i);
  }
  sort(a.begin(),a.end());
   
  for(int i=0;i<n;i++)
  {
    if(b.at(i)==a.at(n-1))
      cout<<a.at(n-2)<<endl;
    else
      cout<<a.at(n-1)<<endl;
  }
}

Measured memory_bytes: 3200
#include <bits/stdc++.h>
using namespace std;
int main(){
 int n ;
 cin >> n;
 string str;
 int result=1;
 cin >> str;
 for(int i=0;i<n-1;i++){
    if(str[i] != str[i+1]){
       result+=1;
     }
 }
 cout << result;
}


Measured memory_bytes: 512
A = list(int(i) for i in str(input()))
A, B = A[0]*10+A[1], A[2]*10+A[3]
if A == 0:
    if B == 0 or B>12:
        print("NA")
    else:
        print("YYMM")
elif A <= 12:
    if 0 < B and B <= 12:
        print("AMBIGUOUS")
    else:
        print("MMYY")
else:
    if 0 < B and B <= 12:
        print("YYMM")
    else:
        print("NA")

Measured memory_bytes: 3060
n,x= map(int,input().split())
a = [int(_) for _ in input().split()]
a.sort()
a = a[::-1]
ans = 0
while x > 0:
  if a == []:
    ans -= 1
    break
  y = a.pop()
  x-= y
  if x >= 0:
    ans += 1
print(ans)

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

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

typedef long long ll;
using namespace std;
int mod = 1000000007;

int main(void){
    int N, M; cin >> N >> M;
    int ans, ulim;
    if(N == 1) {ans = 0; ulim = 10;}
    else if(N == 2) {ans = 10; ulim = 100;} 
    else {ans = 100; ulim = 1000;}
    int S[M], C[M];
    rep(i, M) cin >> S[i] >> C[i];
    bool ok = true;
    while(ans < ulim){
        string temp = to_string(ans);
        ok = true;
        rep(i, M){
            if(temp[S[i]-1] - '0' != C[i]) ok = false;
        }
        if(ok) break;
        ans++;
    }
    if(ans == ulim) ans = -1;
    cout << ans << endl;

    return 0;
}

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

using namespace std;

int n,sum,x;
bitset<2005*2005> f;

int main(){
	scanf("%d",&n);
	f[0]=1;
	for (int i=1;i<=n;i++){
		scanf("%d",&x); sum+=x;
		f|=f<<x;
	}
	for (int i=sum/2+sum%2;i<=sum;i++) if (f[i]){printf("%d\n",i); break;}
	
	return 0;
}
			

Measured memory_bytes: 1664
// --------------------<optimizations>--------------------
#pragma GCC optimize("O3")

//(UNCOMMENT WHEN HAVING LOTS OF RECURSIONS)
#pragma comment(linker, "/stack:200000000")
//(UNCOMMENT WHEN TRYING TO BRUTEFORCE WITH A LOT OF LOOPS)
#pragma GCC optimize("unroll-loops")
// -------------------</optimizations>--------------------
#include <iostream>
#include <bitset>
#include <algorithm>        // sort()
#include <vector>           // for vectors
#include <map>              // for ordered map
#include <unordered_map>
#include <list>             // for list
#include <iomanip>          // for setprecision()
#include <cmath>            // for pow(), sqrt(), log(), log10(), ....
#include <cstring>          // for memset()
#include <unordered_set>    // for unordered_set
#include <climits>          // for INT_MAX & INT_MIN
#include <set>              // for ordered set

#define C ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;
typedef long long ll;
#define INF INT_MAX
#define NINF INT_MIN
const double pi=acos(-1); // value of pi


bool isVowel(char ch) {
    if(ch=='a' || ch=='e' || ch=='i' || ch=='o' || ch=='u') {
        return 1;
    }
    return 0;
}

bool compare(pair<ll, ll> a, pair<ll, ll> b) {
    return a.second<b.second;
}

// map<ll, list<ll>> m;
map<ll, ll> m;

bool isPrime(ll n) {
    for(ll i=3; i*i<=n; i+=2) {
        if(n%i==0) {
            return false;

        }
    }
    return true;
}

int main() {
    C
//     freopen("input.txt","r",stdin);
// 	freopen("output.txt","w",stdout);
    int t=1;
    //cin >> t;
    while(t--) {
        ll n, k, ans=0;
        cin >> n >> k;
        ll arr[n];
        for(ll i=0; i<n; i++) {
            cin >> arr[i];
        }
        sort(arr, arr+n);
        for(ll i=0; i<k; i++) {
            ans+=arr[i];
        }
        cout << ans << endl;
    }
}


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

using namespace std;
typedef long long ll;
const int INF = 1e9;

int main(){
	ll T = 1;
	//cin >> T;
	while (T--){
		int s;
		int w;
     cin >> s >> w; 
     if (w >= s) {
		 cout << "unsafe" << endl;
	 }
	 else
	 cout << "safe" << endl;
	}
}
	

Measured memory_bytes: 3576
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
int INF = 1000000007;
 
 
int main(){
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
 
  int N, T;
  cin >> N >> T;
  int64_t A[N], ans = 0;
  rep(i, N){
    cin >> A[i];
  }
  for(int i=0;i<N-1;i++){
    if(A[i+1]-A[i] <= T){
      ans += A[i+1]-A[i];
    }
    else ans += T;
  }
  ans += T;
  cout << ans << endl;
 
}

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

#define rep(i,n) for(int i=0 ; i<(n) ; i++)
#define repr(i,n) for(int i=(n) ; i>=0 ; i--)
#define ALL(x) (x).begin(),(x).end()

typedef long long ll;
typedef unsigned long long ull;
 
const ll INF = 1LL<<60;
const int MINF = 1e9;
const int MOD = 1e9+7;

using vi = vector<int>;
using vii = vector<vi>;

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

template<typename T>
T GCD(T a,T b){ return b ? GCD(b,a%b) : a ;}
template<typename T>
T LCM(T a,T b){ return a*b / GCD(a,b) ;}

int main(){
    ll a,b,k;
    cin >> a >> b >> k;
    k -= a;
    if(k>=0){
        a = 0;
        b -= k;
        if(b<0)b = 0;
        cout << a << ' ' << b << endl;
    }else{
        a = 0;
        a = -k;
        cout << a << ' ' << b << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
const int INF = 100000000;
const int MAX_N = 100;
typedef pair<int , int> P;
typedef long long ll;
 
int main () {
  int N, M, ans;
  cin >> N >> M;
  ans = 0;
  int A[M];
  for (int i = 0; i < M; ++i) {
    cin >> A[i];
    ans += A[i];
  }
  if (N - ans < 0) {
    ans = -1;
  } else {
    ans = N - ans;
  }
  printf("%d\n", ans);
}

Measured memory_bytes: 3764
#include<iostream>
#include<vector>
#include<algorithm>
#include<iomanip>
#include<stack>
#include<queue>
#include<string>
using namespace std;
#define rep(i,n) for(int i=0;(i)<(n);(i)++)
#define FOR(i,m,n) for(int i=(m);(i)<(n);(i)++)

int main(){
    string s;
    cin >> s;
    int a=0,b=0,c=0;
    for(int i=0;i<3;i++){
        if(s[i]=='a')a++;
        if(s[i]=='b')b++;
        if(s[i]=='c')c++;
    }
    if(a==1&&b==1&&c==1){
        cout << "Yes" << endl;
        return 0;
    }
    cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
package main

import "fmt"

func main() {
	var n int
	fmt.Scan(&n)
	an := make([]int64, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&an[i])
	}

	var ans, right int
	var sum int64
	for left := 0; left < n; left++ {
		for right < n && (sum+an[right]) == (sum^an[right]) {
			sum += an[right]
			right++
		}

		ans += right - left

		if right == left {
			right++
		} else {
			sum -= an[left]
		}
	}

	fmt.Println(ans)
}


Measured memory_bytes: 5760
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <math.h>

#ifdef _MSC_VER
#pragma warning(disable:4996)
#endif

using namespace std;


int main() {

	int n;

	cin >> n;

	vector<int> a(n+1, 0);

	int tmp;

	for (int i = 1; i < n; i++) {
		cin >> tmp;
		a[tmp]++;
	}

	for (int i = 1; i < n+1; i++) {
		cout << a[i] << "\n";
	}
	return 0;
}


Measured memory_bytes: 4048
/*#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;*/
#include<algorithm>
#include <bits/stdc++.h>
#include<stdio.h>
#include<math.h>
#include<string.h>
#include<stdlib.h>
#include<stdbool.h>
#include<ctype.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define S second
#define F first
#define vi vector<ll>
#define pii pair<ll,ll>
#define bc __builtin_popcountll
#define vvi vector<vi> 
#define vpii vector<pair<ll,ll>>
#define mll unordered_map<ll,ll>
#define INF LONG_LONG_MAX
#define NINF LONG_LONG_MIN
#define f(i,a,b) for(i=a;i<=b;i++)
#define f(i,n) for(ll i=0;i<n;i++)
#define f1(i,n) for(ll i=1;i<=n;i++)
#define fb(i,n) for(ll i=n-1;i>=0;i--)
#define fb1(i,n) for(ll i=n;i>0;i--)
#define endd cout<<'\n';
#define deb(x) cout << #x << "=" << x << endl
#define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
#define fr(it, a) for(auto it = a.begin(); it != a.end(); it++)
#define PI 3.1415926535897932384626
#define clr(x) memset(x, 0, sizeof(x))
#define sortall(x) sort(all(x))
#define all(x) x.begin(), x.end()
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define CASES  ll t;cin>>t;while(t--)
typedef long long ll;
typedef unsigned long long ull;
//typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;
//typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;
//*X.find_by_order()-->returns an iterator to the k-th largest element (counting from zero)
//X.order_of_key()-->the number of items in a set that are strictly smaller than our item.
struct cmp
{
	bool operator() (ll a,ll b){
		return (a>b);
	}
};
ll mod=1000000007;
const ll N=100005;
int main()
{
fast;
    ll d,t,s;
    cin>>d>>t>>s;
    double x=((1.0*d)/t);
    if(x>s)
        cout<<"No";
    else
        cout<<"Yes";
    return 0;
}

Measured memory_bytes: 3608
#include <iostream>
using namespace std;
int main(void){
  int a;
  cin >> a;
  int count =0;
  if(a%10==1) count++;
  a/=10;
  if(a%10==1) count++;
  a/=10;
  if(a%10==1) count++;
  a/=10;
  cout << count;
}

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

long long x;
int main(){
  cin>>x;
  long long ans = 0;
  ans += (x/11) * 2;
  x = x % 11;
  if(0 < x && x <= 6) ans++;
  else if(x > 6) ans += 2;
  cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string s;
  cin >> s;
  int k = 1;
  int sw = 1;
  
  if(s.size() == 1){
    k = 1;
  }else{
  for(int i = 0; i < s.size()-1; i++){
    if(s.at(i) == s.at(i+1) && sw == 1){
      i++;
      if(i >= s.size()-1) break;
      k++;
      sw = 2;
    }else{
      k++;
      sw = 1;
    }
  }
  }
  cout << k << endl;
}


Measured memory_bytes: 640
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cassert>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define rep(i,n) FOR(i,0,n)
#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define vint vector<int>
#define vdouble vector<double>
#define vstring vector<string>
using namespace std;

#include<map>
#include<set>
#include<queue>

typedef long long ll;
typedef unsigned long long ull;

const int MAX_N = 1000000;


class Edge{
public:
	int from, to, cost;
	Edge(int from = 0, int to = 0, int cost = 0) :
		from(from), to(to), cost(cost){}

	bool operator < (const Edge &e) const{
		return cost < e.cost;
	}
	bool operator >(const Edge &e) const{
		return cost > e.cost;
	}

};

static const int INFTY = (1 << 21);

class Node{
public:
	vector<Edge> edges;
	int count;
	Node(){
		count = 0;
	}
};

class Graph{
public:
	vector<Node> nodes;
	Graph(int n) {
		rep(i, n) { Node n;  nodes.push_back(n); }
	}
};


int main() {

	int V, E;
	cin >> V >> E;

	Graph G(V);
	rep(i, E){
		int from, to;
		cin >> from >> to;
		Edge e(from, to, 0);
		G.nodes[from].edges.push_back(e);
		G.nodes[to].count += 1;
	}

	queue<int> Q;
	rep(i, V){
		if (G.nodes[i].count == 0){ 
			Q.push(i); 
			cout << i << endl;
		}
	}

	while (!Q.empty()){
		int i = Q.front(); Q.pop();
		for (auto e : G.nodes[i].edges){
			G.nodes[e.to].count -= 1;
			if (G.nodes[e.to].count == 0){
				Q.push(e.to);
				cout << e.to << endl;
			}
		}
	}

}

Measured memory_bytes: 3984
#include<cstdio>
#include<cstring>
#include<cmath>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<queue>

using namespace std;

using ll=long long;
using vi=vector<int>;
using vvi=vector<vi>;
using pii=pair<int,int>;
using vll=vector<ll>;
using vvll=vector<vll>;
using vpii=vector<pii>;

#define PI 3.1415926535897932384626433832795

int main(void)
{
	int h, n;
	while(scanf("%d%d", &h, &n)==2)
	{
		vi a(n);
		int s=0;

		for(int i=0;i<n;i++)
		{
			scanf("%d", &a[i]);
			s+=a[i];
		}
		bool ans=(s>=h);
		printf("%s\n", ans?"Yes":"No");
	}
	return 0;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
#define rep(i,f,n) for(ll i=(f); (i) < (n); i++)
#define repe(i,f,n) for(ll i=(f); (i) <= (n); i++)
using namespace std;
using ll = long long;
#define MOD (ll)1000000007
#define PI 3.14159265359
#define debug(x) cout<<#x<<" :: "<<x<<"\n";
#define debug2(x,y) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\n";
#define debug3(x,y,z) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\t"<<#z<<" :: "<<z<<"\n";
#define P pair<int, int>
#define Pl pair<ll, ll>
#define dvec vector<vector<ll>>
//printf("%.10f\n")
//cout << fixed << setprecision(10);
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;}
ll INF = 1e+18;
int iINF = 1e9;


int main()
{
  string S; cin >> S;
  reverse(S.begin(), S.end());
  int sz = S.size(); --sz;
  int index = 0;
  vector<string> cand = {"maerd", "remaerd", "resare", "esare"};

  
  for(; index < sz ;){
    if(S.substr(index, cand[0].size()) == "maerd") index += cand[0].size();
    else if(S.substr(index, cand[1].size()) == "remaerd") index += cand[1].size();
    else if(S.substr(index, cand[2].size()) == "resare") index += cand[2].size();
    else if(S.substr(index, cand[3].size()) == "esare") index += cand[3].size();
    else { cout << "NO" << endl;return 0;}
  }

  cout << "YES" << endl;
}

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

int main() {
  string S;
  cin>>S;
  int N=S.size();
  int64_t Z=0,l=0,r=0;
  for(int i=0;i<N;i++){
    if(S.at(i)=='<'){
      if(r!=0){
        Z+=r*(r+1)/2+l*(l+1)/2-min(l,r);
        l=0,r=0;
      }
      l++;
    }
    else{
      r++;
    }
  }
  Z+=r*(r+1)/2+l*(l+1)/2-min(l,r);
  cout<<Z<<endl;
}




Measured memory_bytes: 900
#include <iostream>
#include <set>
#include <queue>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <cstring>
#include <climits>
#include <sstream>
#include <iomanip>
#include <map>
#include <stack>
#include <numeric>
#include <functional>

using namespace std;
#define ALL(x)              (x).begin(),(x).end()
typedef long long           ll;
#define REP(i, n)           for (ll i = 0 ; i < (ll)n ; ++i)
#define REPN(i, m, n)       for (ll i = m ; i < (ll)n ; ++i)
#define INF                 (ll)1e9
#define MOD                 (1000 * 1000 * 1000 + 7)
#define Ceil(x, n)          (((((x))+((n)-1))/n))
#define CeilN(x, n)         (((((x))+((n)-1))/n)*n)
#define FloorN(x, n)        ((x)-(x)%(n))
#define IsOdd(x)            (((x)&0x01UL) == 0x01UL)
#define IsEven(x)           (!IsOdd((x)))
#define M_PI                3.14159265358979323846
typedef pair<ll, ll>	    P;

/*-----------------------------------------------------------------------------
　処理
 -----------------------------------------------------------------------------*/
// 枝定義
struct Edge
{
	ll to;
	ll cost;
	Edge(){}
	Edge(ll to, ll cost) : to(to), cost(cost){}
};

struct queParam
{
	ll v;
	ll cost;
	ll status;
	queParam(ll v, ll cost, ll status) : v(v), cost(cost), status(status){}
	bool operator<(const queParam &a) const {
		return cost > a.cost;
	}
};

// グラフ定義(二次元配列)
template <class E>
using Graph = vector<vector<E>>;

// 拡張ダイクストラ
class ExDijkstra
{
private:
	const ll statusNum = 3;

public:
	// res[i] = sからiまでの最短距離
	const ll InfVal = 1e18;
	vector<vector<ll>> res;

public:
	ExDijkstra(const Graph<Edge> &G, int startPos, ll initStatus)
	{
		int V = (int)G.size();
		res = vector<vector<ll>>(V, vector<ll>(statusNum, InfVal));

		priority_queue<queParam> que;
		que.emplace(startPos, 0, initStatus);
		res[startPos][initStatus] = 0;
		
		while (!que.empty()) {
			queParam qOne = que.top(); que.pop();

			// 違う最短距離がキューにあるのでスキップ
			if (res[qOne.v][qOne.status] < qOne.cost) {
				continue;
			}

			// 最短距離を更新
			for (Edge e : G[qOne.v]) {
				ll nextStatus = (qOne.status + 1) % 3;
				ll &nowCost = res[e.to][nextStatus];
				ll newCost = res[qOne.v][qOne.status] + e.cost;
				if (nowCost > newCost) {
					nowCost = newCost;
					que.emplace(e.to, newCost, nextStatus);
				}
			}
		}
	}
};

int main()
{
	int N, M;
	cin >> N >> M;
	Graph<Edge>	G(N);
	REP(i, M) {
		ll u, v;
		cin >> u >> v;
		u--, v--;
		G[u].emplace_back(Edge(v, 1));
	}

	int S, T;
	cin >> S >> T;
	S--; T--;

	ExDijkstra dijk(G, S, 0);

	ll ans = -1;
	if (dijk.res[T][0] != dijk.InfVal) {
		ans = dijk.res[T][0] / 3;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 11136
use std::cmp::*;
use std::io::*;

fn main() {
    let mut s: String = String::new();
    std::io::stdin().read_to_string(&mut s).ok();
    let mut itr = s.trim().split_whitespace();
    let mut n: usize = itr.next().unwrap().parse().unwrap();

    let mut ans = Vec::new();

    while n > 0 {
        n -= 1;
        ans.push(((n % 26) as u8 + 'a' as u8) as char);
        n /= 26;
    }
    ans.reverse();
    let ans: String = ans.into_iter().collect();
    println!("{}", ans);
}


Measured memory_bytes: 2104
N,M=map(int,input().split())
A=list(map(int,input().split()))
B=[list(map(int,input().split())) for i in range(M)]
C=[[1,a] for a in A]+B
C.sort(key=lambda x:x[1])
ans=0
L=N
while L>0:
  #pop()の末尾削除を使って大きい順から取り出す
  x,y=C.pop()
  #中途半端にLが余ったときは、Lの分のみを足す
  ans+=(min(L,x))*y
  L-=x
print(ans)

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

#include <bits/stdc++.h>
#include<chrono>
#define ll long long
using namespace std;
vector<ll>bit;
ll MOD = 1e9 + 7;
ll A, B, H, N, M, L, K, W, X, Y, Z;
ll ans = 0;

int main() {
	cin >> A >> B;
	cout << A * B + 1 - A - B << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<math.h>
#include<stdlib.h>
#include<string>
#include<limits.h>
#include<utility>
#include<vector>
#include<tuple>
#include<algorithm>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i,n) for(int i=0;i<n;i++)
#define ALL(A) A.begin(),A.end()
vector<vector<bool>> seat;

int main() {
	int a, b, c;
	int k;
	cin >> a >> b >> c;
	cin >> k;
	while (a >= b) {
		b *= 2;
		k--;
	}
	while (b >= c) {
		c *= 2;
		k--;
	}
	if (k >= 0) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}

}

Measured memory_bytes: 3148
#include <bits/stdc++.h>
int main(void)
{
  std::string date;
  std::cin >> date;
  if(date.compare("2019/04/30") > 0)
    std::cout << "TBD" << std::endl;
  else
    std::cout << "Heisei" << std::endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <bitset>
#include <limits.h>

using namespace std;

#define rip(i, n, s) for (int i = (s);i < (int)( n ); i++)
#define all(a) (a).begin(), (a).end()
typedef long long ll;

template<typename T>
void vdeb(vector<T> &da){
    int size=da.size();
    for(int i=0;i<size;i++){
        if(i==size-1){
            cout << da[i] << endl;
        }
        else{
            cout << da[i] << ' ';
        }
    }
}

int main(){
	int n,m;
	cin >> n >> m;
	vector<vector<int>> da(n,vector<int>(n,-1));
	int a,b,c;
	rip(i,m,0){
		cin >> a >> b >> c;
		a--;b--;
		da[a][b]=c;
		da[b][a]=c;
	}
	vector<vector<int>> dp(n,vector<int> (n,INT_MAX));
	rip(i,n,0){
		rip(j,n,0){
			if(i==j){
				dp[i][j]=0;
			}
			else if(da[i][j]==-1){
				dp[i][j]=INT_MAX/2;
			}
			else{
				dp[i][j]=da[i][j];
			}
		}
	}
	rip(k,n,0){
		rip(i,n,0){
			rip(j,n,0){
				dp[i][j] = min(dp[i][k]+dp[k][j],dp[i][j]);
			}
		}
	}
	int ans = 0;
	rip(i,n,0){
		rip(j,n,0){
			if(da[i][j]!=-1  && da[i][j]!=dp[i][j]){
				ans++;
			}
		}
	}
	cout << ans/2 << endl;
}


Measured memory_bytes: 384
#include <iostream>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
using namespace std;


int main()
{
	int x,y;
	cin>>x>>y;
	if(x==2 || y==2)
		printf("No\n");
	else if ( (x==1||x==3||x==5||x==7||x==8||x==10||x==12) && (y==4||y==6||y==9||y==11) )
		printf("No\n");
	else if ((y==1||y==3||y==5||y==7||y==8||y==10||y==12) && (x==4||x==6||x==9||x==11) )
		printf("No\n");
	else 
		printf("Yes\n");
	return 0;
} 


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;


public class Main {
	static int[][] diamond = null;
	static int[][] max = null;
	static int[] tmpMax = null;
	static int height = -1;
	static int width = -1;
	
	public static void main(String[] args) {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		ArrayList<String> array = new ArrayList<String>();

		try {
			String str = null;
			while ((str = br.readLine()) != null && !str.equals("")) {
				array.add(str);
			}
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			try {
				br.close();
			} catch (IOException e) {
				e.printStackTrace();
			}
		}
		width = array.size() / 2 + 1;
		height = array.size();
		diamond = new int[height][width];

		max = new int[height][width];
		
		for(int i = 0; i < height; i++) {
			String s = array.get(i);
			String[] data = s.split(",");
			for(int j = 0; j < data.length; j++) {
				diamond[i][j] = Integer.parseInt(data[j]);
			}
		}
		dfs(1,0,0,0);
		tmpMax = max[height / 2].clone();
		dfs(-1,0,0,0);
		Arrays.sort(max[height / 2]);
		System.out.println(max[height / 2][width - 1]);
	}
	private static void dfs(int plus, int index, int sum, int count) {
		if(count >= (width - 1)) {
			if(plus == 1) {
				max[count][index] = Math.max(sum + diamond[count][index], max[count][index]);
			} else {
				max[height - count - 1][index] = Math.max(sum + tmpMax[index], max[height - count - 1][index]);
			}
			return;
		}
		if(plus == 1) {
			if(max[count][index] > (sum + diamond[count][index])) {
				return;
			}
			max[count][index] = sum + diamond[count][index];
			dfs(plus, index, sum + diamond[count][index], count + 1);
			dfs(plus, index + 1, sum + diamond[count][index], count + 1);
		} else {
			if(max[height - count - 1][index] > (sum + diamond[height - count - 1][index])) {
				return;
			}
			max[height - count - 1][index] =sum + diamond[height - count - 1][index];
			dfs(plus, index, sum + diamond[height - count - 1][index], count + 1);
			dfs(plus, index + 1, sum + diamond[height - count - 1][index], count + 1);
		}
	}
}

Measured memory_bytes: 21712
a, b = map(int, input().split())
rec = 0
len = b - a + 1
if a % 2 == 0:
    if len % 2 == 1:
        if (len - 1) % 4 == 0:
            rec = b
        else:
            rec = 1^b
    else:
        if len % 4 == 0:
            rec = 0
        else:
            rec = 1
else:
    if len % 2 == 0:
        if (len - 2) % 4 == 0:
            rec = a^b
        else:
            rec = a^1^b
    else:
        if (len - 1) % 4 == 0:
            rec = a
        else:
            rec = a^1
print(rec)

Measured memory_bytes: 3064
from operator import itemgetter as ite

n=int(input())
l=[]
name=[]
for i in range(n):
    l.append(list(input().split()))
    name.append(l[i][0])
name=set(name)
name=list(name)
name.sort()

na=len(name)
tmp=99
k=0
ma=0
while k!=na:
    for j in range(len(l)):
        if l[j][0]==name[k]:
            if ma<=int(l[j][1]):
                ma=int(l[j][1])
                out=j
    if tmp==out:
        k+=1
    else:
        print(out+1)
        l[out][1]=-3
    ma=0
    tmp=out
 

Measured memory_bytes: 3064
#include <stdio.h>
#include <string.h>

int x,y;
char s[1005],c[1005],r;

void replace() {
    scanf("%d%d%s",&x,&y,c);
    for(int j=x,k=0;k<y-x+1;j++,k++) s[j]=c[k];
}

void reverse() {
    scanf("%d%d",&x,&y);
    for(int j=x,k=y;j<x+(y-x+1)/2;j++,k--) {
        r=s[j];
        s[j]=s[k];
        s[k]=r;
    }
}

void print() {
    scanf("%d%d",&x,&y);
    for(int i=x;i<=y;i++) printf("%c",s[i]);
    printf("\n");
}



int main () {
    int a;
    scanf("%s%d",s,&a);
    for(;a--;){
        scanf("%s",c);
        if(!strcmp(c,"replace")) replace();
        else if(!strcmp(c,"reverse")) reverse();
        else if(!strcmp(c,"print")) print();
    }
}



Measured memory_bytes: 2100
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii =  pair<int, int>;
using pll =  pair<long long, long long>;
constexpr char ln =  '\n';
constexpr long long MOD = 1000000007LL;
constexpr long long INF = 1000000000LL;
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
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; }

int main(){
    int n, m;
    cin >> n >> m;
    vector<pii> res;
    set<int> st;
    
    int a = 1, b = n;
    rep(i, m){
        int siz = st.size();
        st.insert(b-a);
        st.insert(n+a-b);
        if(st.size() != siz + 2) b--;
        res.push_back(pii(a, b));
        a++; b--;
    }
    rep(i, m){
        cout << res[i].first << " " << res[i].second << ln;
    }

}



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

int n;

int quadrant(int x, int y) {
  if (x > 0 && y >= 0) return 0;
  if (x <= 0 && y > 0) return 1;
  if (x < 0 && y <= 0) return 2;
  return 3;
}

bool cmp(pair<int, int> p, pair<int, int> q) {
  int q1 = quadrant(p.first, p.second);
  int q2 = quadrant(q.first, q.second);
  
  if (q1 != q2) return q1 < q2;
  
  if (q1 == 0 || q1 == 2) {
    p = {abs(p.first), abs(p.second)};
    q = {abs(q.first), abs(q.second)};
  } else {
    p = {abs(p.second), abs(p.first)};
    q = {abs(q.second), abs(q.first)};
  }
  
  return 1LL * p.second * q.first < 1LL * p.first * q.second;
}

int main() {
  vector<pair<int, int>> v;
  scanf("%d", &n);
  
  for (int i = 0; i < n; ++i) {
    int x, y;
    scanf("%d %d", &x, &y);
    if (x == 0 && y == 0) continue;
    
    v.emplace_back(x, y);
  }
  
  sort(v.begin(), v.end(), cmp);
  n = v.size();
  
  double ans = 0;
  for (int i = 0; i < n; ++i) {
    long long curx = 0, cury = 0;
    for (int j = 0; j < n; ++j) {
      curx += v[(i+j) % n].first;
      cury += v[(i+j) % n].second;
      
      ans = max(ans, hypot(curx, cury));
    }
  }
  
  printf("%.18lf\n", ans);
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <tuple>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <numeric>
#include <string.h>
#define rep(i, x) for (int i = 0; i < (int)(x); i++)
#define repn(i, x) for (int i = 1; i <= (int)(x); i++)
#define repr(i, x) for (int i = ((int)(x) - 1); i >= 0; i--)
#define reprn(i, x) for (int i = ((int)(x)); i > 0; i--)
#define all(x) (x).begin(),(x).end()
typedef long long int64;
using namespace std;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const int INF = 1<<29;
const long long INFL = 1e18;
const int MOD = 1000000007;
const int MAX = 210000;

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

//逆元を求める関数
long long fac[MAX], finv[MAX], inv[MAX];
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++) {
      fac[i] = fac[i-1] * i % MOD;
      inv[i] = MOD - inv[MOD%i] * (MOD/i) % MOD;
      finv[i] = finv[i-1] * inv[i] % MOD;
    }
}
//組み合わせ
long long COM (int n, int k) {
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n-k] % MOD) % MOD;
}

void solve() {
		int  n; cin >> n;
		vector<int> ans(n + 1);
		//n - num = iの生徒が登校した時点の残り人数
		//n - (n - num) = 残り人数から登校順を復元
		for (int i = 1; i <= n; ++i) {
			int num; cin >> num;
			ans[n - (n - num)] = i;
		}
		for (int i = 1; i <= n; ++i) {
			cout << ans[i] << endl;
		}
    return;
}

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



Measured memory_bytes: 1152
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007 

ll n,a[26],ans;
void dep(ll now,ll cnt){
	if(cnt==0){
		return;
	}
	cnt%=inf;
	if(now==26){
		ans+=cnt;
		ans%=inf;
		return ;
	}
	dep(now+1,cnt*a[now]);
	dep(now+1,cnt);
}
int main() {
	cin>>n;
	string s;
	cin>>s;
	for(ll i=0;i<n;i++){
		ll now=s[i]-'a';
		a[now]++;
	}
	dep(0,1);
	cout <<ans-1;
	// your code goes here
	return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define rep(i, a, n) for (int i = a; i < n; i++)
#define repr(i, a, n) for (int i = n - 1; i >= a; i--)
using namespace std;
using ll = long long;
using P = pair<int, int>;
template <typename T> void chmin(T &a, T b) { a = min(a, b); }
template <typename T> void chmax(T &a, T b) { a = max(a, b); }

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

  int W, a, b;
  cin >> W >> a >> b;
  int ans = 0;
  if (a + W <= b)
    cout << b - (a + W);
  else if (b + W <= a)
    cout << a - (b + W);
  else
    cout << 0 << endl;
}


Measured memory_bytes: 256
import java.io.PrintWriter
val pw = PrintWriter(System.out)

fun main(args : Array<String>) {
    func()
    pw.flush()
}

fun func() {
    val n = nextInt()

    if (n % 111 == 0) {
        println(n)
        return
    }

    val next = (n / 100) * 111
    if (next > n) {
        println(next)
    } else {
        println(next + 111)
    }
}

fun next() = readLine()!!
fun nextInt() = next().toInt()

fun println(value : Any) {
    pw.println(value)
}

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

int main(){
  string s;
  for(int i=0;i<10;i++){
    cin >> s[i];
  }
  if(s[3]=='7'){
    s[3] = '8';
  }
  for(int i=0;i<10;i++){
    cout << s[i] << "";
  }
 
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<utility>
#include<string>
#include<cmath>
#include<cstring>
#include<queue>
#include<map>
#include<climits>
#include<set>

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
using namespace std;
typedef pair<int, int> pii;
typedef long long int ll;
typedef pair<ll,ll> pll;
int dx[4] = {1,0,0,-1};
int dy[4] = {0,1,-1,0};
#define MOD 1000000007
#define ARRAY_MAX 2005

const int INF = 1e9+7;


int n,z,w;
vector<int> a;
int dp[2][ARRAY_MAX];//dp[turn][i]:= 手番がturnの時、i番目まで選んだ時の最終スコア

int dfs(int turn,int pos,int x,int y){

    if(pos == n){
        return abs(x-y);
    }

    if(dp[turn][pos] != -1){
        return dp[turn][pos];
    }

    int res = 0;//最終スコア
    if(turn == 1){
        //最大化する方
        res = -INF;
        for(int i = pos;i < n;i++){
            res = max(res,dfs(!turn,i+1,a[i],y));//a[i]を選ぶ
        }
        return dp[turn][pos] = res;
    }else{
        //最小化する方
        res = INF;
        for(int i = pos;i < n;i++){
            res = min(res,dfs(!turn,i+1,x,a[i]));//a[i]を選ぶ
        }
        return dp[turn][pos] = res;
    }
}



int main(){

    cin >> n >> z >> w;
    a.resize(n);
    for(int i = 0;i < n;i++){
        cin >> a[i];
    }

    memset(dp,-1,sizeof(dp));

    int ans = dfs(1,0,z,w);

    /*for(int i = 0;i < 2;i++){
        for(int j = 0;j <= n;j++){
            cout << dp[i][j] << " ";
        }
        cout << endl;
    }*/
    cout << ans << endl;

    return 0;
}

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

//atcoder126
int main() {
  int N, K;
  string S;
  string ans;

  cin >> N >> K >> S;

  if(S.at(K-1) == 'A') S.at(K-1) = 'a';
  if(S.at(K-1) == 'B') S.at(K-1) = 'b';
  if(S.at(K-1) == 'C') S.at(K-1) = 'c';

  cout << S;


  }


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

using namespace std;
#define inputInt(a) int a; cin >> a; 
#define inputInt2(a,b) int a; int b; cin >> a >> b; 
#define inputInt3(a,b,c) int a; int b; int c; cin >> a >> b >> c;
#define inputLong(a) long a;cin >> a; 
#define inputIntArray(a,N) int a[N];for(int i=0;i<N;i++){cin >> a[i];}
#define inputLongArray(a,N) long a[N];for(int i=0;i<N;i++){cin >> a[i];}
#define inputIntArray2(a,b,N) int a[N]; int b[N]; for(int i=0;i<N;i++){cin >> a[i] >> b[i];}
#define output(answer) cout << answer << endl;
#define fN(i,N)    for(int i=0; i<N; i++)
#define fSE(i,s,e) for(int i=s; i<=e; i++)
#define ll long long
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define FOR(i,N) for(int i=0; i<N; i++)
#define cinv(v,N) vector<int> v(N); for(int i=0; i<N; i++){ cin >> v[i]; }
#define mt make_tuple
const ll MOD2 = 998244353;
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; }

int main()
{
  //input
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  int N; int K; string s;
  cin >> N >> K >> s;
  ll L = 0;
  
  //main
  for(int i=0; i<N-1; i++){
    if(s[i] != s[i+1]){ L ++; }
  }
  
  // output
  if(L >= 2*K){cout << (N-1)-(L-2*K) << endl;}
  else{cout << N-1 << endl;}

  return 0;
}

Measured memory_bytes: 512