akhauriyash/Code-Regression huggingface dataset:
//C
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdalign>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>


//Hang in there!

using namespace std;
//+97

int main() {
	long long L, R;
	cin >> L >> R;
	long long ans = LLONG_MAX;
	for (long long i = L; i <= min(R, L + 2018); i++) {
		for (long long j = i + 1; j <= min(R, i + 1 + 2018); j++) {
			ans = min(ans, (i * j) % 2019);
		}
	}
	cout << ans << endl;
}

//Maybe TLE

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

#define pb push_back
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define debug(x) cerr << #x << " : " << x << '\n'

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef long double ld;
typedef string str;
typedef pair<ll, ll> pll;
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

const ll Mod = 1000000007LL;
const int Maxn = 2e5 + 10;
const ll Inf = 2242545357980376863LL;
const ll Log = 21;

int main(){
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	ll n;
	cin >> n;
	for(int i = 0; i < n - 1; i++){
		for(int j = i + 1; j < n; j++) cout << __builtin_ctz(i ^ j) + 1 << ' ';
		cout << '\n';
	}
	
	return 0;
}

/*

                                 ____              ,----..               ,----..
   ,---,                       ,'  , `.           /   /   \             /   /   \
  '  .' \                   ,-+-,.' _ |          /   .     :           /   .     :
 /  ;    '.              ,-+-. ;   , ||         .   /   ;.  \         .   /   ;.  \
:  :       \            ,--.'|'   |  ;|        .   ;   /  ` ;        .   ;   /  ` ;
:  |   /\   \          |   |  ,', |  ':        ;   |  ; \ ; |        ;   |  ; \ ; |
|  :  ' ;.   :         |   | /  | |  ||        |   :  | ; | '        |   :  | ; | '
|  |  ;/  \   \        '   | :  | :  |,        .   |  ' ' ' :        .   |  ' ' ' :
'  :  | \  \ ,'        ;   . |  ; |--'         '   ;  \; /  |        '   ;  \; /  |
|  |  '  '--'          |   : |  | ,             \   \  ',  /          \   \  ',  /
|  :  :                |   : '  |/               ;   :    /            ;   :    /
|  | ,'                ;   | |`-'                 \   \ .'              \   \ .'
`--''                  |   ;/                      `---`                 `---`
                       '---'

*/



Measured memory_bytes: 512
#include <bits/stdc++.h>
#define ll long long
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define rrep(i, n) for (int i = 1; i <= n; i++)
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
ll lcm(ll a, ll b) { return (a * b) / gcd(a,b); }
using P = pair <int, int>;
 
ll MOD = 1000000007;
ll INF =1<<29;
ll dp[100100];
 
int main() {
     char b;
     cin >>b;
     if(b=='A'){
         cout << 'T' <<endl;
         return 0;
     }
     else if(b=='G'){
         cout << 'C' <<endl;
         return 0;
     }
     else if(b=='T'){
         cout << 'A' <<endl;
         return 0;
     }
     cout << 'G' <<endl;
}
  

Measured memory_bytes: 256
#if os(Linux)
import Glibc
#else
import Darwin.C
#endif

let INPUT = stdin

func scanInts(count: Int) -> [Int] {
    let format: String
    switch count {
        case 1: format = "%lld"
        case 2: format = "%lld %lld"
        case 3: format = "%lld %lld %lld"
        case 4: format = "%lld %lld %lld %lld"
        case 5: format = "%lld %lld %lld %lld %lld"
        case 6: format = "%lld %lld %lld %lld %lld %lld"
        default: format = repeatElement("%lld", count: count).joined(separator: " ")
    }
    let ptr = UnsafeMutablePointer<CLongLong>.allocate(capacity: count)
    let ptrArray = Array(ptr ..< ptr+count)
    let read = withVaList(ptrArray) {
        vfscanf(INPUT, format, $0)
    }
    assert(read == count)
    return ptrArray.map { Int($0.pointee) }
}
func scanInt() -> Int {
    scanInts(count: 1)[0]
}
func scanIntPair() -> (Int, Int) {
    let a: [Int] = scanInts(count: 2)
    return (a[0], a[1])
}

//=============================================================================

func gcd(_ a: Int, _ b: Int) -> Int {
    b == 0 ? abs(a) : gcd(b, a%b)
}

struct Fraction: Equatable, Hashable {
    let numerator, denominator: Int
    init (_ numerator: Int, _ denominator: Int) {
        switch (numerator, denominator) {
        case (0, 0):
            self.numerator = 0
            self.denominator = 0
        case (0, _):
            self.numerator = 0
            self.denominator = 1
        case (_, 0):
            self.numerator = 1
            self.denominator = 0
        default:
            let g = gcd(numerator, denominator)
            self.numerator = denominator.signum() * numerator / g
            self.denominator = abs(denominator) / g
        }
    }
    init (_ tuple : (Int, Int)) {
        self.init(tuple.0, tuple.1)
    }
    func perpendicular() -> Fraction {
        Fraction(-denominator, numerator)
    }
}

func pow(_ x: Int, _ n: Int, mod: Int) -> Int {
    precondition(n >= 0 && mod > 1)
    if n == 0 { return 1 }

    var u = pow(x, n/2, mod: mod)
    u = u*u % mod
    if n%2 == 1 { u = u*x % mod }
    return u
}

//=============================================================================

let MOD = Int(1e9+7)

let N = scanInt()
var cliques: [Fraction: Int] = [:]
var zeroes = 0
for _ in 1...N {
    let f = Fraction(scanIntPair())
    if f == Fraction(0, 0) {
        zeroes += 1
    } else {
        cliques[f, default: 0] += 1
    }
}

var ways = 1
while let (k1, v1) = cliques.first {
    cliques.removeValue(forKey: k1)
    let k2 = k1.perpendicular()
    let v2 = cliques.removeValue(forKey: k2)

    ways *= pow(2, v1, mod: MOD) + (v2 != nil ? pow(2, v2!, mod: MOD) - 1 : 0)
    ways %= MOD
}
ways += MOD - 1
ways += zeroes
ways %= MOD
print(ways)


Measured memory_bytes: 31828
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <functional>
#include <numeric>
#include <utility>
#include <limits>
#include <time.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>

using namespace std;

