akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

#define REP(i, n) for(int i=0; i<(n); ++i)
#define FOR(i, a, b) for(int i=(a); i<(b); ++i)
#define FORR(i, a, b) for(int i=(b)-1; i>=(a); --i)

#define DEBUG(x) cout<<#x<<": "<<(x)<<'\n'
#define DEBUG_VEC(v) cout<<#v<<":";REP(i, v.size())cout<<' '<<v[i];cout<<'\n'
#define ALL(a) (a).begin(), (a).end()

template<typename T> inline void CHMAX(T& a, const T b) {if(a<b) a=b;}
template<typename T> inline void CHMIN(T& a, const T b) {if(a>b) a=b;}

constexpr ll MOD=1000000007ll;
// constexpr ll MOD=998244353ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

const double EPS=1e-11;
#define EQ0(x) (abs((x))<EPS)
#define EQ(a, b) (abs((a)-(b))<EPS)

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	// cout<<setprecision(10)<<fixed;
	int n, d[125252];
	cin>>n;
	REP(i, n){
		cin>>d[i];
	}
	sort(d, d+n);
	int x=d[n/2-1], y=d[n/2];
	cout<<y-x<<'\n';
	return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <utility>
#include <cmath>
#include <functional>
#include <queue>
#define REP(i,n) for(ll i=0;i<n;i++)
#define FOR(i,n1,n2) for(ll i=n1;i<n2;i++)
#define put(a) cout<<a<<endl;
using namespace std;
typedef long long ll;
const ll INF = 9223372036854775807-1;
const int inf = 2147483647-1;

int n;
int a[100];
int main() {
    cin >> n;
    REP(i,n){
        cin >> a[i];
    }
    int res = 0;
    int cnt = 1;
    REP(i,n+1){
        if(a[i]!=a[i-1]){
            res += cnt/2;
            cnt=1;
        }else if(a[i]==a[i-1]){
            cnt++;
        }
        //put(cnt);
    }
    put(res);
    return 0;
}


Measured memory_bytes: 256
//#pragma GCC optimize("O3")
#include<bits/stdc++.h>
#define ll long long int
#define ld long double
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);
#define all(x) x.begin(),x.end()
#define F first
#define S second
#define fo(i,n) for(int i=0;i<(n);i++)
#define inp(a) int a;cin>>a;
#define inpa(a,n)vector<int> a(n);fo(i,n)cin>>a[i];
#define printclock cerr<<"Time : "<<1000*(ld)clock()/(ld)CLOCKS_PER_SEC<<"ms\n";
using namespace std;
#define int ll
// #define MAX 20
#define INF (int)1e18

template<class T> ostream& operator<<(ostream& cout,vector<T> V)
{cout<<"[ ";for(auto v:V)cout<<v<<' ';return cout<<']';}
template<class L,class R> ostream& operator<<(ostream& cout,pair<L, R> P)
{return cout<<'('<<P.F<<','<< P.S<<')';}


signed main()
{
	fio
	ld a,b;
	cin>>a>>b;
	int ans=a*b;
	cout<<ans<<'\n';
	printclock;
}

Measured memory_bytes: 3808
# -*- coding: utf-8 -*-
"""
A - Fifty-Fifty
https://atcoder.jp/contests/abc132/tasks/abc132_a

"""
import sys


def solve(s):
    return 'Yes' if all([s.count(ch) == 2 for ch in s]) else 'No'


def main(args):
    s = input()
    ans = solve(s)
    print(ans)


if __name__ == '__main__':
    main(sys.argv[1:])


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

using namespace std;

long long prime = 1000000007;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int H, W, K;
    cin >> H >> W >> K;
    int N = 20;
    vector<long long> fib(N, 0);
    fib[0] = 1;
    fib[1] = 1;
    for (int i = 2; i < N; ++i) {
        fib[i] = (fib[i-1] + fib[i-2]) % prime;
    }
    vector<long long> u(W, 0LL);
    u[0] = 1LL;
    for (int i = 0; i < H; ++i) {
        vector<long long> v(W, 0LL);
        for (int j = 0; j < W; ++j) {
            // 0 .. j-1 NO j NO j+1 .. W-1
            v[j] += fib[j] * fib[W-j-1] % prime * u[j] % prime;
            // 0 .. j-2 NO j-1 YES j NO j+1 .. W-1
            if (j > 0) {
                v[j-1] += fib[j-1] * fib[W-j-1] % prime * u[j] % prime;
            }
            // 0 .. j-1 NO j YES j+1 NO j+2 .. W-1
            if (j < W-1) {
                v[j+1] += fib[j] * fib[W-j-2] % prime * u[j] % prime;
            }
        }
        for (int j = 0; j < W; ++j) {
            u[j] = v[j] % prime;
            // cerr << u[j] << " ";
        }
        // cerr << endl;
    }
    cout << u[K-1] << endl;
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <algorithm>
#include <assert.h>
#include <bitset>
#include <cmath>
#include <complex>
#include <deque>
#include <functional>
#include <iostream>
#include <limits.h>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <time.h>
#include <unordered_map>
#include <unordered_set>
#include <vector>

#pragma warning(disable:4996)
#pragma comment(linker, "/STACK:336777216")
using namespace std;

#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define ldb ldouble

typedef tuple<int, int, int> t3;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ldb;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef pair <ll, int> pli;
typedef pair <db, db> pdd;

int IT_MAX = 1 << 18;
int MOD = 1000000007;
const int INF = 0x3f3f3f3f;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;
const db PI = acos(-1);
const db ERR = 1e-10;
#define szz(x) (int)(x).size()
#define rep(i, n) for(int i=0;i<n;i++)
#define Se second
#define Fi first

const int MX = 1<<17;
const int MM = 1000000007;

t3 D[MX];

int main()
{
	int N, a, b;
	scanf("%d", &N);
	for(int i = 1; i <= N; i++){
		scanf("%d%d", &a, &b);
		D[i] = t3(a, b, 1);
	}
	for(int i = 1; i <= N; i++){
		scanf("%d%d", &a, &b);
		D[i+N] = t3(a, b, -1);
	}
	sort(D+1, D+N*2+1);
	set<int> L;
	int ans = 0;
	for(int i = 1; i <= 2*N; i++){
		int a, b, c;
		tie(a, b, c) = D[i];
		if(c == 1) L.insert(b);
		else{
			auto it = L.lower_bound(b);
			if(it != L.begin()) ans++, L.erase(prev(it));
		}
	}
	printf("%d\n", ans);
}


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