typedef long long ll;
typedef vector<long long> vi;
typedef pair<long long, long long> ii;
typedef vector<pair<long long, long long>> vii;
typedef stringstream ss;
ll mil() { return numeric_limits<long long>::min(); }
ll mal() { return numeric_limits<long long>::max(); }

#define R3(i, a, b) for (long long i = (a); i < (b); ++i)
#define R2(i, b) for (long long i = 0; i < (b); ++i)
#define R1(b) for (long long i = 0; i < (b); ++i)
#define RR(i, a, b) for (long long i = a; i > b; --i)
#define PB(x) push_back(x)
#define MP(x, y) make_pair(x, y)

// build: ctrl + f9

// run: shift + f10
// debug: shift + f9
// sanitize: shift + f11

int main(int argc, char **argv)
{
 

    ll N;

    cin >> N;

    vector<string> si(N);
    R1(N) cin>>si[i];

    set<string> siu;
    for(auto & e : si) siu.insert(e);

    cout << siu.size() << endl;
}

Measured memory_bytes: 24992
// #include {{{
#include <iostream>
#include <cassert>
#include <cstring>
#include <cstdlib>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <ctime>
#include <queue>
#include <set>
#include <map>
#include <stack>
#include <string>
#include <bitset>
#include <vector>
#include <complex>
#include <algorithm>
using namespace std;
// }}}
// #define {{{
typedef long long ll;
typedef double db;
typedef pair<int,int> pii;
typedef vector<int> vi;
#define de(x) cout << #x << "=" << x << endl
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define per(i,a,b) for(int i=(b)-1;i>=(a);--i)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define fi first
#define se second
// }}}

int n , s;
bitset<10010> B;

int main(){
    cin >> n;
    B[0] = 1;
    rep(i,0,n) {
        cin >> s;
        B |= B << s;
    }
    per(i,0,10001) if(i%10!=0&&B[i])
        return printf("%d\n",i) , 0;
    puts("0");
    return 0;
}


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

int main(void) {
  int X, ans;
  cin >> X;
  bool flag=true;
  
  if(X==2) ans=2;
  else{
    for(int i=X; i<=1000000; i++){
      for(int j=2; j<i; j++){
        if(i % j == 0){
          flag=false;
          break;
        }
        else{
          flag=true;
        }
      }
      if(flag==true){
        ans=i;
        break;
      }
    }
  }
  
  cout << ans << endl;
  
  return 0;
}

Measured memory_bytes: 256
// abc136d.cpp : Gathering Children
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
#define up(i,s,e,d) for(int i=(s);i<(e);i+=(d))
#define in(x) cin>>(x)
#define ot(x) cout<<(x)
#define ote(x) cout<<(x)<<endl

int main(){
  string s; in(s);
  int n = s.length();
  vi o(n), d(n);

  char R = 'R', L = 'L';
  int m = 0;
  up(i,0,n,1)
    if(i+1<n && s[i]==R && s[i+1]==L) d[m++] = i;

  up(i,0,n,1){
    int j, step = 0;

    if(s[i]==R){
      for(j=0; j<m; j++)
        if(i<=d[j]){ step = d[j] - i; break; }
    }
    else{
      for(j=m-1; j>=0; j--)
        if(i>=d[j]){ step = d[j] - i; break; }
    }

    if(step%2) o[d[j]+1]++; else o[d[j]]++;

  }

  ot(o[0]); up(i,1,n,1) cout<<" "<<o[i]; ote("");

}

Measured memory_bytes: 1536
/* ex3_2
Acro */

#include <stdio.h> 
int main(void){
    int n,n_1;
    scanf("%d",&n);
    /* 1の位を抽出 */
    n_1 = n % 10;
    /* 条件分岐、改行忘れずに */
    if(n_1 == 3)
    {
        printf("bon\n");
    }
    else if (n_1 == 0 || n_1 == 1 || n_1 == 6 || n_1 == 8)
    {
        printf("pon\n");
    }
    else
    {
        printf("hon\n");
    }
    return 0;
}

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

int main(){
    int n,i;
    string s;
    cin>>n>>s;
    for(i=0;i<s.length();i++){
        if('Z'-s[i]>=n){s[i]=s[i]+n;}
        else{s[i]=n-26+s[i];}
    }
    cout<<s<<endl;
    return 0;
}



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

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

	if (s == "Sunny") cout << "Cloudy" << endl;
	else if (s == "Cloudy") cout << "Rainy" << endl;
	else cout << "Sunny" << endl;

	return 0;
}

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

#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define repr(i,n) for(int i=(int)(n-1);i>=0;i--)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout << #x" = " << x << endl
#define print(x) cout << x << endl
#define maxch(x,y) x=max(x,y)
#define minch(x,y) x=min(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt(x) bitset<32>(x).count()

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<P, int> PPI;
typedef pair<int, P> PIP;
typedef pair<ll, ll> PL;
typedef pair<P, ll> PPL;
typedef set<int> S;

#define INF INT_MAX/3
#define MAX_N 1000000001

struct Cake {
  int s;
  int tate, yoko;
};

bool operator<(const Cake& a, const Cake& b) {
  return a.s < b.s;
}

void cut(vector<Cake>& v, int i, int l) {
  Cake piece = v[i];
  v.erase(v.begin() + i);

  bool t = true;
  while(true) {
    if (piece.yoko < l) {
      l -= piece.yoko;
    } else {
      t = false;
      break;
    }

    if (piece.tate < l) {
      l -= piece.tate;
    } else {
      t = true;
      break;
    }
  }

  Cake a, b;
  if (t) {
    a = Cake{(piece.tate - l) * piece.yoko, piece.tate - l, piece.yoko};
    b = Cake{l * piece.yoko, l, piece.yoko};
  } else {
    a = Cake{piece.tate * (piece.yoko - l), piece.tate, piece.yoko - l};
    b = Cake{piece.tate * l, piece.tate, l};
  }

  if (b < a) swap(a, b);
  v.pb(a); v.pb(b);
}

int n, w, d;

int main(){
  cin.sync_with_stdio(false);
  while(cin >> n >> w >> d, w) {
    vector<Cake> v;
    Cake tmp = Cake{w * d, d, w};
    v.pb(tmp);
    rep(i, n) {
      int p, l;
      cin >> p >> l;
      cut(v, p - 1, l);
    }

    sort(all(v));
    rep(i, v.size() - 1) printf("%d ", v[i].s);
    printf("%d\n", v[v.size() - 1].s);
  }

  return 0;
}

Measured memory_bytes: 3068
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<queue>
#include<deque>
#include<cmath>
#include<map>
#include<unordered_map>
#include<set>
#include<cstring>
#include<iomanip> //cout << fixed << setprecision(15) << x << endl;

using namespace std;
typedef long long ll;
const ll INF = 1e9 + 6;
const ll MOD = 1e9 + 7;
const ll LLINF = 1e18;
#define Pint pair<ll, ll>
#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rnr(i,a,b) for(int i=int(a);i>=int(b);i--)
#define rep(i,b) rng(i,0,b)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
/* -- template -- */

int main() {
    string S; cin >> S;
    if(S.substr(0, 4) == "YAKI") {
        cout << "Yes" << endl;
    }else {
        cout << "No" << endl;
    }
}


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


int main()
{
  int k, x;
  cin >> k >> x;
  for (int i = -1000000; i <= 1000000; i++)
    if (i >= x - (k - 1) && i <= x + (k - 1))
      printf("%d%c", i, i == x + (k - 1) ? '\n' : ' ');
  return 0;
}

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

int main() {
    int n; cin >> n;
    vector<string> w(n);
    rep(i,n) cin >> w.at(i);

    for(int i=0; i<n; i++){
        for(int j=0; j<n; j++){
            if(w.at(i)==w.at(j) && i!=j){
                cout << "No" << endl;
                return 0;
            }
        }
    }

    for(int i=0; i<n-1; i++){
        if(w.at(i).at(w.at(i).size()-1)!=w.at(i+1).at(0)){
            cout << "No" << endl;
            break;
        }

        if(i==n-2) cout << "Yes" << endl;
    }
}

Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ld long double
#define al(a) (a).begin(),(a).end()
#define mk make_pair
#define check cout<<"?"<<endl;

ll MOD=1000000007;
ll mod=998244353;
int inf=1000001000;
ll INF=1e18+5;

int main() {
    int w,h,n; cin>>w>>h>>n;
    vector<int> hl={0,h},wl={0,w};
    rep(i,n){
        int x,y,a; cin>>x>>y>>a;
        if(a==1) wl[0]=max(x,wl[0]);
        if(a==2) wl[1]=min(x,wl[1]);
        if(a==3) hl[0]=max(y,hl[0]);
        if(a==4) hl[1]=min(y,hl[1]);
    }
    cout<<max(wl[1]-wl[0],0)*max(hl[1]-hl[0],0)<<endl;
}

Measured memory_bytes: 256
from sys import stdout
def Q(x):
    print x
    stdout.flush()
    r = raw_input()
    if r[0] == 'V':
        quit()
    elif r[0] == 'M':
        return 1
    else:
        return 0
l = 0
r = int(raw_input())
a = b = Q(l)
while 1:
    m = (l + r) / 2
    c = Q(m)
    if (m - l) % 2 == a ^ c:
        l, r, a, b = m, r, c, b
    else:
        l, r, a, b = l, m, a, c


Measured memory_bytes: 3288
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <iomanip>

#define REP(i,n) for(int i=0;i<n;++i)
#define RREP(i,n) for(int i=n-1;i>=0;--i)
#define FOR(i,m,n) for(int i=m;i<n;++i)
#define RFOR(i,m,n) for(int i=m-1;i>=n;--i)
#define ALL(v) v.begin(),v.end()
#define PB(a) push_back(a)
#define INF 1000000001
#define MOD 1000000007

using namespace std;


int main() {
	string s;
	cin >> s >> s;
	cout << 'A' << s[0] << "C";

	return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize("O3")
#include<bits/stdc++.h>
#define rc(x) return cout<<x<<endl,0
#define pb push_back
#define in insert
#define er erase
#define fr first
#define sc second
typedef long long ll;
const long long llinf=LLONG_MAX;
const int inf=INT_MAX;
const int nmax=1e5+5;
const int mod=1e9+7;
using namespace std;
string s,tmp;
int i;
int main()
{
	//freopen("sol.in","r",stdin);
	//freopen("sol.out","w",stdout);
	ios_base::sync_with_stdio(false);cin.tie(0);cerr.tie(0);cout.tie(0);
	cin>>s;
	for(i=0;i<s.size()-8;i++)tmp+=s[i];
	cout<<tmp<<endl;
	return 0;
} 

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
int a,b;cin>>a>>b;
int ans=0;
for(int i=0;i<2;i++){
  if(a>b) {
      ans+=a;
      a--;
  }
  else{
      ans+=b;
      b--;
  }
}
cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i< (n); ++i)
using namespace std;
using ll = long long;
using P =pair<int,int>;
const int INF = 10000000000;
int main(){
    int n,x,y;
    cin >> n >> x >> y;
    --x;--y;
    vector<int> ans(n);
    rep(sv,n){
        vector<int> dist(n,INF);
        queue<int> q;
        auto push = [&](int v,int d){
            if(dist[v] != INF) return;
            dist[v] =d;
            q.push(v);
        };
        push(sv,0);
        while(!q.empty()){
            int v = q.front(); q.pop();
            int d = dist[v];
            if(v-1 >=0) push(v-1,d+1);
            if(v+1 < n) push(v+1,d+1);
            if(v==x) push(y,d+1);
            if(v==y) push(x,d+1);
        }
        rep(i,n) ans[dist[i]]++;
    }
    rep(i,n) ans[i] /= 2;
    for(int i =1;i <=n-1;++i){
        cout<< ans[i] << endl;
    }
    return 0;
}






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

#define pb push_back

#define ll long long

#define ft first

#define sd second

using namespace std;

const int N = 5050 ;

bool used[N];

ll z , r , w ;

int main(){

    int n , m ;
    string nm , mn ;
    cin >> n >> m ;
    for(int i = 0 ; i < n ; i ++ ){
        nm+=to_string(m);
    }
    for(int i = 0 ; i < m ; i ++ ){
        mn+=to_string(n);
    }
    if(stoi(nm)>=stoi(mn)){
        cout<<stoi(nm);
    }
    else{
        cout<<stoi(mn);
    }

}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <iterator>
#include <map>
#include <cmath>
using namespace std;
typedef long long ll;
//typedef pair<ll, ll> P;