const int N = 1e5 + 5;
pair< int, int> p[N];
vector< int> conn[N];
vector< int> sum[N];

int C(int a, int b) {
    int rv = 0;
    rv += abs(p[a].first - p[b].first);
    rv += abs(p[a].second - p[b].second);
    return rv;
}

int main() {
    int n, m, d;
    cin >> n >> m >> d;
    for (int i = 1; i <= n; ++i)
        for (int j = 1; j <= m; ++j) {
            int x; scanf("%d", &x);
            p[x] = {i, j};
        }

    for (int i = 1; i <= n * m; ++i) {
        conn[i % d].emplace_back(i);
    }
        
    for (int i = 0; i < d; ++i) {
        sum[i].emplace_back(0);
        for (int j = 1; j < (int) conn[i].size(); j++) {
            sum[i].emplace_back(C(conn[i][j], conn[i][j - 1]));
            sum[i].back() += sum[i][j - 1];
        }
    }

    int q;
    scanf("%d", &q);
    while (q--) {
        int a, b;
        cin >> a >> b;
        int res = 0;
        int r = lower_bound(conn[b % d].begin(), conn[b % d].end(), b) - conn[b % d].begin();
        int l = lower_bound(conn[b % d].begin(), conn[b % d].end(), a) - conn[b % d].begin();
        res += sum[b % d][r] - sum[b % d][l];
        printf("%d\n", res);
    }
}