template<typename T>auto& operator<<(ostream &s, const vector<T> &v) {
   s << v.size() << " [";
   for (auto e:v) {
      s << e << "\t";
   }
   s << "]";
   return s;
}
template<typename T, typename U>auto& operator<<(ostream &s, const map<T,U> &m) {
   s << "[";
   for (auto i:m) {
      s << "(" << i->first << ", " << i->second << ")\t";
   }
   s << "]";
   return s;
}
#define rep(i, m) for(ll i=0;i<(m);i++)
#define rep1(i, m) for(ll i=1;i<=(m);i++)
#define FOR(i, a, b) for(ll i=(a);i<(b);i++)
//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#define INFI 1000000007
//https://cpprefjp.github.io/reference/algorithm/unique.html
int main() {
   ll N; cin >> N;
   ll m;
   map<ll,ll,greater<ll>> c;
   c[0] = 4; // 最後まで見つからなかったとき0 を返すため
   
   rep(i, N) {
      cin >> m;
      c[m]++;
   }
   ll prev = -1;
   // 大きいものから見ていく
   vector<ll> item;
   for (auto i:c) {
      auto v = i.first;
      auto cnt = i.second;
      // 2個以上なら次に2個以上なものと組み合わせる
      if (cnt >= 2) {
         rep(j, cnt) {
            item.push_back(v);
         }
      }
      if (item.size() >= 4) {
         break;
      }
      
   }
   cout << item[0] * item[3] << endl;
   return 0;
}

Measured memory_bytes: 6528
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vin=vector<int>;
using vll=vector<long long>;
using vvin=vector<vector<int>>;
using vvll=vector<vector<long long>>;
using vstr=vector<string>;
using vvstr=vector<vector<string>>;
using vch=vector<char>;
using vvch=vector<vector<char>>;
using vbo=vector<bool>;
using vvbo=vector<vector<bool>>;
using vpii=vector<pair<int,int>>;
using pqsin=priority_queue<int,vector<int>,greater<int>>;
#define mp make_pair
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep2(i,s,n) for(int i=(s);i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define decp(n) cout<<fixed<<setprecision((int)n)
const ll inf=1e9+7;
const ll INF=1e18;

const int MAX=510000;

vll fac(MAX);
vll finv(MAX);
vll inv(MAX);

void combinit(ll m){
    fac[0]=1;fac[1]=1;
    finv[0]=1;finv[1]=1;
    inv[1]=1;
    rep2(i,2,MAX){
        fac[i]=fac[i-1]*i%m;
        inv[i]=m-inv[m%i]*(m/i)%m;
        finv[i]=finv[i-1]*inv[i]%m;
    }
}

ll combi(ll n,ll k,ll m=inf){
    if(n<k)return 0;
    if(n<0||k<0)return 0;
    return fac[n]*(finv[k]*finv[n-k]%m)%m;
}

int main(){
    ll n;cin>>n;
    vin num(n+1,inf);
    int a,l,r;
    rep(i,n+1){
        cin>>a;
        if(num[a]==inf)num[a]=i;
        else{
            l=num[a];
            r=i;
        }
    }
    ll sum=(ll)(l+n-r);
    combinit(inf);
    vll ans(n+1);
    rep2(i,1,n+2){
        ans[i-1]=combi(n+1,i)-combi(sum,i-1);
        if(ans[i-1]<0)ans[i-1]+=inf;
    }
    rep(i,n+1)cout<<ans[i]<<endl;
}

Measured memory_bytes: 16364
def main():
    d = dict()
    mx = 0
    n = int(input())
    for _ in range(n):
        s = input()
        if not s in d:
            d[s] = 1
        else:
            d[s] += 1

        if d[s] > mx:
            mx = d[s]
    lst = [s for s in d.keys() if d[s] == mx]
    lst.sort()
    for s in lst:
        print(s)



if __name__ == '__main__':
    main()


Measured memory_bytes: 32096
#include<cstdio>
#include<algorithm>

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

using namespace std;

const int INF=1<<29;

int n,c[100];
int dp1[1000000],dp2[1000000];

int main(){
	for(int T=1;scanf("%d",&n),n;T++){
		rep(i,n)	scanf("%d",c+i);

		if(c[0]!=1){
			printf("Case #%d: Cannot pay some amount\n",T);
			continue;
		}

		const int L=100*c[n-1];
		dp1[0]=0;
		fill(dp1+1,dp1+L,INF);
		rep(k,n)for(int p=c[k];p<L;p++)	dp1[p]=min(dp1[p],dp1[p-c[k]]+1);

		dp2[0]=0;
		fill(dp2+1,dp2+L,INF);
		rep(p,L)for(int k=n-1;k>=0;k--){
			if(p-c[k]>=0){
				dp2[p]=dp2[p-c[k]]+1;
				break;
			}
		}

		bool ok=true;
		rep(i,L)if(dp1[i]<dp2[i]){ ok=false; break; }
		printf("Case #%d: %s\n",T,ok?"OK":"Cannot use greedy algorithm");
	}

	return 0;
}

Measured memory_bytes: 1548
#include<bits/stdc++.h>
using namespace std;
int main(){
  string s;
  cin>>s;
  int ans=0,cmp=0;
  int k=0;
  while(s[k]=='R')cmp++,k++;
  ans=max(ans,cmp);
  k=1;
  cmp=0;
  while(s[k]=='R')cmp++,k++;
  ans=max(ans,cmp);
  k=2;
  cmp=0;
  while(s[k]=='R')cmp++,k++;
  ans=max(ans,cmp);
  cout<<ans;
  return 0;
}

Measured memory_bytes: 3620
n=int(input())
a=list(map(int,input().split()))
cnt=0
flag=1

for i in range(0,n-1):
    flag=0
    for j in reversed(range(i+1,n)):
        if a[j-1]>a[j]:
            ab=a[j-1]
            a[j-1]=a[j]
            a[j]=ab
            flag=1
            cnt+=1
def convert(list): 
    res=" ".join(map(str, list)) 
    return res   
print(convert(a))
print(cnt)


Measured memory_bytes: 5600
#include <stdio.h>

int __gcd(int a, int b) {
	if(b)
		return __gcd(b, a % b);
	return a;
}

int max(int a, int b) {
	return a > b ? a : b;
}

#define MN (int)(1e5 + 2)

int A[MN], pre[MN], suf[MN];

int main() {
	int N;
	scanf("%d", &N);
	for(int i = 1; i <= N; i++)
		scanf("%d", A + i);

	for(int i = 1; i <= N; i++)
		pre[i] = __gcd(pre[i - 1], A[i]);

	for(int i = N; i >= 1; i--)
		suf[i] = __gcd(suf[i + 1], A[i]);

	int best = 0;
	for(int i = 1; i <= N; i++)
		best = max(best, __gcd(pre[i - 1], suf[i + 1]));

	printf("%d", best);
}


Measured memory_bytes: 1280
#include <bits/stdc++.h>
#define cinf(n,x) for(int i=0;i<(n);i++) cin >> x[i];
typedef long long int ll;
const ll INF =1LL << 62;
using namespace std;

int main(){
	int N,K; cin >> N >> K;
	vector<long long> h(N);
	cinf(N,h);
    sort(h.begin(),h.end());
    long long ans=INF;
    for(int i=0;i<N-K+1;i++){
    	long long dif=0;
    	dif=h[i+K-1]-h[i];
    	ans=min(ans,dif);
    }
    cout << ans << endl;
}

Measured memory_bytes: 1024
import Control.Monad
import Control.Applicative
import System.IO
import Data.List

main = do
  inputs <- getContents
  mapM (putStrLn . solve) $ lines inputs

solve :: String -> String
solve input = let
  [a, b, c, d, e, f] = read <$> words input :: [Double]
  ic = [c, f]
  det = a * e - b * d
  inv = (/det) <$> [e, -b, -d, a]
  [x, y] = matvec inv ic
  in showRound x ++ " " ++ showRound y

matvec :: [Double] -> [Double] -> [Double]
matvec m v = let
  mv = zipWith (*) m $ v ++ v
  (f, l) = splitAt 2 mv
  in [sum f, sum l]

showRound :: Double -> String
showRound x = let
  base = ceiling $ x * 1000 :: Int
  round = if x >= (fromIntegral base + 0.5) / 1000 then base + 1 else base
  _str = show round
  (_h, _t) = splitAt (length _str - 3) _str
  h = if null _h then "0" else _h
  t = if length _t < 3 then _t ++ replicate (3 - length _t) '0' else _t
  in h ++ "." ++ t

Measured memory_bytes: 4208
#include <iostream>
#include <vector>
#include <cstring>
#include <algorithm>
using namespace std;
vector<string> a;
int c(string s) {
  vector<int> num(26,0);
  for(int i = 0; i < s.size(); i++) {
    num[s[i] - 'a']++;
  }
  int res = 0;
  for(int i = 0; i < 26; i++) {
    if(num[i]) res++;
  }
  return res;
}


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

  a.push_back("a");
  for(int i = 1; i < n; i++) {
    int N = a.size();
    vector<string> tmp;
    for(int j = 0; j < N; j++) {
      int t = c(a[j]);
      for(int k = 0; k <= t; k++) {
	string T = a[j] + (char)(k + 'a');
	tmp.push_back(T);
      }
    }
    a = tmp;
  }

  // for(int i = 0; i < a.size(); i++) cout << a[i] << endl;
  
  sort(a.begin(),a.end());

  for(int i = 0; i < a.size(); i++) cout << a[i] << endl; 
  
}

  


Measured memory_bytes: 9244
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define perl(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define pb push_back
#define ins insert
#define pqueue(x) priority_queue<x,vector<x>,greater<x>>
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
#define vtpl(x,y,z) vector<tuple<x,y,z>>
#define rev(x) reverse(x);
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
using vpl=vector<pl>;
using vvpl=vector<vpl>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9+10;
const ll INF=4e18;
const ll dy[8]={1,0,-1,0,1,1,-1,-1};
const ll dx[8]={0,-1,0,1,1,-1,1,-1};
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
} 

struct RollingHash {
    static const int base1 = 1007, base2 = 2009;
    static const int mod1 = 1000000007, mod2 = 1000000009;
    vector<long long> hash1, hash2, power1, power2;

    // construct
    RollingHash(const string &S) {
        int n = (int)S.size();
        hash1.assign(n+1, 0);
        hash2.assign(n+1, 0);
        power1.assign(n+1, 1);
        power2.assign(n+1, 1);
        for (int i = 0; i < n; ++i) {
            hash1[i+1] = (hash1[i] * base1 + S[i]) % mod1;
            hash2[i+1] = (hash2[i] * base2 + S[i]) % mod2;
            power1[i+1] = (power1[i] * base1) % mod1;
            power2[i+1] = (power2[i] * base2) % mod2;
        }
    }
    
    // get hash of S[left:right]
    inline pair<long long, long long> get(int l, int r) const {
        long long res1 = hash1[r] - hash1[l] * power1[r-l] % mod1;
        if (res1 < 0) res1 += mod1;
        long long res2 = hash2[r] - hash2[l] * power2[r-l] % mod2;
        if (res2 < 0) res2 += mod2;
        return {res1, res2};
    }

    // get lcp of S[a:] and T[b:]
    inline int getLCP(int a, int b) const {
        int len = min((int)hash1.size()-a, (int)hash1.size()-b);
        int low = 0, high = len;
        while (high - low > 1) {
            int mid = (low + high) >> 1;
            if (get(a, a+mid) != get(b, b+mid)) high = mid;
            else low = mid;
        }
        return low;
    }
};



int main(){
    string s,t;cin >> s >> t;
    ll S=s.size(),T=t.size();
    RollingHash rh(s),rt(t);
    rep(i,S-T+1){
        //cout << i<< " "<<T+i <<" "<< S <<" " << S+T <<endl;
        if(rh.get(i,T+i)==rt.get(0,T))cout << i <<endl;
    }
}


Measured memory_bytes: 35668
import Data.Array

--Prime number list
primes = 2: filter isPrime [3,5..10000]
isPrime n = all ((>0).(rem n)) $ takeWhile (\x -> x*x <= n) primes

--Twin prime number list
twinPrimes = filter filt $ zip primes (tail primes)
  where
    filt (a,b) = a + 2 == b

--A list of twin primes stored in an array
--Holds the maximum value of the twin prime numbers below the subscript
winPrimesArray = array (5,10000) [(i,last (takeWhile (filt2 i) twinPrimes))| i <- [5..10000]]
  where
    filt2 i (a,b) = b <= i