Measured memory_bytes: 11392
/*************************************************************************
>>> Author: WindCry1
>>> Mail: lanceyu120@gmail.com
>>> Website: https://windcry1.com
>>> Date: 12/20/2019 2:28:02 AM
*************************************************************************/
#include <cstring>
#include <cmath>
#include <cstdio>
#include <cctype>
#include <cstdlib>
#include <ctime>
#include <vector>
#include <iostream>
#include <string>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <complex>
#include <stack>
#include <bitset>
#include <iomanip>
#include <list>
#include <sstream>
#include <fstream>
#if __cplusplus >= 201103L
#include <unordered_map>
#include <unordered_set>
#endif
#define ll long long
#define ull unsigned long long
#define DEBUG(x) cout<<#x<<" : "<<x<<endl;
#define lowbit(x) x&(-x)
#define ls(u) u<<1
#define rs(u) u<<1|1
using namespace std;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const double clf = 1e-8;
const int MMAX = 0x7fffffff;
const int INF = 0x3f3f3f3f;
const ll mod = 1e9+7;
const int dir[4][2]={-1,0,1,0,0,-1,0,1};
ostream& operator <<(ostream &out, pii &p){
	return out<<p.first<<" "<<p.second;
}
istream& operator >>(istream &in, pii &p){
	return in>>p.first>>p.second;
}
int cnt[70];
int main(){
	ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
	//ifstream cin("C:\\Users\\LENOVO\\Desktop\\in.txt");
	//ofstream cout("C:\\Users\\LENOVO\\Desktop\\out.txt");
	ll n,t;cin>>n;
	for(int i=0;i<n;i++) {
		cin>>t;
		for(int j=0;j<62;j++){
			cnt[j]+=t&(1LL<<j)?1:0;
		}
	}
	ll res=0;
	for(int i=0;i<62;i++){
		res=(res+(((cnt[i]%mod*((n-cnt[i])%mod))%mod)*((1LL<<i)%mod))%mod)%mod;
	}
	cout<<res%mod<<endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define fs first
#define sc second
typedef pair<ll, ll> l_l;
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

int main(){
  int h,w;
  cin>>h>>w;
  char a[h+2][w+2];
  rep(i,h){
    rep(j,w){
      cin>>a[i+1][j+1];
    }
  }
  rep(i,w+2)a[0][i]='#';
  rep(i,w+2)a[h+1][i]='#';
  rep(i,h+2)a[i][0]='#';
  rep(i,h+2)a[i][w+1]='#';
  rep(i,h+2){
    rep(j,w+2){
      cout<<a[i][j];
    }
    cout<<endl;
  }
  
}

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

using namespace std;
using namespace __gnu_pbds;

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
typedef tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_multi_set;

#define mod         1000000007
#define pi          acos(-1.0)
#define eps         1e-9


#define fast       ios::sync_with_stdio(0); cin.tie(0);cout.tie(0)
#define fs          first
#define sc          second
#define pb         push_back
#define sp          printf(" ")
#define nl          '\n'
#define all(a) a.begin(),a.end()
#define unique(c) (c).resize(unique(all(c)) - (c).begin())
#define itn int

#define set0(a)     memset(a,0,sizeof(a))
#define setneg(a)   memset(a,-1,sizeof(a))
#define setinf(a)   memset(a,126,sizeof(a))

#define REP(i,start,end) for (int i = start; i <=end; i++)
#define RREP(i,end,start) for (int i=end; i>=start ;i--)

typedef long long LL;
typedef long double LD;
typedef unsigned long long ULL;
typedef pair<int, int> pii;
typedef pair<LL, LL> pll;
typedef pair<double, double> pdd;
typedef vector<int> vi;
typedef vector<LL> vll;
typedef vector<double> vd;
typedef vector<vector<LL> > matrix;
typedef vector<vector<int> > graph;
LL INF=1e9;

int dp[3005][3005],dp2[3005][3005];
int n,m;
string s,t;

int func(int i,int j)
{
    if(i==n or j==m)
        return 0;
    int &r=dp[i][j];
    if(r!=-1)
        return r;
    if(s[i]==t[j])
    {
        dp2[i][j]=3;
        return r=1+func(i+1,j+1);
    }
    int ans1=func(i+1,j);
    int ans2=func(i,j+1);
    if(ans1>ans2)
    {
        dp2[i][j]=1;
        return r=ans1;
    }
    dp2[i][j]=2;
    return r=ans2;
}

void solve()
{
    setneg(dp);
    setneg(dp2);
    cin>>s>>t;
    n=s.size();
    m=t.size();
    func(0,0);
    int x=dp2[0][0];
    int i=0;
    int j=0;
    while(i<n and j<m)
    {
        int x=dp2[i][j];
        if(x==3)
        {
            cout<<s[i];
            i++;
            j++;
        }
        else if(x==1)
            i++;
        else
            j++;
    }
    cout<<nl;
}
int main()
{
    fast;
        solve();
}


Measured memory_bytes: 71040
#include<bits/stdc++.h>
using namespace std;
long long gcd(long long a,long long b){
	if(a%b==0){
		return b;
	}
	return gcd(b,a%b);
}
int main(){
	long long a,b;
	cin>>a>>b;
	cout<<a*b/gcd(a,b);
	return 0;
}

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

int main(void) {
    int x1, x2, y1, y2, a, b;

    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> x1 >> x2 >> y1 >> y2;
    a = y1 - x1;
    b = y2 - x2;
    cout << y1 - b << " " << y2 + a << " " << x1 - b << " " << x2 + a << "\n";
    return 0;
}

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

using namespace std;
using ll = long long;
using ld = long double;

#define int long long
signed main(){
//int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin >> n;
    vector<int> a(n);
    for(int i = 0; i < n; i++) {
        cin >> a[i];
    }
    int ans=0;
    int cnt=0;
    for(int i = 0; i < n; i++) {
        if(a[i]==0){
            ans+=cnt/2;
            cnt=0;
        }
        cnt+=a[i];
    }
    ans+=cnt/2;
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 3956
using AtCoderBeginnerContest151.Questions;
using AtCoderBeginnerContest151.Extensions;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;

namespace AtCoderBeginnerContest151.Questions
{
    public class QuestionA : AtCoderQuestionBase
    {
        public override IEnumerable<object> Solve(TextReader inputStream)
        {
            yield return (char)(inputStream.ReadLine()[0] + 1);
        }
    }
}


namespace AtCoderBeginnerContest151
{
    class Program
    {
        static void Main(string[] args)
        {
            IAtCoderQuestion question = new QuestionA();    // 問題に合わせて書き換え
            var answers = question.Solve(Console.In);
            foreach (var answer in answers)
            {
                Console.WriteLine(answer);
            }
        }
    }
}

#region Base Classes

namespace AtCoderBeginnerContest151.Questions
{

    public interface IAtCoderQuestion
    {
        IEnumerable<object> Solve(string input);
        IEnumerable<object> Solve(TextReader inputStream);
    }

    public abstract class AtCoderQuestionBase : IAtCoderQuestion
    {
        public IEnumerable<object> Solve(string input)
        {
            var stream = new MemoryStream(Encoding.Unicode.GetBytes(input));
            var reader = new StreamReader(stream, Encoding.Unicode);

            return Solve(reader);
        }

        public abstract IEnumerable<object> Solve(TextReader inputStream);
    }

}

#endregion

#region Extensions

namespace AtCoderBeginnerContest151.Extensions
{
    internal static class TextReaderExtensions
    {
        internal static int ReadInt(this TextReader reader) => int.Parse(ReadString(reader));
        internal static long ReadLong(this TextReader reader) => long.Parse(ReadString(reader));
        internal static double ReadDouble(this TextReader reader) => double.Parse(ReadString(reader));
        internal static string ReadString(this TextReader reader) => reader.ReadLine();

        internal static int[] ReadIntArray(this TextReader reader, char separator = ' ') => ReadStringArray(reader, separator).Select(int.Parse).ToArray();
        internal static long[] ReadLongArray(this TextReader reader, char separator = ' ') => ReadStringArray(reader, separator).Select(long.Parse).ToArray();
        internal static double[] ReadDoubleArray(this TextReader reader, char separator = ' ') => ReadStringArray(reader, separator).Select(double.Parse).ToArray();
        internal static string[] ReadStringArray(this TextReader reader, char separator = ' ') => reader.ReadLine().Split(separator);
    }
}

#endregion

Measured memory_bytes: 13140
#include <bits/stdc++.h>
#define rep(i,n)for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
const long long INF = 1LL<<60;

int main () {
    int n;cin>>n;
    vector<ll> h(n);
    rep(i,n) cin>>h[i];

    h.push_back(1000000001);

    vector<int> vec;
    
    int count=0;
    for (int i=0;i<n;i++) {
        if (h[i]>=h[i+1]) {
            count++;
        }
        else {
            vec.push_back(count);
            count=0;
        }
    }

    sort(vec.begin(),vec.end());
    cout<<vec[vec.size()-1]<<endl;

}

Measured memory_bytes: 1904
import sys

def is_password(s, p):
    check = s.find(p[0])
    idx = check + 1
    if check == -1:
        return False
    check = s[idx:].find(p[1])
    if check == -1:
        return False
    idx = idx + check + 1
    check = s[idx:].find(p[2])
    if check == -1:
        return False
    return True

f = sys.stdin
n = int(f.readline())
s = f.readline()[:-1]

count = 0
for l1 in range(10):
    for l2 in range(10):
        for l3 in range(10):
            p = str(l1) + str(l2) + str(l3)
            if is_password(s, p):
                count += 1

print(count)

Measured memory_bytes: 3064
#include<iostream>
#include<bits/stdc++.h>
using namespace std;
#define pi 3.1415926535898
#define ll long long
#define int long long
typedef std::pair<long long,long long> pll;
typedef std::pair<int,int> pii;
typedef std::vector<int> vi;
typedef std::vector<long long> vll;
typedef double db;
const ll mod=1e9+7;
ll powmod(ll a,ll b,ll p){ll res=1;a%=p;while(b){if(b&1) res=res*a%p;a=a*a%p;b>>=1;}return res;}
ll gcd(ll a,ll b) {return b?gcd(b,a%b):a;}
signed main()
{
    int t=1;
    //cin>>t;
    while (t--){
        vi t(5);
        int res;
        for (int i = 0; i <5 ; ++i) {
            cin>>t[i];
            if(t[i]==0) res =i;
        }
        cout<<res+1<<endl;
    }
}

Measured memory_bytes: 3544
#include <algorithm>
#include <array>
#include <assert.h>
#include <chrono>
#include <bitset>
#include <deque>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <numeric>
#include <random>
#include <queue>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<bool> vb;
typedef vector<string> vs;
typedef vector<ld> vld;
typedef vector<vector<int>> vvi;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<vector<ld>> vvld;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef vector<pll> vpll;

#ifdef OLBOEB
mt19937 rnd(228 + 1488 + 238 + 24111997 % 322);
#else
mt19937 rnd(chrono::high_resolution_clock::now().time_since_epoch().count());
#endif

void print_time() {
#ifdef OLBOEB
    cout.flush();
    cerr << "\ntime: " << clock() * 1.0 / CLOCKS_PER_SEC << endl;
#endif
}

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define sz(x) ((ll)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

template<class T1, class T2>
ostream& operator<< (ostream &out, pair<T1, T2> pair) { return out << "(" << pair.first << ", " << pair.second << ")";}
template<class T> ostream& operator<<(ostream& out, vector<T> vec) { out<<"("; for (auto& v: vec) out<<v<<", "; return out<<")"; }
template<class T> ostream& operator<<(ostream& out, set<T> vec) { out<<"("; for (auto& v: vec) out<<v<<", "; return out<<")"; }
template<class L, class R> ostream& operator<<(ostream& out, map<L, R> vec) { out<<"("; for (auto& v: vec) out<<v<<", "; return out<<")"; }

const ll MOD = 998244353;
ll binpow(ll a, ll n) {
    ll res = 1;
    while (n) {
        if (n & 1) { res *= a; res %= MOD; }
        a *= a;
        a %= MOD;
        n >>= 1;
    }
    return res % MOD;
}

ll inv(ll x) { return binpow(x, MOD - 2); }

void add(ll& x, ll y) { x += y; if (x >= MOD) x -= MOD; }
void take(ll& x, ll y) { x -= y; if (x < 0) x += MOD; }

ll sum(ll a, ll b) { add(a, b); return a; }
ll sub(ll a, ll b) { take(a, b); return a; }
ll mul(ll x, ll y) { return (x * y) % MOD; }
ll rat(ll x, ll y) { assert(y); return mul(x, inv(y)); }

ll fact(ll a) {
    ll ans = 1;
    for (ll i = 2; i <= a; ++i) {
        ans *= i;
        ans %= MOD;
    }
    ans %= MOD;
    return ans;
}



int main() {
    cout << fixed << setprecision(20);
    ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);

    ll n;
    cin >> n;
    vl d(n);
    vl cnt(n + 1);
    ll maxd = 0;
    for (ll i = 0; i < n; ++i) {
        cin >> d[i];
        ++cnt[d[i]];
        maxd = max(maxd, d[i]);
    }

    if (cnt[0] != 1 || d[0] != 0) {
        cout << 0 << endl;
        return 0;
    }

    ll ans = 1;
    for (ll i = 0; i + 1 <= maxd; ++i) {
        ans = mul(ans, binpow(cnt[i], cnt[i + 1]));
    }

    cout << ans << endl;
    

    print_time();
    return 0;
}


Measured memory_bytes: 1792
#include<iostream>
#include<string>
using namespace std;
string a;
int main()
{
	cin>>a;
	int l=a.size(),s=0;
	for(int i=0;i<l;i++)
	{
		if(a[i]=='C')s=1;
		if(a[i]=='F'&&s==1)
		{
			cout<<"Yes"<<endl;
			return 0;
		}
	}
	cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i=0;i<(n);++i)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define all(x) (x).begin(), (x).end()
#define PI 3.14159265358979323846264338327950L
using namespace std;
typedef long long ll;
typedef long double ld;
int main() {
    ll n,k,cnt=0;
    cin>>n>>k;
    while(n>0){
        n=n/k;
        cnt++;
    }
    cout<<cnt;
}

Measured memory_bytes: 3584
#include <iostream>
#include <algorithm>
#include <queue>
#include <vector>
using namespace std;
typedef long long ll;
typedef struct pair<ll,ll> P;

//1. dp,変数
int n,m;
ll c;
//2. 道（辺）と都市（頂点）
vector<P> road[100001];
ll d[200001]={};
ll dp[100001]={};
ll dp2[100001]={};


int main() {
	//3. 入力
	string str;
	cin>>str;
	cout <<str[0]<<str[1]<<str[2]<<str[3]<<str[4]<<" "<<str[6]<<str[7]<<str[8]<<str[9]<<str[10]<<str[11]<<str[12]<<" "<<str[14]<<str[15]<<str[16]<<str[17]<<str[18]<< endl;
	return 0;
}


Measured memory_bytes: 3712
#include <cstdio>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <cstring>
#include <vector>
#include <array>
#include <map>
using namespace std;

#define IS_POWER_TWO(x) (!(x & (x-1))) 


int main()
{
	char str[100002];
	scanf("%s", str);
	for (int i = 0; strlen(str)-1 > i; i++) {
		if (str[i] == str[i + 1]) {
			printf("%d %d\n", i+1, i+2);
			return 0;
		}
		else if (str[i] == str[i+2]) {
			printf("%d %d\n", i+1, i+3);
			return 0;
		}
	}

	printf("-1 -1\n");
	
	return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
using vi=vector<int>;
using vvi=vector<vi>;
using vs=vector<string>;
using msi=map<string,int>;
using mii=map<int,int>;
using pii=pair<int,int>;
using vlai=valarray<int>;
using ll=long long;
#define rep(i,n) for(int i=0;i<n;i++)
#define range(i,s,n) for(int i=s;i<n;i++)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define fs first
#define sc second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define INF 1e9
#define EPS 1e-9
void bulk(){}template<class H,class...T>void bulk(H&h,T&...t){cin>>h;bulk(t...);}
#define get(...) int __VA_ARGS__; bulk(__VA_ARGS__);

int f(int x){
    if(x>0)return 1;
    if((-x)%2==0) return 1;
    return -1;
}

int main(){
	get(a,b);
	if(a==0 || b==0 ||(a<0&&0<b)){cout<<"Zero"<<endl;return 0;}
	if(a>0)cout<<"Positive"<<endl; 
	else if((-a+b)%2==1)cout<<"Positive"<<endl; 
	else cout<<"Negative"<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define chmin(a, b) ((a)=min((a), (b)))
#define chmax(a, b) ((a)=max((a), (b)))
#define fs first
#define sc second
#define eb emplace_back
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;

const ll MOD=1e9+7;
const ll INF=1e18;

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

int main(){
    int n; cin>>n;
    vector<ll> a(n), b(n);
    ll asum=0, bsum=0;
    for(int i=0; i<n; i++){
        cin>>a[i];
        asum+=a[i];
    }
    for(int i=0; i<n; i++){
        cin>>b[i];
        bsum+=b[i];
    }

    if(asum<bsum){
        cout << -1 << endl;
        return 0;
    }

    ll lsum=0;
    int ans=0;
    vector<ll> rest(n);
    for(int i=0; i<n; i++){
        if(a[i]<b[i]){
            lsum+=b[i]-a[i];
            ans++;
        }
        else{
            rest[i]=a[i]-b[i];
        }
    }

    sort(rest.begin(), rest.end(), greater<ll>());


    for(int i=0; i<n; i++){
        if(lsum<=0) break;
        lsum-=rest[i];
        ans++;
    }
    cout << ans << endl;
}

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

#define MAX_N 500005

int main(void)
{
    int b;
    while (scanf("%d", &b)) {
        if (b == 0) return 0;
        int n = MAX_N - 1;
        int a;
        for (; n > 0; n--) {
            bool flag = false;
            a = b / n - (n - 1) / 2;
            for (int i = -1; i <= 1; i++) {
                int l = a + i;
                if (l > 0 && (2 * l + n - 1) * n == b * 2) {
                    a = l;
                    flag = true;
                    break;
                }
            }
            if (flag) break;
        }
        printf("%d %d\n", a, n);
    }
}



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

int main() {
  int n, counter = 0; cin >> n;
  int a[110];
  for(int i = 0; i < n; i++) cin >> a[i];

  //--- Babble Sort ---//
  bool flag = true;
  for(int i = 0; flag; i++) {
    flag = false;
    for(int j = n-1; j > i; j--) {
      if(a[j] < a[j-1]) {
        swap(a[j], a[j-1]);
        counter++;
        flag = true;
      }
    }
  }

  for(int i = 0; i < n; i++) cout << a[i] << (i == n-1 ? "\n" : " ");
  cout << counter << endl;
}



Measured memory_bytes: 3104
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace _1532
{
    class Program
    {
        static void Main(string[] args)
        {
            string N = Console.ReadLine();
            string s = Console.ReadLine();
            int n = int.Parse(N);
            int a=0;
            for (int i = 1; i< n; i++ )
            {
                if(s[i]!=s[i-1])
                {
                    a++;
                    i++;
                }
            }
            Console.WriteLine(a);
        }
    }
}



Measured memory_bytes: 20028
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp> // Common file
#include<ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
using namespace std;
using namespace __gnu_pbds;
#define ll long long
#define pp pair<ll,ll>
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin() , (x).end()
#define rep(i,a,b) for( ll i = a ; i < b ; i+=1 )
#define sz(v) (ll)(v.size())
#define hell (ll)998244353
#define slld(x) scanf("%lld",&x)
typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> oset;
#define ld long double
ll t = 1, tt;
inline ll add(ll x,ll y){x+=y;return x%hell;}
inline ll mult(ll x,ll y){x%=hell;y%=hell;return (x*y)%hell;}
inline ll powMod(ll base,ll expo){
	ll ans=1;
	expo%=(hell-1);
	while(expo){
		if(expo&1)ans=mult(ans,base);
		base=mult(base,base);
		expo>>=1;
	}
	return ans;
}
void solve(){
	ll n;
	cin>>n;
	map<ll,ll> cnt;
	rep(i,1,n){
		ll x;
		cin>>x;
		cnt[x]++;
	}
	rep(i,1,n+1){
		if(i>1)cout<<"\n";
		cout<<cnt[i];
	}
}
signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
	//cin>>t;
	tt=t;
    while(t--){
        solve();
        if(t!=0)cout<<"\n";
    }
    return 0;
}


Measured memory_bytes: 16124
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <random>
#include <bitset>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
#define rep(i,n) for (int i=0; i<n;++i)
using namespace std;
int N;
int c[100005];
vector<pair<int, int> > g[100005];

void dfs(int u, int p, int o){
  c[u] = o;
  for(pair<int, int> v: g[u]){
    if (v.first != p) dfs(v.first, u, (o+v.second)%2);
  }
}

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

  cin >> N;
  rep(i, N-1){
    int u,v,w;
    cin >> u >> v >> w;
    w%=2;
    pair<int, int> a = make_pair(v,w);
    g[u].push_back(a);
    pair<int, int> b = make_pair(u,w);
    g[v].push_back(b);
  }

  dfs(1,0,0); // 1始まりなので。
  for(int i=1; i <=N; i++) cout << c[i] << endl;

  return 0;
}

Measured memory_bytes: 8448
#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define erep(i,a,n) for(int i = a;i<=n;i++)
typedef long long ll;
#define int long long
#define vint vector<int>
#define vvint vector<vector<int>>
#define vstring vector<string>
#define vdouble vector<double>
#define vll vector<ll>:
#define vbool vector<bool>
#define INF 1101010101010101010
#define MOD 1000000007
#define P pair<int,int>
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }

signed main(){
  int t1,t2,a1,a2,b1,b2;
  cin >> t1 >> t2 >> a1 >> a2 >> b1 >> b2;
  a1 *= t1;
  a2 *= t2;
  b1 *= t1;
  b2 *= t2;
  a2 += a1;
  b2 += b1;
  if(a2 == b2){
    cout << "infinity" << endl;
    return 0;
  }
  if(a2 < b2){
    swap(a1,b1);
    swap(a2,b2);
  }
  int c = b1 - a1;
  int d = a2 - b2;
  int ans = 0;
  if(c > 0){
    ans = (c-1)/d + 1;
    ans *= 2;
    ans--;
    if(c % d == 0) ans++;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.*;
 
public class Main {
 
    void solve() throws IOException {
        int K = ni();
        int count = 0;
        int val = 7;
        for (int i = 1; i <= K; i++) {
            if(val % K==0){
                count = i;
                break;
            } 
            val = (val * 10 +7) % K;
        }
        if(count == 0){
            out.println(-1);
        }else{
            out.println(count);
        }
    }

    final int mod = 1000000007;
    final BigInteger MOD = BigInteger.valueOf(mod);
    int mul(int x, int y){
        int val = (int)((x * 1L * y) % mod);
        return val>=0 ? val : val+mod;
    }
    int add(int x, int y) {
        x += y;
        if(x < 0) x += mod;
        if(x>=mod) x -= mod;
        return x;
    }
    int sub(int x, int y){
        x = add(x,mod-y);
        if(x < 0) x += mod;
        if(x>=mod) x -= mod;
        return x;
    }
    String ns() throws IOException {
        while (!tok.hasMoreTokens()) {
            tok = new StringTokenizer(in.readLine(), " ");
        }
        return tok.nextToken();
    }
 
    int ni() throws IOException {
        return Integer.parseInt(ns());
    }
 
    long nl() throws IOException {
        return Long.parseLong(ns());
    }
 
    double nd() throws IOException {
        return Double.parseDouble(ns());
    }
 
    String[] nsa(int n) throws IOException {
        String[] res = new String[n];
        for (int i = 0; i < n; i++) {
            res[i] = ns();
        }
        return res;
    }
 
    int[] nia(int n) throws IOException {
        int[] res = new int[n];
        for (int i = 0; i < n; i++) {
            res[i] = ni();
        }
        return res;
    }
 
    long[] nla(int n) throws IOException {
        long[] res = new long[n];
        for (int i = 0; i < n; i++) {
            res[i] = nl();
        }
        return res;
    }
 
    static BufferedReader in;
    static PrintWriter out;
    static StringTokenizer tok;
 
    public static void main(String[] args) throws IOException {
        in = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
        tok = new StringTokenizer("");
        Main main = new Main();
        main.solve();
        out.close();
    }
}

Measured memory_bytes: 33252
#include <bits/stdc++.h>
#define WHOLE(v) (v).begin(), (v).end()
using i64 = int64_t;
using namespace std;
int main() {
    int N;
    cin >> N;
    map<i64, i64> m;
    for(int i = 0; i < N; i++) {
        i64 a;
        cin >> a;
        if(!m.count(a)) {
            m[a] = 0;
        }
        m[a]++;
    }
    vector<i64> v;
    for(auto x : m) {
        v.push_back(x.first);
    }
    if(v.size() > 3) {
        cout << "No" << endl;
    } else if(v.size() == 3) {
        if( (v[0] ^ v[1]) == v[2] &&
            m[v[0]] == m[v[1]] && m[v[1]] == m[v[2]] && m[v[2]] == m[v[0]]) {
            cout << "Yes" << endl;
        } else {
            cout << "No" << endl;
        }
    } else if(v.size() == 2) {
        if ((v[0] == 0 && m[v[1]] == 2 * m[v[0]]) ||
            (v[1] == 0 && m[v[0]] == 2 * m[v[1]]) ) {
            cout << "Yes" << endl;
        } else {
            cout << "No" << endl;
        }
    } else if(v.size() == 1) {
        if(v[0] == 0) {
            cout << "Yes" << endl;
        } else {
            cout << "No" << endl;
        }
    } else {
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 6264
#include <stdio.h>
#include <stdlib.h>
#define int long long

signed main(){
	int K, A, B;
	scanf("%lld%lld%lld", &K, &A, &B);
	K++;
	if(A + 2 >= B || K <= A + 1){
		printf("%lld\n", K);
	}
	else{
		int n = K - A;
		printf("%lld\n", (B - A) * (n / 2) + A + n % 2);
	}
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <queue>
#include <stack>
#include <iomanip>
#include <fstream>
#include <unordered_map>
#include <unordered_set>
#include <assert.h>
using namespace std;


#define REP(i, n) for(ll i = 0;i < n;i++)
#define REPR(i, n) for(ll i = n;i >= 0;i--)
#define FOR(i, m, n) for(ll i = m;i < n;i++)
#define FORR(i, m, n) for(ll i = m;i >= n;i--)
#define REPO(i, n) for(ll i = 1;i <= n;i++)
#define ll long long
#define INF (ll)1 << 60
#define MINF (-1 * INF)
#define ALL(n) n.begin(),n.end()
#define MOD 1000000007
#define P pair<ll, ll>


int main() {
	string s;
	cin >> s;
	cout << (s == "ARC" ? "ABC" : "ARC") << endl;
}



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

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

ll L, R, d;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

	cin>>L>>R>>d;

	cout<<R/d - (L-1)/d<<endl;


    return 0;
}






Measured memory_bytes: 3656
#include<bits/stdc++.h>
using namespace std;
struct node{
	int s,sw;
}dp[3001][3001];
char a[3001],b[3001];
int max(int a,int b)
{
	if(a>b)return a;
	return b;
}
int main()
{
	cin>>a;
	cin>>b;
	int l1=strlen(a),l2=strlen(b);
	for(int i=1;i<=l1;++i)
	for(int j=1;j<=l2;++j)
	{
		if(a[i-1]==b[j-1]){
			dp[i][j].s=dp[i-1][j-1].s+1;
		}
		else{
			if(dp[i-1][j].s>dp[i][j-1].s){
				dp[i][j].s=dp[i-1][j].s;
				dp[i][j].sw=1;
			}
			else{
				dp[i][j].s=dp[i][j-1].s;
				dp[i][j].sw=-1;
			}
		}
	}
	char s[3001];int  d=0;
	while(l1>0&&l2>0)
	{
		if(dp[l1][l2].sw==0){
			s[++d]=a[l1-1];
			l1--;
			l2--;
		}
		else if(dp[l1][l2].sw==1)l1--;
		else l2--;
	}
	for(int i=d;i>0;--i)
	{
		cout<<s[i];
	}
}

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

using namespace std;
#define MOD 1000000007
#define X first
#define Y second
#define endl '\n'
typedef long long ll;
typedef pair<int, int> pii;
string s;
int cnt;

int main()
{
    cin >> s;
    for (int i = 0; i < s.size() / 2; ++i) if (s[i] != s[s.size() - 1 - i]) ++cnt;
    cout << cnt;
    return 0;
}


Measured memory_bytes: 3596
#include <iostream>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <climits>

using namespace std;

int main() {
	int H,W;

	cin >> H >> W;;
	
	bool sharp =false;
	
	while ((H!=0)||(W!=0)) {

		for(int i = 0; i < H; i++) {
			sharp = ( (i % 2) == 0 );
			for(int j = 0; j < W;j++) {
				if (sharp) cout << "#";
				else       cout << ".";
				
				sharp = ! sharp;
			}	
			cout << endl;
		}
		cout << endl;
		cin >> H >> W;;
	}
	
}



Measured memory_bytes: 3088
#include <stdio.h>

int main(){

int i,j,k;
int N;
int sum=0;
int count=0;

while(1){
i=0;
j=0;
k=0;
N=0;
sum=0;
count=0;
scanf("%d",&N);
if(N ==0){break;}
for(i=1;i<=N; i++){
  //printf("%d ",i);
  sum=i;
  for(j=1;j<=N;j++){
     sum+=(i+j);
     //printf("%d ",i+j);
     if(sum == N){
	//printf("N\n"); 
	count++;
	break;
     }
  }
//printf("\n");
sum=0;
}
printf("%d\n",count);
}
return 0;


}

Measured memory_bytes: 600
#line 1 "../lib/template.hpp"


#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) (v).begin(), (v).end()
#define coutd(n) cout << fixed << setprecision(n)
#define ll long long int
#define vl vector<ll>
#define vi vector<int>

using namespace std;

#line 2 "tmp.cpp"

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

  while (true) {
    int n;
    cin >> n;
    if (n == 0)
      break;
    vi a(n);
    REP(i, n) { cin >> a[i]; }
    vector<vi> dp(n + 1, vi(n + 1, 0));
    FOR(k, 1, n + 1) {
      REP(l, n + 1 - k) {
        int r = l + k;
        if (k == 1) {
          dp[l][r] = 0;
        } else if (k == 2) {
          dp[l][r] = abs(a[l] - a[r - 1]) <= 1 ? 2 : 0;
        } else {
          if (dp[l + 1][r - 1] == r - l - 2 && abs(a[l] - a[r - 1]) <= 1) {
            dp[l][r] = r - l;
          } else {
            FOR(i, l, r) { dp[l][r] = max(dp[l][r], dp[l][i] + dp[i][r]); }
          }
        }
      }
    }

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



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

typedef long long ll;
typedef unsigned long long ull;

int main() {
    int H, W;
    cin >> H >> W;
    vector<string> S(H + 2);
    rep(i, W + 2) {
        S[0].push_back('.');
        S[H + 1].push_back('.');
    }
    rep(i, H) {
        cin >> S[i + 1];
        S[i + 1] = "." + S[i + 1] + ".";
    }
    rep(i, H) {
        rep(j, W) {
            if (S[i + 1][j + 1] == '#') continue;
            int c = 0;
            rep(k, 3) {
                rep(l, 3) {
                    if (k == 1 && l == 1) continue;
                    if (S[i + k][j + l] == '#') c++;
                }
            }
            S[i + 1][j + 1] = '0' + c;
        }
    }
    rep(i, H) cout << S[i + 1].substr(1, W) << "\n";
}

Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>
#include <vector>
#include <memory.h>

#define EPS 1e-3
#define REP(i,n) for(int i = 0; i < (n); i++)

using namespace std;

//FILE *in = freopen("input.txt", "r", stdin);
//FILE *out = freopen("output.txt", "w", stdout);

int n;
long double data[10];

void input() {
	for(int i = 0; i < n + 3; i++) {
		scanf("%Lf", &data[i]);
	}
}

vector<long double> sweep_out(vector<vector<long double>> mat_org) {
	int N = mat_org.size();
	vector<vector<long double>> mat;
	REP(i, mat_org.size()) {
		mat.push_back(vector<long double>(mat_org[i].size()));
		REP(j, mat_org[i].size()) {
			mat[i][j] = mat_org[i][j];
		}
	}

	vector<long double> ans(N);
	REP(i, N) {
		if(fabs(mat[i][i]) < EPS) {
			for(int j = i+1; j < N; j++) {
				if(fabs(mat[i][j]) >= EPS) {
					swap(mat[i], mat[j]);
					break;
				}
			}
		}
		for(int j = N; j >= i; j--){
			mat[i][j] /= mat[i][i];
		}
		REP(j,N) {
			if(i == j) continue;
			long double t = mat[j][i];
			REP(k, N+1) {
				mat[j][k] -= mat[i][k] * t;
			}
		}
	}
	REP(i, N) {
		ans[i] = mat[i][N];
	}
	return ans;
}

void process() {
	vector<vector<long double>> mm(n+3);
	REP(i,n+3){
		mm[i].resize(n+2);
		int q = 1;
		REP(j,n+1){
			mm[i][j] = q;
			q *= i;
		}
		mm[i][n+1] = data[i];
	}

	int cnti[10];
	memset(cnti, 0, sizeof(cnti));

	int cntp;

	REP(i, n+3) {
		int cnta = 1;
		vector<long double> prev;
		for(int j = 0; j < n+3; j++) {
			if(i == j) continue;
			int cnt = 0;
			vector<vector<long double>> mat;
			for(int k = 0; k < n+3; k++) {
				if(k == i || k == j) continue;
				mat.push_back(mm[k]);
			}
			auto ans = sweep_out(mat);
			if(prev.empty()) {
				prev = ans;
			}
			else {
				for(int k = 0; k < n+1; k++) {
					if(fabs(prev[k] - ans[k]) < EPS) {
						++cnt;
					}
				}
				if(cnt >= n) {
					++cnta;
				}
			}
		}
		if(cnta >= n+2) {
			printf("%d\n", i);
		}
	}
}

int main() {
	while(true){
		scanf("%d", &n);
		if(n == 0) break;
		input();
		process();
	}
	return 0;
}

Measured memory_bytes: 1088
#include <iostream>
#include <algorithm>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <vector>

using namespace std;

int main() {
	int n; cin >> n;
	int m, e;
	if (n % 2 == 0) {
		m = n / 2;
		e = n * (n - 1); e /= 2;
		e -= m;

		cout << e << endl;
		for (int i = 1; i <= n; i++) {
			for (int j = i + 1; j <= n; j++) {
				if (i + j != n + 1) {
					cout << i << " " << j << endl;
				}
			}
		}
	}
	else {
		m = n / 2;
		e = n * (n - 1); e /= 2;
		e -= m;

		cout << e << endl;
		for (int i = 1; i <= n; i++) {
			for (int j = i + 1; j <= n; j++) {
				if (i + j != n) {
					cout << i << " " << j << endl;
				}
			}
		}
	}
	return 0;
}

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

//#define DEBUG


int main(void)
{
  int M1,D1,M2,D2;
  cin >> M1 >> D1 >> M2 >> D2;
  
  if(M1!=M2)
  {
    cout << 1;
  }
  else
  {
    cout << 0;
  }
  
  return 0;
} 

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <stack>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <math.h>
#include <stdio.h>
#include <ctype.h>
#include <ios> 
#include <iomanip>
using namespace std;

#define N_MAX   (100000)
#define LL_MAX_NUM (1LL<<60)
#define INF 1e7

typedef long long ll;
typedef long long int lli;

int main() {
    int N;
    ll res, tate, yoko;
    res = tate = yoko = 0;
    vector<ll> A;
	cin >> N;
    for (int i = 0; i < N; i++) {
        ll ai;
        cin >> ai;
        A.push_back(ai);
    }
    sort(A.begin(), A.end(), greater<ll>());
    int i = 0;
    while((tate == 0 || yoko == 0) && i < N ) {
        if (A[i] == A[i+1]) {
            if (tate != 0) {
                yoko = A[i];
            } else {
                tate = A[i];
            }
            i++;
        }
        i++;
    }
    res = tate * yoko;
    cout << res << endl;
	return 0;
}

Measured memory_bytes: 1400
#include<cstdio>
#include<vector>
#include<algorithm>
#include<map>

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>;


int main(void)
{
	int n, m;

	while(scanf("%d%d", &n, &m)==2)
	{
		vi a(n);
		map<int,int> c;

		for(int i=0;i<n;i++) scanf("%d", &a[i]);
		for(int ma:a) c[ma]++;

		for(int i=0;i<m;i++)
		{
			int x=c.rbegin()->first;
			c[x]--;
			if(c[x]<=0)
			{
				c.erase(x);
			}
			c[x/2]++;
		}

		ll ans=0;
		for(auto&mc:c)
		{
			ans+=(ll)mc.first*mc.second;
		}
		printf("%lld\n", ans);
	}
	return 0;
}


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

using namespace std;

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define PB push_back
#define MP make_pair
#define ll long long

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

int main(){
    std::ios::sync_with_stdio(false);
    int n;
    cin >> n;
    ll a[n+1] = {};
    ll b[n] = {};
    ll ret = 0;
    for(int i=0;i<n+1;++i)
    {
        cin >> a[i];
    }
    for(int i=0;i<n;++i)
    {
        cin >> b[i];
    }

    for(int i=0;i<n;++i)
    {
        ll cnt_i = min(a[i], b[i]);
        ret += cnt_i;
        b[i] -= cnt_i;
        ll cnt_ip1 = min(a[i+1], b[i]);
        a[i+1] -= cnt_ip1;
        ret += cnt_ip1;
    }
    cout << ret << endl;
}

Measured memory_bytes: 1792
A,B,X = map(int , input().split() )

import math

M = A * A * B
if X >= M/2:
  m = A*A*B
  C = 2*(m-X) / (A*A)
  ans = math.atan2(C,A) / math.pi*180  
  
else:
  C = (2*X)/(A*B)
  ans = math.atan2(B,C) / math.pi*180  
  
print(ans)

Measured memory_bytes: 3188
#include<iostream>
#include<cmath>
using namespace std;
struct Point { long double px, py; };
struct Segment { Point p1, p2; };
Point Minus(const Point& a, const Point& b) { return Point{ a.px - b.px,a.py - b.py }; }
long double norm(const Point& a) { return a.px * a.px + a.py * a.py; }
long double abs(const Point& a) { return sqrtl(norm(a)); }
long double dot(const Point& a, const Point& b) { return a.px * b.px + a.py * b.py; }
long double crs(const Point& a, const Point& b) { return a.px * b.py - a.py * b.px; }
long double dst(const Segment& a, const Point& b) { return dot(Minus(a.p2, a.p1), Minus(b, a.p1)) < 0.0 ? abs(Minus(b, a.p1)) : (dot(Minus(a.p1, a.p2), Minus(b, a.p2)) < 0.0 ? abs(Minus(b, a.p2)) : abs(crs(Minus(a.p2, a.p1), Minus(b, a.p1)) / abs(Minus(a.p2, a.p1)))); }
long double dst(const Point& a, const Point& b) { return abs(Minus(b, a)); }

int n, m; Point V, W, x[100]; long double r[100];
int main() {
	while (true) {
		cin >> n; if (n == 0)break;
		for (int i = 0; i < n; i++) { cin >> x[i].px >> x[i].py >> r[i]; }
		cin >> m;
		for (int i = 0; i < m; i++) {
			cin >> V.px >> V.py >> W.px >> W.py;
			bool OK = false;
			for (int j = 0; j < n; j++) {
				if (dst(V, x[j]) <= r[j] && dst(W, x[j])>r[j])OK = true;
				else if (dst(V, x[j])>r[j] && dst(W, x[j]) <= r[j])OK = true;
				else if (dst(V, x[j])>r[j] && dst(W, x[j]) > r[j]) {
					if (dst(Segment{ V,W }, x[j]) <= r[j])OK = true;
				}
			}
			if (OK == true)cout << "Safe" << endl; else cout << "Danger" << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 3220
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define eb emplace_back
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}


int const INF = 1001001001;


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

int h,n;
cin >> h >> n;
vi a(n);
rep(i,n) cin >> a[i];


int sum = 0;
bool x = false;
rep(i,n) {
    sum += a[i];
    if(sum >= h){
        x = true;
        break;
    }
}

if(x) cout << "Yes" << endl;
else cout << "No" << endl;


return 0;
}

Measured memory_bytes: 640
#include<stdio.h> 
int main() 
{ 
      int a,b,x,w; 
      while(scanf("%d %d",&a,&b)!=EOF) 
      { 
         x=a+b;
		 w=0; 
         while(x) 
           { 
		      w++; 
              x/=10; 
           } 
         printf("%d\n",w); 
      } 
      return 0; 
} 

Measured memory_bytes: 1028
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N,M;
  cin>>N>>M;
  
  bool flag=false;
  
  vector<vector<char>>A(N,vector<char>(N));
  
  for(int i=0;i<N;i++){
    for(int j=0;j<N;j++){
      cin>>A.at(i).at(j);
    }
        }
        
        vector<vector<char>>B(M,vector<char>(M));
        
        for(int i=0;i<M;i++){
          for(int j=0;j<M;j++){
cin>>B.at(i).at(j);
          }
        }
        
        for(int i=0;i<=N-M;i++){
          for(int j=0;j<=N-M;j++){
            int sum=0;
            for(int k=0;k<M;k++){
              for(int l=0;l<M;l++){
if(A.at(0+i+k).at(0+l+j)==B.at(k).at(l)){
  sum++;
}
                
              }
                  }
                  
                  if(sum==M*M){
cout<<"Yes"<<endl;
                    flag=true;
                    break;
                  }
                  }
                  
                  if(flag){
                    break;
                  }
                  }
                  if(flag==false){
cout<<"No"<<endl;
                  
                  }
}

Measured memory_bytes: 256