--Function to convert a tuple to a String
tpToStr (a,b) = show a ++ " " ++ show b

main = do
  s <- readLn
  if s == 0 then return ()
  else do
    putStrLn $ tpToStr $ winPrimesArray ! s
    main

Measured memory_bytes: 4908
// ITP1_8_C:   Counting Characters
// 2017.7.27

#include <stdio.h>
#include <ctype.h>
#include <stdlib.h>

char *gets(char *s);

int main()
{
	int cnt[26];
	char *p, buf[1250];
	int i, c;

	for (i = 0; i < 26; i++) cnt[i] = 0;
	while (gets(buf) != NULL) {
		p = buf;
		while (*p) {
			c = *p++;
			if (isalpha(c)) {
				if (islower(c)) cnt[c - 'a']++;
				else cnt[c - 'A']++;
			}
		}
	}
	for (i = 0; i < 26; i++) printf("%c : %d\n", 'a' + i, cnt[i]);
	return 0;
}

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

const int NMAX = 1000;
vector <int> adia[NMAX];
int n;

void dfs(int nod, int tata, int xact, int root)
{
	if (nod == root + n) {
		if (xact != root) {
			cerr << "Prost pentru radacina " << root << '\n';
			exit(0);
		}
		return;
	}
	for (auto i : adia[nod])
		if (i != tata)
			dfs(i, nod, (xact ^ (nod > n ? nod - n : nod)), root);
}

void verif()
{
	//return;
	cin >> n;
	for (int i = 1; i < 2 * n; i++) {
		int a, b;
		cin >> a >> b;
		adia[a].push_back(b);
		adia[b].push_back(a);
	}
	
	for (int i = 1; i <= n; i++)
		dfs(i, 0, i, i);
}


int main()
{
	int n;
	scanf("%d", &n);
	
	if (n <= 2) {
		cout << "No\n";
		return 0;
	}
	
	
	if (n % 4 == 3) {
		cout << "Yes\n";
		for (int i = 1; i < 2 * n; i++)
			cout << i << ' ' << i + 1 << '\n';

		verif();
		return 0;
	}
	
	if (n % 4 == 1) {
		cout << "Yes\n";
		int a = n, b = n - 1;
		vector <int> v;
		for (int i = 1; i <= 2 * n; i++)
			if (i != a && i != b && i - n != a && i - n != b)
				v.push_back(i);
		
		for (int i = 0; i < v.size() - 1; i++)
			cout << v[i] << ' ' << v[i + 1] << '\n';
		
		cout << a << ' ' << b << '\n';
		cout << b << " 1" << '\n';
		cout << "1 " << a + n << '\n';
		cout << a + n << ' ' << b + n << '\n';
		verif();
		return 0;
	}
	
	if (n % 4 == 2) {
		cout << "Yes\n";
		int a = n, b = n - 1, c = n - 2;
		vector <int> v;
		for (int i = 1; i <= 2 * n; i++)
			if (i != a && i != b && i != c && i - n != a && i - n != b && i - n != c)
				v.push_back(i);
		
		for (int i = 0; i < v.size() - 1; i++)
			cout << v[i] << ' ' << v[i + 1] << '\n';
		
		cout << b << ' ' << a + n << '\n';
		cout << a << ' ' << c << '\n';
		cout << c << " 2\n";
		cout << "2 " << a + n << '\n';
		cout << a + n << ' ' << c + n << '\n';
		cout << "1 " << b + n << '\n';
		verif();
		return 0;
	}
	if (n % 4 == 0) {
		if ((n ^ (n - 1)) > n - 1) {
			cout << "No\n";
			return 0;
		}
		cout << "Yes\n";
		int a = n, b = n - 1, c = (n ^ (n - 1));
		vector <int> v = { b, c };

		for (int i = 1; i < n - 1; i++)
			if (i != c)
				v.push_back(i);
		for (int i = 0; i < n - 1; i++)
				v.push_back(v[i] + n);

		for (int i = 0; i < v.size() - 1; i++)
			cout << v[i] << ' ' << v[i + 1] << '\n';
		
		cout << n << ' ' << n - 1 << '\n';
		cout << 2 * n << ' ' << c << '\n';
		verif();
	}
	
	return 0;
}


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


void solve(long long K, long long S){
    long long counter = 0;
    for (long long i = 0; i < S+1; i++) {
        if (max(i, S-i) <= K) {
            counter += 1;
        }
    }
    for (long long i = 0; i < S; i++) {
        for (long long j=i+1; j < S+1; j++) {
            if (max(max(i, j-i), S-j) <= K) {
                counter += 1;
            }
        }
    }
    cout << counter << endl;
}

int main(){
    long long K;
    scanf("%lld",&K);
    long long S;
    scanf("%lld",&S);
    solve(K, S);
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <algorithm>
#include <sstream>
#include <map>
#include <set>

#define REP(i,k,n) for(int i=k;i<n;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1<<30
#define pb push_back
#define mp make_pair

using namespace std;
typedef long long ll;
typedef pair<int,int> P;

struct SCC {
	int n;
	vector<vector<int> > g, rg, ng, scc; // rg: ?????°??????, ng: ????§£????????°??????
	vector<int> res; // scc: ?????£?????????????±?????????????, res:?????£??????????????????
	bool used[100005];

	SCC(int _n) {
		n = _n;
		g.resize(n); rg.resize(n) ; scc.resize(n); res.resize(n);
	}

	SCC(const vector<vector<int> > &g) : n(g.size()), g(g), rg(n), scc(n), res(n) {
		rep(i, n) {
			rep(j, g[i].size()) rg[g[i][j]].push_back(i);
		}
	}

	/// i-j?????????????????????
	void add(int i, int j) {
		g[i].push_back(j);
		rg[j].push_back(i);
	}

	vector<int> vs;
	void dfs(int v) {
		used[v] = true;
		rep(i, g[v].size()) {
			if(!used[ g[v][i] ]) dfs(g[v][i]);
		}
		vs.push_back(v);
	}

	void rdfs(int v, int k) {
		used[v] = true;
		res[v] = k; 
		scc[k].push_back(v);
		rep(i, rg[v].size()) {
			if(!used[ rg[v][i] ]) rdfs(rg[v][i], k);
		}
	}

	void ng_make(int k) {
		ng.resize(k);
		rep(i, n) {
			rep(j, g[i].size()) {
				if(res[i] == res[g[i][j]]) continue;
				ng[res[i]].push_back(res[g[i][j]]);
			}
		}
	}

	int run() {
		memset(used, 0, sizeof(used));
		rep(i, n) {
			if (!used[i]) dfs(i);
		}

		memset(used, 0, sizeof(used));
		int k = 0;
		for (int i = vs.size()-1; i >= 0; i--) {
			if (!used[vs[i]]) rdfs(vs[i], k++);
		}

		ng_make(k);
		return k;
	}
};

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

	SCC scc(n);
	rep(i, m) {
		int s, t;
		cin >> s >> t;

		scc.add(s, t);
	}

	scc.run();

	int q;
	cin >> q;

	rep(i, q) {
		int s, t;
		cin >> s >> t;

		if(scc.res[s] == scc.res[t]) cout << 1 << endl;
		else cout << 0 << endl;
	}

	return 0;
}

Measured memory_bytes: 2992
#include <bits/stdc++.h>
using namespace std;
int main(){
    int count,i = 0,check = 0;
    const string s = "Y";
    cin >> count;
    //vector<string> box(count);
    string box;
    
    for(i = 0; i <= count;i++){
        cin >> box;
        if(box == s) {
            check = 1;
        }
    }
    if(check == 1){
        cout << "Four" << endl;
    }
    else{
        cout << "Three" << endl;
    }
    
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>

#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(a) (a).begin(), (a).end()

using namespace std;

int main()
{
    int N; cin >> N;
    unsigned long long v1, v2;

    v1 = 2;
    v2 = 1;

    if( N == 1 )
        cout << 1 << endl;
    else
    {
        REP(i, N-1)
        {
            unsigned long long next = v1 + v2;
            v1 = v2;
            v2 = next;
        }

        cout << v2 << endl;
    }

    return 0;
}


Measured memory_bytes: 256
import math
import sys

stdin = sys.stdin

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: map(int, stdin.readline().split())
nl = lambda: list(map(int, stdin.readline().split()))
mod = 10**9 + 7 
sys.setrecursionlimit(1000010)


S = ns()

if S[2] != S[3]:
    print('No')
    exit(0)

if S[4] != S[5]:
    print('No')
    exit(0)

print('Yes')




Measured memory_bytes: 3060
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <tuple>
#include <map>
#include <queue>
#include <math.h>
#include <set>
#include <stack>
#include <deque>
#include <bitset>
using namespace std;

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

	if (n % k == 0)
	{
		cout << 0 << endl;
	}
	else
	{
		cout << 1 << endl;
	}
}


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


int main(){
int  N,A,B;
cin>>N>>A>>B;
cout<<min(A,B)<<" "<<max(A+B-N,0)<<endl;
 return 0;
}
/*
10 3 5

3 0

10 7 5

5 2

100 100 100

100 100
*/

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

void ler(vector<long long>& v, int n) {
	for(int i = 0; i < n; i++) {
		long long val;
		scanf("%lld", &val);
		v.push_back(val);
	}
}

int main() {
	int x,y,a,b,c;
	scanf("%d %d %d %d %d", &x, &y, &a, &b, &c);
	
	vector <long long> red,green,col;
	ler(red, a);
	ler(green, b);
	ler(col, c);

	sort(red.rbegin(), red.rend());
	sort(green.rbegin(), green.rend());
	priority_queue <long long, vector<long long>, greater<long long>> pq;
	for(int i = 0; i < x; i++) pq.push(red[i]);
	for(int i = 0; i < y; i++) pq.push(green[i]);

	sort(col.rbegin(), col.rend());
	for(int i = 0; i < col.size(); i++) {
		if(pq.top() < col[i]) {
			pq.pop();
			pq.push(col[i]);
		}
	}

	long long resp = 0;
	while(!pq.empty()) {
		resp += pq.top();
		pq.pop();
	}

	printf("%lld\n",resp );

	return 0;
}

Measured memory_bytes: 4724
#include <iostream>

int main(){
    int flight[3];
    for(int idx = 0; idx < 3; ++ idx){
        std::cin >> flight[idx];
    }

    int ans = 9999999;
    for(int a = 0; a < 3; ++ a){
        for(int b = 0; b < 3; ++ b){
           if(a == b) continue;
           ans = std::min(ans, flight[a] + flight[b]);
        }
    }

    std::cout << ans << std::endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <list>
#include <cmath>

using namespace std;

int main() {
    char b;
    cin >> b;
    switch(b) {
        case 'A':
            cout << 'T' << endl;
        break;
        case 'T':
            cout << 'A' << endl;
        break;
        case 'C':
            cout << 'G' << endl;
        break;
        case 'G':
            cout << 'C' << endl;
        break;
        default:
        break;
    }
    

    return 0;
}

Measured memory_bytes: 256
s = list(input())
t = list(input())
s.sort()
t.sort()
t.reverse()
for i in range(min(len(s),len(t))):
    if s[i] < t[i]:
        print("Yes")
        break
    elif s[i] == t[i]:
        if s[min(len(s),len(t))-1] == t[min(len(s),len(t))-1]:
            if len(s) < len(t):
                print("Yes")
                break
            else:
                print("No")
                break
        continue
    else:
        print("No")
        break


Measured memory_bytes: 3064
#include<iostream>
using namespace std;
int main() {
	int n, a, b;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a >> b;
		int c = a%b;
		if (c == 0) cout << b << endl;
		else cout << c << endl;
	}
}

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

using namespace std;

int main(){
  vector<vector<int>> f;
  int N, K = 0;

  cin>>N;

  f.resize(N, vector<int>(N));

  for(int i = 0; i < N; i++){
    for(int j = 0; j < N; j++){
      f[i][j] = (i+j)%2;
    }
  }

  for(int i = 0; i < N; i++){
    if(f[0][i] == 1) f[0][i] = 2, K++;
  }

  for(int i = 1; i < N; i+=3){
    for(int j = 0; j < N; j++){
      // cout<<j<<" "<<i<<endl;
      if(f[j][i] == 1) f[j][i] = 2, K++;
    }
  }


  for(int j = 1; j < N; j++){
      if(f[j][N-1] == 1) f[j][N-1] = 2, K++;
  }
  /*
  for(int i = 0; i < N; i++){
    for(int j = 0; j < N; j++){
      cout<<f[i][j];
    }cout<<endl;
  }
  */


  cout<<K<<endl;

   for(int i = 0; i < N; i++){
    for(int j = 0; j < N; j++){
      if(f[i][j] == 2) {
         cout<<i<<" "<<j<<endl;

      }
    }
  }

  return 0;
}


Measured memory_bytes: 5504
n, k = map(int, input().split())
s = input()

nums = []
now = 1 # 今見ている値
cnt = 0 # 今見ている値の連続する個数
for i in range(n):
    if s[i] == str(now): # 今見ているもの同じ場合
        cnt += 1
    else:
        nums.append(cnt)
        now ^= 1
        cnt = 1
# 最後の部分を追加
nums.append(cnt)
# 配列の大きさが奇数でないなら，0を追加
if len(nums) % 2 == 0:
    nums.append(0)

# 尺取法
left, right = 0, 0
tmp = 0 # [left, right)の総和

res = 0
for i in range(0, len(nums), 2): # 1のところを見ていく
    nextleft, nextright = i, min(i + 2 * k + 1, len(nums))
    while nextleft > left:
        tmp -= nums[left]
        left += 1
    while nextright > right:
        tmp += nums[right]
        right += 1
    res = max(res, tmp)
    
print(res)

Measured memory_bytes: 74404
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        if (a + b >= c) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
}

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

#define FOR(a, b, c) for(int a = b; a <= c; ++a)
#define FORW(a, b, c) for(int a = b; a >= c; --a)
#define int long long
#define pb push_back

const int N = 3009;

int n, k;
int val[N];
vector<int> vi[N];
bool visit[N];

void dfs(int pre, int u)    {
    for(int v: vi[u])   if(v != pre) {
        dfs(u, v);
        if(val[v] < val[u] && visit[v] == false) visit[u] = true;
    }
}

bool solve(int x)   {
    memset(visit, 0, sizeof visit);
    dfs(x, x);
    return visit[x];
}

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    cin >> n;
    FOR(i, 1, n) cin >> val[i];
    FOR(i, 1, n - 1)    {
        int u, v; cin >> u >> v;
        vi[u].pb(v); vi[v].pb(u);
    }

    FOR(i, 1, n)    {
        if(solve(i))
            cout << i << ' ';
    }

    return 0;
}


Measured memory_bytes: 640
def find_common(left, right)
  result = ''
  grouped_left = left.split('').group_by{|x|x}
  grouped_right = right.split('').group_by{|x|x}
  ('a'..'z').to_a.each do |chr|
    l = grouped_left[chr]
    l_count = l ? l.size : 0
    r = grouped_right[chr]
    r_count = r ? r.size : 0
    result += chr*[l_count, r_count].min
  end
  result
end

n = gets.strip.to_i
s = readlines.map {|line| line.strip }

result = s.reduce {|sum, str|
  find_common(sum, str)
}

puts result.split('').sort.join('')





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

using namespace std;
using ll =long long;
#define SORT(a) sort((a).begin(),(a).end())
#define rSORT(a) reverse((a).begin(),(a).end())
#define For(i, a, b)    for(int i = (a) ; i < (b) ; ++i)
#define rep(i, n)       For(i, 0, n)
#define debug(x)  cerr << #x << " = " << (x) << endl;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
void coY() {cout <<"Yes"<<endl;}
void coN(){cout <<"No"<<endl;}
const ll INF = 1LL << 60;
const int mod = 1e9+7;
#define leftunique(a) {SORT(a);(a).erase(unique((a).begin(),(a).end()),(a).end());}
//Write From this Line

int main()
{
	int n;
	cin >> n;
	vector<int> a(n);
	rep(i,n) cin >>a[i];
	leftunique(a);
	cout << a.size() << endl;

}


Measured memory_bytes: 256
object Main extends App {
	override def main(args: Array[String]) = {
		val sc = new java.util.Scanner(System.in)
		val w,h,x,y,r = sc.nextInt()
		
		println(solve(w,h,x,y,r))
	}
	
	def solve(w:Int, h:Int, x:Int, y:Int , r:Int):String = {
		val rect = new Rectangle(w,h)
		val cir = new Circle(x,y,r)
		rect.contains(cir) match {
			case true => "Yes"
			case false => "No"
		}
	}
	
}

class Rectangle(val w:Int, val h:Int){
	
	def contains(circle: Circle):Boolean = {
		isValidX(circle.getLeft) &&
		isValidX(circle.getRight) &&
		isValidY(circle.getBottom) &&
		isValidY(circle.getTop)
	}
	
	def isValidX(x:Int):Boolean = {
		0 <= x && x <= w
	}
	
	def isValidY(y:Int):Boolean = {
		0 <= y && y <= h
	}

}
class Circle(val x:Int , val y:Int , val r:Int){
	val getBottom = y - r
	val getTop = y + r
	val getLeft = x - r
	val getRight = x + r
	
}

Measured memory_bytes: 45132
S = input()
K = int(input())

s1 = list(S)
c1 = 0
for i in range(1, len(s1)):
  if s1[i-1] == s1[i]:
    s1[i] = ''
    c1 += 1

if K == 1 or s1[-1] != s1[0]:
  print(c1 * K)
else:
  s2 = s1[-1:] + list(S)
  c2 = 0
  for i in range(1, len(s2)):
    if s2[i-1] == s2[i]:
      s2[i] = ''
      c2 += 1
  if s2[-1] == s1[0]:
    print(c1 + c2*(K-1))
  else:
    print(c1*(K - K//2) + c2*(K//2))

Measured memory_bytes: 3064
#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, k, d;
    cin >> n >> k;
    int count[n] = {};
    for(int i=0;i<k;++i)
    {
        cin >> d;
        for(int j=0;j<d;++j)
        {
            int tmp;
            cin >> tmp;
            count[tmp-1]++;
        }
    }
    int ret = 0;
    for(int i=0;i<n;++i)
    {
        if(count[i] == 0) ret++;
    }

    cout << ret << endl;
}

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

int main(){

  int w,a,b;

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

  if(abs(a - b) <= w) printf("0\n");
  
  else printf("%d\n", abs(a - b) - w);

  return 0;
}

Measured memory_bytes: 256