akhauriyash/Code-Regression huggingface dataset:
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;

#define rep(i, n) REP(i, 0, n)
#define repr(i, n) for (int i = (n); i >= 0; i--)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for (int i = x; i < n; i++)
#define OP(m) cout << m << endl
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;

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

    vector<ll> d(61, 0);

    rep(i, n) rep(j, 61) d[j] += a[i] >> j & 1; //各桁の１の合計

    ll x = 0, sum = 0;
    repr(i, 60)
    {
        if (d[i] < n - d[i] && x + (1LL << i) <= k) //０の方が多い場合は桁を１にする。
        {
            x += 1LL << i;
            sum += (n - d[i]) * 1LL << i;
        }
        else
            sum += d[i] * 1LL << i;
    }
    OP(sum);

    return 0;
}

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

int main(){
  string s;
  long long k;
  cin>>s>>k;
  for(int i=0;i<k;++i){
    if(s[i]!='1'){
      cout << s[i] << endl;
      return 0;
    }
  }
  cout << 1 << endl;
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
typedef long long ll;
const int Max = 1e6 + 5;
string lst[Max], ls[Max];

int main()
{
	int n, m;
	cin >> n >> m;
	for (int i = 1; i <= n; i++) cin >> lst[i];
	for (int j = 1; j <= m; j++) cin >> ls[j];
	int f = 0;
	for (int i = 1; i <= n - m+1; i++)
	{
		for (int j = 1; j <= n - m+1; j++)
		{
			int tf = 1;
			for (int k = 0; k <= m-1; k++)
			{
				string str;
				str = lst[i + k].substr(j-1, m);
				if (ls[k + 1] != str)
				{
					tf = 0;
					break;
				}
			}
			if (tf == 1) f = 1;
		}
	}
	if (f)cout << "Yes" << endl;
	else cout << "No" << endl;

}

Measured memory_bytes: 49988
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using VI = vector<int>;
using VL = vector<ll>;
template<class T> using PQ = priority_queue<T, vector<T>, greater<T>>;
#define FOR(i,a,n) for(int (i)=(a);(i)<(n);++(i))
#define eFOR(i,a,n) for(int (i)=(a);(i)<=(n);++(i))
#define rFOR(i,a,n) for(int (i)=(n)-1;(i)>=(a);--(i))
#define erFOR(i,a,n) for(int (i)=(n);(i)>=(a);--(i))
#define each(i, a) for(auto &i : a)
#define SORT(i) sort((i).begin(),(i).end())
#define rSORT(i,a) sort((i).begin(),(i).end(),(a))
#define all(i) (i).begin(),(i).end()
#define out(y,x) ((y) < 0 || h <= (y) || (x) < 0 || w <= (x))
#define line cout << "------------------------\n" 
#define ENDL(i,n) ((i) == (n) - 1 ? "\n" : " ")
#define stop system("pause")
constexpr ll INF = 1000000000;
constexpr ll LLINF = 1LL << 60;
constexpr ll mod = 1000000007;
constexpr ll MOD = 998244353;
const long double pi = acos(-1);
const long double eps = 1e-10;
template<class T>inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; }return 0; }
template<class T>inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; }return 0; }
inline void init() { cin.tie(nullptr); cout.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); }
template<class T>inline istream& operator>>(istream& is, vector<T>& v) { for (auto& elemnt : v)is >> elemnt; return is; }
template<class T, class U>inline istream& operator>>(istream& is, pair<T, U>& p) { is >> p.first >> p.second; return is; }
template<class T>inline vector<T> vec(size_t a) { return vector<T>(a); }
template<class T>inline vector<T> defvec(T def, size_t a) { return vector<T>(a, def); }
template<class T, class... Ts>inline auto vec(size_t a, Ts... ts) { return vector<decltype(vec<T>(ts...))>(a, vec<T>(ts...)); }
template<class T, class... Ts>inline auto defvec(T def, size_t a, Ts... ts) { return vector<decltype(defvec<T>(def, ts...))>(a, defvec<T>(def, ts...)); }

int main() {
    init();

    int n; ll k; cin >> n >> k;
    VL a(n + 1);
    eFOR(i, 1, n) {
        cin >> a[i];
        (--a[i] += a[i - 1]) %= k;
    }

    map<ll, ll> cnt;
    ll ans = 0;
    int itr = 0;
    eFOR(i, 0, n) {
        --cnt[a[i]];
        while (itr <= n && itr < i + k)++cnt[a[itr++]];
        ans += cnt[a[i]];
    }

    cout << ans << "\n";

}


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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

int N,A;
const ll mo=1000000007;

const int NUM_=10400001;
static ll fact[NUM_+1],factr[NUM_+1],inv[NUM_+1];

ll pat[5050][5050];


void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>N>>A;
	inv[1]=fact[0]=factr[0]=1;
	for (int i=2;i<=NUM_;++i) inv[i] = inv[mo % i] * (mo - mo / i) % mo;
	for (int i=1;i<=NUM_;++i) fact[i]=fact[i-1]*i%mo, factr[i]=factr[i-1]*inv[i]%mo;
	
	ll ret=0;
	for(i=1;i<=A;i++) {
		int a,b,c;
		if(i==A) {
			a=i;
			b=N-i;
			c=0;
		}
		else {
			a=i;
			b=N-A;
			c=A-i-1;
		}
		
		ll sum=0;
		for(j=i-1;j>=0;j--) {
			pat[i][j]=fact[a-j]*fact[(a-j)+b-1]%mo*factr[(a-j)-1]%mo;
			(pat[i][j]*=fact[a]*factr[j]%mo*factr[a-j]%mo*fact[(a-j)+b+c]%mo*factr[(a-j)+b]%mo)%=mo;
			if(j&1) ret-=pat[i][j];
			else ret+=pat[i][j];
		}
	}
	cout<<(ret%mo+mo)%mo<<endl;
	
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}


Measured memory_bytes: 364104
var i,n,m,l,r,min,max:longint;

begin
  readln(n,m);
  min:=1;
  max:=n;
  for i:=1 to m do begin
    readln(l,r);
    if l>min then min:=l;
    if r<max then max:=r
  end;
  if max-min<0 then writeln(0) else writeln(max-min+1);
end.

Measured memory_bytes: 128
#include<iostream>
#include<string>
#include<algorithm>
#include<cstdio>
using namespace std;

int main(){
	int a,b;
	cin >> a >> b;
	cout << a/b << " " << a%b << " ";
	printf("%.8f\n",(double)a/(double)b);
	return 0;
}


Measured memory_bytes: 3228
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.next()) + Integer.parseInt(sc.next()) + Integer.parseInt(sc.next());

		if (n > 21) {
			System.out.println("bust");
		}else {
			System.out.println("win");
		}
	}



}


Measured memory_bytes: 22100
#include <bits/stdc++.h>
#define rep(i, to) for (int i = 0; i < (to); ++i)
#define repf(i, from, to) for (int i = (from); i < (to); ++i)
#define unless(cond) if (!(cond))
using namespace std;
using ll = long long;
template <typename T>
using V = vector<T>;
template <typename T, typename U>
using P = pair<T, U>;

int main() {
  int n;
  V<int> a;
  cin >> n;
  a.resize(n + 1);
  repf(i, 1, n + 1) {
    cin >> a[i];
  }

  int label = 1;
  int count = 0;
  bool found = false;
  while(true) {
    if(label == 2) {
      found = true;
      break;
    }
    if(count >= n - 1) {
      break;
    }

    count++;
    label = a[label];
  }

  if(found) {
    cout << count << endl;
  } else {
    cout << -1 << endl;
  }
}


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

int main(){
  
  ll n;
  cin >> n;
  vector<ll> a(n),b(n);
  rep(i,n) cin >> a[i];
  rep(i,n) cin >> b[i];
  ll sumA = accumulate(all(a),0LL);
  ll sumB = accumulate(all(b),0LL);
  if(sumA < sumB){
    cout << -1 << endl;
    return 0;
  }
  vector<ll> c(0);
  ll d = 0;
  ll ans1 = 0;
  rep(i,n){
    if(a[i]-b[i] >= 0){
      c.push_back(a[i]-b[i]);
    }else{
      d += b[i]-a[i];
      ans1 ++;
    }
  }
  if(ans1 == 0){
    cout << 0 << endl;
    return 0;
  }
  sort(all(c));
  reverse(all(c));
  ll ans2 = 0;
  for(ll p : c){
    ans2 ++;
    d -= p;
    if(d < 0) break;
  }
  cout << ans1 + ans2 << endl;
}

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

using namespace std;

typedef struct{
  char suit;
  int number;
}Card;

void show(Card A[],const int size){
  for(int i=0;i < size;i++){
    cout << A[i].suit << A[i].number;
    if(i == size-1) cout << endl;
    else cout << " ";
  }
}

void bubblesort(Card A[],const int size){
  for(int i=1;i < size;i++){
    for(int j=1;j < size-i+1;j++){
      if(A[j-1].number > A[j].number){
        Card tmp = A[j];
        A[j] = A[j-1];
        A[j-1] = tmp;
      }
    }
  }
  show(A,size);
}

void selectionsort(Card A[],const int size){
  for(int i=0;i < size;i++){
    int min_idx = i;
    for(int j=i;j < size;j++){
      if(A[min_idx].number > A[j].number) min_idx = j;
    }
    Card tmp = A[i];
    A[i] = A[min_idx];
    A[min_idx] = tmp;
  }
  show(A,size);
}


bool check_stable(Card A[],Card B[],const int size){
  for(int i=0;i < size;i++){
    if(A[i].number == B[i].number && A[i].suit != B[i].suit) {
      return false;
    }
  }
  return true;
}

int main(){
  int N;
  bool stable = true;
  cin >> N;
  Card C1[36],C2[36];
  for(int i=0;i < N;i++){
    cin >> C1[i].suit >> C1[i].number;
    C2[i] = C1[i];
  }
  bubblesort(C1,N);
  cout << "Stable" << endl;
  selectionsort(C2,N);
  if(check_stable(C1,C2,N)) cout << "Stable" << endl;
  else cout << "Not stable" << endl;
  return 0;
}


Measured memory_bytes: 3108
from collections import Counter


def main():
    n = input()
    a = [int(v) for v in input().split()]
    count = dict(Counter(a))
    q = int(input())

    ans = 0
    for k, v in count.items():
        ans += k*v

    for i in range(q):
        b, c = map(int, input().split())
        ans = ans - count.get(b, 0) * b + count.get(b, 0) * c
        print(ans)
        count[c] = count.get(c, 0) + count.get(b, 0)
        count[b] = 0


if __name__ == '__main__':
    main()


Measured memory_bytes: 102748
data = [                                      
    "{0} {1}".format(s, r)                    
    for s in ('S', 'H', 'C', 'D')             
    for r in range(1, 13+1)                   
    ]                                         
                                              
count = int(input())                          
for c in range(count):                        
    card = input()                            
    data.remove(card)                         
                                              
for c in data:                                
    print(c)                                  

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

int main() {
    int n; cin >> n;
    vector<pair<int, int>> ns(n); 
    for (int i=0; i<n; i++) {
        int a; cin >> a;
        ns[i].first = a;
        ns[i].second = i;
    }
    sort(ns.begin(), ns.end());
    vector<int> index(n);
    for (int i=0; i<n; i++) {
        index[ns[i].second] = i;
    }

    const int med = (n / 2);
    for (int i=0; i<n; i++) {
        if (index[i] < med) {
            cout << ns[med].first << endl;
        } else {
            cout << ns[med-1].first << endl;
        }
    }
} 


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

using namespace std;

int main(void) {
    int N, M;
    cin >> N >> M;

    vector <int> res(M);
    for (int i = 0; i < M; i++) {
        res[i] = 0;
    }

    for (int i = 0; i < N; i++) {
        int K;
        cin >> K;
        for (int j = 0; j < K; j++) {
            int A;
            cin >> A;
            res[A - 1]++;
        }
    }

    int ans = 0;
    for (int i = 0; i < M; i++) {
        if (res[i] == N) {
            ans++;
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()

int num(int n) {
  int cnt = 0;
  while(n%2 == 0) {
    cnt++;
    n /= 2;
  }
  return cnt;
}


int main() {
  int n, ans = 0;
  cin >> n;
  rep(i, n) {
    int a;
    cin >> a;
    ans += num(a);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;

class WithIndex<T>
{
    public T Value;
    public int Index;
    public WithIndex(T value, int index)
    {
        this.Value = value;
        this.Index = index;
    }
}

static class Template
{
    public static int LineToInt()
    {
        return int.Parse(Console.ReadLine());
    }

    public static string[] LineToStrings()
    {
        return Console.ReadLine().Split();
    }

    public static int[] LineToInts()
    {
        return LineToStrings()
            .Select(s => int.Parse(s))
            .ToArray();
    }


    public static int[,] LinesToIntTable(int lineCount, int columnCount)
    {
        var value = new int[lineCount, columnCount];
        foreach (var y in Enumerable.Range(0, lineCount))
        {
            var ints = LineToInts();
            foreach (var x in Enumerable.Range(0, columnCount))
            {
                value[y, x] = ints[x];
            }
        }
        return value;
    }

    public static IEnumerable<WithIndex<T>> WithIndex<T>(this IEnumerable<T> sequence)
    {
        int index = 0;
        foreach (var item in sequence)
        {
            yield return new WithIndex<T>(item, index);
            index++;
        }
    }

    static void Main(string[] args)
    {
        var input = LineToInts();
        var a = input[0];
        var b = input[1];
        var sum = a + b;
        if (sum % 2 == 0)
        {
            Console.WriteLine(sum / 2);
        }
        else
        {
            Console.WriteLine("IMPOSSIBLE");
        }
    }
}



Measured memory_bytes: 13396
#include<cstdio>
#include<algorithm>
using namespace std;
#define MAXN 200005
#define MOD 1000000007
#define LL long long
int H,W,A,B,N;
int a[MAXN];
LL s[MAXN],inv[MAXN];
LL Pow(LL a,int b)//快速幂
{
	LL ans=1;
	while(b)
	{
		if(b&1) ans=ans*a%MOD;
		a=a*a%MOD;
		b>>=1;
	}
	return ans;
}

void Pre()
{
	s[0]=1;
	for(int i=1;i<=N;i++)
		s[i]=s[i-1]*i%MOD;   //阶乘
	inv[0]=1;
	inv[N]=Pow(s[N],MOD-2);
	for(int i=N-1;i>0;i--)
		inv[i]=inv[i+1]*(i+1)%MOD;
}

LL C(int a,int b)
{
	if(a<0||b<0) return 1;
	return s[a]*inv[b]%MOD*inv[a-b]%MOD;
}
int main()
{
	scanf("%d %d %d %d",&H,&W,&A,&B);
	N=H+W-2;
	Pre();
	LL ans=0;
	for(int i=B+1;i<=W;i++)
	{
		ans+=C(H-A+i-2,i-1)*C(A+W-i-1,A-1)%MOD;
		ans=(ans%MOD+MOD)%MOD;
	}
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 3328
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};
    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };
    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };
    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };
    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };
    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        t: f64,
        x: f64
    }
    println!("{}", t / x);
}


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

const ll mod = 1e9+7;
const ll INF = 1e18;
const double pi = acos(-1);


int main(void)
{
    ll n,a,b; cin>>n>>a>>b;
    cout << max(0LL,(b*(n-1)+a)-(a*(n-1)+b)+1) << endl;
    return 0;
}

Measured memory_bytes: 3624
#include "bits/stdc++.h"

#define ALL(g) (g).begin(),(g).end()
#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i, x, n) for(int i = x; i >= n; i--)
#define rrep(i, n) RREP(i,n,0)
#define pb push_back
#pragma GCC optimize ("-O3")

using namespace std;

#define DEBUG_IS_VALID

#ifdef DEBUG_IS_VALID
#define DEB 1 
#else
#define DEB 0
#endif
#define DUMPOUT cout
#define dump(...) if(DEB) DUMPOUT<<"  "<<#__VA_ARGS__<<" :["<<__LINE__<<":"<<__FUNCTION__<<"]"<<endl<<"    "; if(DEB) dump_func(__VA_ARGS__)
template<typename T1,typename T2>ostream& operator << (ostream& os, pair<T1,T2> p){cout << "(" << p.first << ", " << p.second << ")"; return os;}
template<typename T>ostream& operator << (ostream& os, vector<T>& vec) { os << "{"; for (int i = 0; i<vec.size(); i++) os << vec[i] << (i + 1 == vec.size() ? "" : ", "); os << "}"; return os; }
template<typename T>ostream& operator << (ostream& os, set<T>& st){for(auto itr = st.begin(); itr != st.end(); itr++) cout << *itr << (next(itr)!=st.end() ? ", " : ""); cout << "}"; return os;}
template<typename T1,typename T2>ostream& operator << (ostream& os, map<T1,T2> mp){cout << "{"; for(auto itr = mp.begin(); itr != mp.end(); itr++) cout << "(" << (itr->first) << ", " << (itr->second) << ")" << (next(itr)!=mp.end() ? "," : ""); cout << "}"; return os; }

void dump_func(){DUMPOUT << endl;}
template <class Head, class... Tail>void dump_func(Head&& head, Tail&&... tail){ DUMPOUT << head; if (sizeof...(Tail) == 0) { DUMPOUT << " "; } else { DUMPOUT << ", "; } dump_func(std::move(tail)...);}
template<class T> inline bool chmax(T& a,T const& b){if(a>=b) return false; a=b; return true;}
template<class T> inline bool chmin(T& a,T const& b){if(a<=b) return false; a=b; return true;}

using ll = long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;

const int mod=1e9+7,INF=1<<29;
const double EPS=1e-12,PI=3.1415926535897932384626;
const ll lmod = 1e9+7,LINF=1LL<<59; 

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  string s; cin >> s ;
  int N = s.size();
  int ans;
  if(N%2) ans = (N-1)/2;
  else ans = N/2;
  int l = N-ans;
  int r = ans-1;
  bool is_ok = true;
  int col = -1;
  for(int i = ans+1; i <= N; ){
    l--; r++; // l,rが同じ色か
    if(col==-1){
      col = int(s[l]-'0');
    }else{
      is_ok &= (col==(s[l]-'0'));
    }
    is_ok &= (col==(s[r]-'0'));
    if(is_ok) continue;
    ans = r;
    break;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 512
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>

#define rep(i,a) for(int i = 0 ; i < a ; i ++)
#define loop(i,a,b) for(int i = a ; i < b ; i ++)
#define vi vector<int>
#define vs vector<string>
#define pii pair<int, int>
#define f first
#define s second
#define pb push_back
using namespace std;

string twice(string s, int n){
  string ret = "";
  rep(i,n/2)ret += s[i];
  rep(i,n/2)ret += s[i];
  return ret;
}

string split(string s, int n){
  string ret = "";
  rep(i,n)ret += s[i];
  return ret;
}

int main(void){
  string s;
  cin>>s;
  int ret = 0;
  for(int i = 0 ; i < s.size() ; i += 2){
    // cout<<twice(s, i)<<endl;
    // cout<<split(s, i)<<endl;
    if(twice(s, i) == split(s, i)){
      ret = i;
    }
  }
  cout<<ret<<endl;
}

Measured memory_bytes: 256
program prob3
    implicit none
    character(len=200005) :: s 
    integer :: ans
    character(len=2) :: tmp
    integer :: i

    read(*,*) s
    
    ans = 1
    tmp = s(1:1)
    do i = 2, len_trim(s)
        if(tmp == s(i:i)) then
            tmp = ""
        else if(tmp == "") then
            tmp = "aa"
            ans = ans + 1
        else
            tmp = s(i:i)
            ans = ans + 1
        end if
    end do
    
    
    write(*,*) ans
    stop
contains
end program prob3

Measured memory_bytes: 1084
import java.util.*;

public class Main {
	
	
	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt(),a=sc.nextInt();
		int ans;
		if(x<a) {
			ans = 0;
		}else ans = 10;
		
		System.out.println(ans);
		
	}

}


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

// int/long:		-2147483648 - 2147483648 (-2^31 <= int < 2^31)
// long/long long:	-9223372036854775808 - 9223372036854775807 (-2^63 <= long < 2^63)

#define	INF (1<<29)
//536870912

// lower_bound(A.begin(), A.end(), N)
// upper_bound(...

// bit: &/and, |/or, ^/xor, ~/not

#define	MOD 1000000007

int	main() {
	int N;
	cin >>N;
	for (int i=1; i<=9; i++) {
		if (0==N%i) {
			if (10>N/i) {
				cout <<"Yes" <<endl;
				return 0;
			}
		}
	}
	cout <<"No" <<endl;
	return 0;
}



Measured memory_bytes: 256
import math
from sys import stdin


def get_result(data):
    K = data[0]
    ans_list = []
    for i in range(K):
        for j in range(K):
            for k in range(K):
                ans = math.gcd(i+1, j+1)
                ans = math.gcd(ans, k+1)
                ans_list.append(ans)
    return sum(ans_list)


if __name__ == '__main__':
    data = list(map(int, stdin.readline().rstrip().split(' ')))
    result = get_result(data)
    print(result)


Measured memory_bytes: 188436
// lcmとか__builtin_popcountとかはg++ -std=c++17 default.cppみたいなかんじで

#include <bits/stdc++.h>
#define mod 1000000007
#define INF LLONG_MAX
#define ll long long
#define ln cout<<endl
#define Yes cout<<"Yes"<<endl
#define NO cout<<"NO"<<endl
#define YES cout<<"YES"<<endl
#define No cout<<"No"<<endl
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
using namespace std;
ll dx[4]={1,0,-1,0};
ll dy[4]={0,1,0,-1};

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

    ll  a,b,c,d,e,n,k,maxi=0,f=0,mini=INF,sum=0,q;
	string str,g;
    cin>>a>>b>>c>>d;
    rep(i,101){
        if(a<=i&&c<=i&&i<b&&i<d) sum++;
    }
    cout<<sum<<endl;
    return 0;
}


Measured memory_bytes: 3608
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int ans = 0;

        for (int i = 1; i < N+1; i++) {
            for (int j = 1; j < N+1; j++) {
                for (int k = 1; k <  N+1; k++) {
                        ans += gcd(gcd(i, j), k);
                }
            }
        }

        System.out.println(ans);
    }

    static int gcd (int num1, int num2) {
        if(num2  == 0) return num1;
        else return gcd(num2, num1%num2);
    }
}


Measured memory_bytes: 35656
#include <bits/stdc++.h>
using namespace std;
 
#define int long long
//#define uint __int128_t
 
#define pb push_back
#define fi first
#define se second
#define rep(i,s,n) for(int i = s;i<n;i++)
#define repe(i,s,n) for(int i = s;i<=n;i++)
#define rrep(i,s,n) for(int i = (n)-1;i>=(s);i--)
#define all(v) (v).begin(),(v).end()
#define chmin(a,b) a=min((a),(b))
#define chmax(a,b) a=max((a),(b))
#define low(a,b) lower_bound(all(a),(b))-(a).begin()
#define upp(a,b) upper_bound(all(a),(b))-(a).begin()
#define endl '\n'
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0)
typedef long long ll;
typedef pair<int,int>pint;
typedef vector<int>vint;
typedef vector<vint> vvint;
typedef vector<pint>vpint;
typedef pair<pint,int> P1;
typedef pair<int,pint> P2;
typedef pair<pint,pint> PP;
static const ll maxLL = (ll)1 << 62;
const ll MOD=1000000007;
const ll INF=1e18;
 
int W,H;
vpint v;

signed main() {
    IOS();
    //(1ll<<N)シフト演算のオーバーフローに気をつける
    //MOD同士の引き算に注意
    cin>>W>>H;
    v.resize(W+H);
    rep(i,0,W+H){
        int x;cin>>x;
        v[i]={x,i};
    }
    sort(all(v));
    int a=W+1,b=H+1,ans=0;
    rep(i,0,H+W){
        if(v[i].se<W){
            ans+=b*v[i].fi;
            a--;
        }else{
            ans+=a*v[i].fi;
            b--;
        }
    }
    cout<<ans<<endl;
    
    
    
    
    
    
    
    
    
    
    
    return 0;
}

Measured memory_bytes: 3580
using System;
using System.Collections.Generic;
using System.Linq;

public class Solution
{
    public static void Main()
    {
        var vals = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
        var N = vals[0];
        var K = vals[1];
        var A = Console.ReadLine().Split(' ').Select(long.Parse).ToArray();
        var results = Enumerable.Range(0, N - K).Select(i => A[i] < A[i + K]).ToArray();
        Console.WriteLine(string.Join(Environment.NewLine, results.Select(b => b ? "Yes" : "No")));
    }
}

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

using namespace std;

void call(int n){
  int i = 1;
 CHECK_NUM:
  int x = i;
  if ( x % 3 == 0 ){
    cout << " " << i;
    goto END_CHECK_NUM;
  }
 INCLUDE3:
  if ( x % 10 == 3 ){
    cout << " " << i;
    goto END_CHECK_NUM;
  }
  x /= 10;
  if ( x ) goto INCLUDE3;
 END_CHECK_NUM:
  if ( ++i <= n ) goto CHECK_NUM;

  cout << endl;
  }
  
  int main(){
  	int n;
  	cin>>n;
  	call(n);
  }


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

int main() {

	string cards;
	int m, h;

	while (cin >> cards, cards.compare("-")) {

		cin >> m;
		for (int i = 0; i < m; ++i) {
			cin >> h;
			cards.append(cards.substr(0, h)).erase(0, h);
		}
		cout << cards << endl;
	}

	return 0;
}

Measured memory_bytes: 1228
#include<iostream>
#include<iomanip>
#include<cassert>
#include<math.h>
#include<complex>
#include<algorithm>
#include<utility>
#include<queue>
#include<string.h>
#include<string>
#include<set>
#include<map>
#include<unordered_map>
#include<functional>
#include<vector>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
const ll INF=2e18;
const ll MOD=1e9+7;

ll a,b,c;
int main(){
    cin>>a>>b>>c;
    if(c-a-b<=0){
        cout<<"No";
        return 0;    }
    
    if(4*a*b<(c-a-b)*(c-a-b)){
        cout<<"Yes";
    }else{
        cout<<"No";
    }

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  const int N = 30;
  vector<long long> DP;
  DP.push_back(1);
  for (int i = 1; i <= N; i++) {
    int size = static_cast<int>(DP.size());
    long long var = 0;
    if (i - 3 >= 0) var += DP.at(size - 3);
    if (i - 2 >= 0) var += DP.at(size - 2);
    if (i - 1 >= 0) var += DP.at(size - 1);
    DP.push_back(var);
  }

  long long n;
  cin >> n;
  while (n != 0) {
    long long var = DP.at(n);
    int year = ceil(var / 3650.0);
    cout << year << endl;
    cin >> n;
  }
}



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

unordered_map<ll, ll> dp;
const ll INF = 1e12;
ll n, a, b, c, d;
ll gao(ll x) {
    if(x == 0) return 0;
    if(x == 1) return d;
    auto it = dp.find(x);
    if(it != dp.end()) return it->second;
    dp[x] = min({d>INF/x?INF:d*x, gao(x/2)+d*(x-x/2*2)+a, gao((x+1)/2)+d*((x+1)/2*2-x)+a,
                     gao(x/3)+d*(x-x/3*3)+b, gao((x+2)/3)+d*((x+2)/3*3-x)+b,
                     gao(x/5)+d*(x-x/5*5)+c, gao((x+4)/5)+d*((x+4)/5*5-x)+c});
    return dp[x];
}
void solve() {
    dp.clear();
    cin >> n >> a >> b >> c >> d;
    cout << gao(n) << '\n';
}
int main() {
    int T; scanf("%d", &T);
    while(T--) solve();
    return 0;
}

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

int main(int argc, const char * argv[]) {
    // insert code here...
    vector<int> v {0, 1, 3, 1, 2, 1, 2, 1, 1, 2, 1 ,2, 1};
    int x, y;
    cin >> x >> y;
    cout << (v[x] == v[y] ? "Yes" : "No") << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
int main()
{
  ll a,b,c,k;
  cin>>a>>b>>c>>k;
  if(k<=a)
    cout<<k<<endl;
  else if(k<=a+b)
    cout<<a;
  else 
  {
    cout<<a-1*(k-a-b)<<endl;
  }
  return 0;
}
  

Measured memory_bytes: 3520
package main

import "fmt"

var n, m, q int
var a, b, c, d []int
var max int

func main() {
	fmt.Scan(&n, &m, &q)
	a = make([]int, q)
	b = make([]int, q)
	c = make([]int, q)
	d = make([]int, q)
	for i := 0; i < q; i++ {
		fmt.Scan(&a[i], &b[i], &c[i], &d[i])
		a[i]--
		b[i]--
	}
	for i := 1; i <= m; i++ {
		dfs([]int{i})
	}
	fmt.Println(max)
}

func dfs(vs []int) {
	if len(vs) == n {
		calc(vs)
		return
	}
	last := vs[len(vs)-1]
	for i := last; i <= m; i++ {
		dfs(append(vs, i))
	}
}

func calc(vs []int) {
	sum := 0
	for i := 0; i < q; i++ {
		if vs[b[i]]-vs[a[i]] == c[i] {
			sum += d[i]
		}
	}
	if sum > max {
		max = sum
	}
}


Measured memory_bytes: 5972
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const long long mod = 1e9+7;
long long power(long long a, long long b, long long m = mod) {
    if(b < 0) {
        return power(power(a, -b), mod-2);
    }
    long long x = 1;
    while(b) {
        if(b & 1) {
            x = 1ll * x * a % m;
        }
        a = 1ll * a * a % m;
        b /= 2;
    }
    return x;
}
const int N = 3e5+9;
signed main() {  
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    
    int m, k; cin >> m >> k;
    if(m < 2) {
        m++;
        if(k == 0) {
            for(int i = 0; i < 2*m; i++) {
                cout << i/2 << " ";
            }
            cout << "\n";
        } else {
            cout << "-1\n";
        }
        return 0;
    }
    if(k >= (1<<m)) {
        cout << "-1\n";
        return 0;

    }
    cout << k << " ";
    for(int i = 0; i < (1<<m); i++) {
        if(i != k) cout << i << " ";
    }
    cout << k << " ";
    for(int i = (1<<m)-1; i>= 0; i--) {
        if(i != k) cout << i << " ";
    }
    cout << "\n";








    return 0;
    
}

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

using namespace std;


int main(){
    int N, L;
    cin >> N >> L;
    int ans=0;
    for(int i=0;i<N;i++) ans += L+i;
    if(L >= 0) ans -= L;
    else if(N+L <=0) ans -= N+L-1;
    cout << ans << endl;
}


Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;
public class Main {
public static void main(String[]srgs) {
	Scanner s=new Scanner(System.in);
	int a=s.nextInt();
	int x=s.nextInt();
	long c[]=new long[a];
	long count=0;
	int ans=0;
	long sum=0;
	for(int i=0;i!=a;i++) {
		int b=s.nextInt();
		c[i]=b;
		sum+=c[i];
	}
	Arrays.sort(c);
	for(int i=0;i<a;i++) {
		count+=c[i];
		if(count>x) {
			break;
		}
		ans++;
	}
	System.out.println(sum<x?ans-1:ans);
	}
}


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

int main(){
    std::string s, t;
    std::cin >> s >> t;

    bool flg =false;
    for(int i = 0; i < s.size(); ++i){
        s = s.substr(s.size() - 1, 1) + s.substr(0, s.size() - 1);
        if(s == t){
            flg = true;
            break;
        }
    }

    if(flg){
        std::cout << "Yes" << std::endl;
    }else{
        std::cout << "No" << std::endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0; i<n; i++)
#define rep1(i, n) for(int i=1; i<=n; i++)
#define repr(i, n) for(int i=n-1; i>=0; i--)
#define repr1(i, n) for(int i=n; i>=1; i--)
#define all(v) v.begin(),v.end()
using ll = long long;
using pii = pair<int, int>;
using pil = pair<int, ll>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
const int INF = 1e9;
const ll LLINF = 1e18;
const ll MOD = 1e9+7;
const double EPS = 1e-10;
const double PI = acos(-1);
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

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

    int ans = 0;
    rep(i, n) {
        if (a[i] == b[i] && b[i] == c[i]) continue;
        else if (a[i] == b[i] && b[i] != c[i]) ans++;
        else if (b[i] == c[i] && c[i] != a[i]) ans++;
        else if (c[i] == a[i] && a[i] != b[i]) ans++;
        else ans += 2;
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <stack>
#include <string>
#include <cmath>
#include <sstream>
#include <queue>
#include <map>
#include <cstring>
#include <unordered_set>
#include <algorithm>
#include <iomanip>
#include <unordered_map>
#include <random>
using namespace std;

bool dfs(string &s, int index, vector<string> &words) {
    if (index == s.length()) {
        return true;
    }
    for (int i = 0; i < words.size(); ++i) {
        if (index + words[i].length() <= s.length() && s.substr(index, words[i].length()) == words[i]) {
            if (dfs(s, index + words[i].length(), words)) {
                return true;
            }
        }
    }
    return false;
}

int main() {
    vector<string> words = {"dream", "dreamer", "erase", "eraser"};
    string s;
    cin >> s;
    if (dfs(s, 0, words)) {
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }
    return 0;
}


Measured memory_bytes: 2304
# C - Average Length

import itertools

N = int(input())
P = [tuple(map(int, input().split())) for _ in range(N)]

def calcDist(Y):
    dist = 0
    for i in range(1, len(Y)):
        dist += pow(pow(P[Y[i]][0] - P[Y[i-1]][0], 2) + pow(P[Y[i]][1] - P[Y[i-1]][1], 2), 0.5)
    return dist

def dfs(X):
    global ans
    if len(X)==N:
        ans.append(calcDist(X))
        return
    for i in range(N):
        if i not in X:
            X.append(i)
            dfs(X)
            X.pop()

ans = []
X = []
#dfs(X)

for X in itertools.permutations(range(N),N):
    ans.append(calcDist(X))

print(sum(ans)/len(ans))



Measured memory_bytes: 4400
#include<iostream>
#include<algorithm>
#include<string>
#include<sstream>
using namespace std;
int main() {
  int a,b;
  int k;
  cin >> a >> b;
  cin >> k;
  int count = 0;
  int ans;
  for(int i=100;i>0;i--){
    if(a%i==0 && b%i==0){
      count ++;
      if(k==count){
        ans = i;
        break;
      }
    }
  }

  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
 
int p=0;
int q[2000001];
 
void chg(int a,int b){
  int x;
  x=q[a];
  q[a]=q[b];
  q[b]=x;
}
 
int max(int a,int b){
  if(q[a]>q[b]) return a;
  else return b;
}
 
int extract(){
  int r=q[1];
  int i;
  int x;
  int M;
  q[1]=q[p];
  p--;
  i=1;
  while(i*2 <= p ){
    if(i*2+1 <= p)
      M=max(i*2,i*2+1);
    else M=i*2;
    if(max(M,i)==M){chg(M,i);i=M;}
    else break;
 
  }
  return r;
}
 
 
 
void insert(int k){
  int x;
  int i,j;
  p++;
  q[p]=k;
  i=p;
  while(q[i]>q[i/2] && i>1){
    chg(i,i/2);
    i=i/2;
  }
}
 
int main(){
  char c[10];
  int i,j,k;
 
  while(1){
    scanf("%s",c);
    if(c[0]=='i'){
      scanf("%d",&k);
      insert(k);
    }
 
    if(c[0]=='e'){
      if(c[1]=='x')printf("%d\n",extract());
      if(c[1]=='n') break;
    }
  }
  return 0;
}



Measured memory_bytes: 5744
#include<bits/stdc++.h>
using namespace std;
int main(void){
    // Your code here!
    string a[7] = {"SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"};
    string s;cin>>s;
    for(int i=0;i<7;i++){
        if(s==a[i])cout<<7-i<<endl;
    }
}

Measured memory_bytes: 256
n = int(input())
L = list(map(int,input().split()))
if n == 1:
    print("Yes")
    exit()
    
flag = False
for i in range(n-1):
    if L[i+1] >= L[i]:
        flag = True
    else:
        if L[i+1] == L[i]-1:
            L[i+1] +=1
            flag = True
        elif L[i+1] < L[i]-1:
            flag = False
            break
if flag:
    print("Yes")
else:
    print("No")

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

int main(){
    int Sheet[101][101], r, c;
    
    cin >> r >> c;
    for (int i =0; i < r; i++){
        for(int j = 0; j < c; j++){
            cin >> Sheet[i][j];
        }
    }
    for (int i = 0; i <= r; i++) Sheet[i][c] = 0;
    for (int j = 0; j <= c; j++) Sheet[r][j] = 0;
    
    for(int i = 0; i < r; i++){
        for(int j = 0; j < c; j++){
            Sheet[i][c] += Sheet[i][j];
            Sheet[r][j] += Sheet[i][j];
            Sheet[r][c] += Sheet[i][j];
        }
    }
    
    for(int i = 0; i <= r; i++){
        for(int j = 0; j <= c; j++){
            if(j) cout << " ";
            cout << Sheet[i][j];
        }
        cout << endl;
    }
    return 0;
}


Measured memory_bytes: 3120
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) begin(v),end(v)
#define fi first
#define se second
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }
using ll = long long;
using pii = pair<int, int>;
constexpr ll INF = 1ll<<30;
constexpr ll longINF = 1ll<<60;
constexpr ll MOD = 1000000007;
constexpr bool debug = 0;
//---------------------------------//

int N;
int H[100];

int main() {
	cin >> N;
	REP(i, N) scanf("%d", H + i);
	
	int ans = 0;
	int mh = 0;
	FOR(i, 1, N) {
		if (H[i - 1] > H[i]) {
			ans += H[i - 1] - mh;
			mh = H[i];
		}
	}
	if (N == 1 || H[N - 2] <= H[N - 1]) {
		ans += H[N - 1] - mh;
	}
	
	cout << ans << endl;
	
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bits/stdc++.h>
#include<cmath>
#include<bitset>
#include<stack>
#include<queue>
#define ll long long
#define itn int
#define co(ans) cout<<ans<<endl;
#define COYE cout<<"YES"<<endl;
#define COYe cout<<"Yes"<<endl;
#define COye cout<<"yes"<<endl;
#define CONO cout<<"NO"<<endl;
#define CONo cout<<"No"<<endl;
#define COno cout<<"no"<<endl;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define FFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n)  FFOR(i,1,n)
#define SORT(V) sort((V).begin(),(V).end())
#define REVERSE(V) reverse((V).begin(),(V).end())
#define INF ((1LL<<62)-(1LL<<31))
#define MOD 1000000007
#define MAX 510000
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;}
using namespace std;


int main(){
  int A[32]={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51},K;
  cin>>K;
  
  cout<<A[K-1]<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep3(i, s, n, a) for (int i = (s); i < (int)(n); i += a)
#define rep2(i, s, n) rep3(i, s, n, 1)
#define rep(i, n) rep2(i, 0, n)

using namespace std;
using ll = long long;
using ull = unsigned long long;
using P = pair<int, int>;

int main(){
    int n, k;
    cin >> n >> k;
    vector<int> a;
    rep(i, n){
        int x;
        cin >> x;
        a.push_back(x);
    }

    priority_queue<P> pq;
    pq.push(make_pair(1, a[0]));
    rep2(i, 1, n){
        priority_queue<P> tmp;
        while(!pq.empty()){
            P p = pq.top();
            if(abs(p.second-a[i])<=k){
                pq.push(make_pair(p.first+1, a[i]));
                break;
            }else{
                tmp.push(p);
                pq.pop();
            }
        }
        if(pq.empty()){
            pq.push(make_pair(1, a[i]));
        }
        while(!tmp.empty()){
            pq.push(tmp.top());
            tmp.pop();
        }
    }
    cout << pq.top().first << endl;
    return 0;
}

Measured memory_bytes: 8620
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N, M;
  cin >>N >>M;
  vector<vector<int>> Z(2);
  for(int i=0; i<M; i++){
    int a, b;
    cin >>a >>b;
    if(a==1) Z[0].push_back(b);
    if(b==1) Z[0].push_back(a);
    if(a==N) Z[1].push_back(b);
    if(b==N) Z[1].push_back(a);
  }
  string ans="IMPOSSIBLE";
  bool finish=false;
  sort(Z[0].begin(), Z[0].end());
  sort(Z[1].begin(), Z[1].end()); 
  for(int i=0; i<Z[0].size(); i++){
    auto IT=lower_bound(Z[1].begin(), Z[1].end(), Z[0][i]);
    int s=IT-Z[1].begin();
//    cout<<"i:"<<i<<" s:"<<s<<endl;
    for(int j=s; j<Z[1].size(); j++){
      if(Z[0][i]<Z[0][j]) break;
      if(Z[0][i]==Z[1][j]){
        ans="POSSIBLE";
        finish=true;
        break;
      }
    }
    if(finish) break;
  }
  cout <<ans <<endl;
}

Measured memory_bytes: 1276
import sys
import collections
ns = lambda: sys.stdin.readline().rstrip()
ni = lambda: int(ns())
nm = lambda: map(int, sys.stdin.readline().split())
nl = lambda: list(nm())
nsl = lambda: map(str, sys.stdin.readline().split())

a,b = nm()

print(max(a+b, a+(a-1), b+(b-1)))


Measured memory_bytes: 3436
#include<stdio.h>
int main(void)
{
    int N,v,j;
    int A[1000];
    scanf("%d",&N);
    for(int i=0;i<N;i++){
        scanf("%d",&A[i]);
    }
    for(int i=0;i<N-1;i++){
        printf("%d ",A[i]);
    }
    printf("%d\n",A[N-1]);
    for(int i=1;i<=N-1;i++){
        v=A[i];
        j=i-1;
        while((j>=0)&&(A[j]>v)){
            A[j+1]=A[j];
            j--;
            A[j+1]=v;
        }
        for(int i=0;i<N-1;i++){
            printf("%d ",A[i]);
        }
        printf("%d\n",A[N-1]);
    }
    return 0;
}


Measured memory_bytes: 2144
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))

n = inp()
s = input()
r = s.count('R')
g = s.count('G')
b = s.count('B')
res = r*g*b
for i in range(n-1):
    for j in range(i+1,n):
        k = 2*j - i
        if k < n :
            if s[i] != s[j] and s[i] != s[k] and s[j] != s[k]:
                res -= 1
print(res)


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

using namespace std;
using llong = long long;
using P = pair<llong, llong>;

#define BE(x) x.begin(), x.end()

const llong inf = llong(1e18)+7;
const llong mod = 1e9+7;

int main(){
	char x,y;
	cin >> x >> y;
	if(x>y)
		cout << '>' << endl;
	else if(x<y)
		cout << "<" << endl;
	else
		cout << "=" << endl;

	return 0;
}

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


int main(){

  
  int n,m;
  cin>>n>>m;
  
  vector<int> left(m);
  vector<int> right(m);
  
  for (int i=0;i<m;i++){
    int l,r;
    cin>>l>>r;
    left.at(i)=l;
    right.at(i)=r;
  }
  
  sort(left.begin(),left.end());
  sort(right.begin(),right.end());
  
  cout<<max(0,right.at(0)-left.at(m-1)+1)<<endl;
  

    

}

Measured memory_bytes: 1024
package main

import "fmt"

func main() {
	var A, B int
	fmt.Scan(&A, &B)

	if A%3 == 0 || B%3 == 0 || (A+B)%3 == 0 {
		fmt.Println("Possible")
	} else {
		fmt.Println("Impossible")
	}
}


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

const int N = 5;

int main() {
  int i, j, k;
  int x[N];

  for (i = 0; i < N; i++) cin >> x[i];
  cin >> k;

  int exist = 0;
  for (i = 0; i < N; i++) {
    for (j = 0; j < N; j++) {
      if (x[j] - x[i] > k) {
        exist = 1;
        break;
      }
    }
  }

  if (exist) cout << ":(" << endl;
  else cout << "Yay!" << endl;    

  return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <string.h>
using namespace std;

#define ISEQ(c) (c).begin(), (c).end()
typedef long long ll;

int main() {
  int max = 1000010;
  set<int> prime;
  bool p[max];
  fill(p, p+max, false);
  for (int i = 2; i < max; i++) {
    if (!p[i]) {
      prime.insert(i);
      for (int j = i+i; j < max; j += i) {
	p[j] = true;
      }
    }
  }
  while (true) {
    int a, d, n;
    cin >> a >> d >> n;
    if (a == 0) break;
    while (true) {
      if (prime.count(a) != 0) {
	n--;
      }
      if (n == 0) {
	cout << a << endl;
	break;
      }
      a += d;
    }
  }
}

Measured memory_bytes: 5844
#include <iostream>
#include <string>
#include <algorithm>
#include <sstream>
using namespace std;


int main() {
    int abcd;
    cin >> abcd;
    int a = abcd/1000;
    int b = (abcd%1000)/100;
    int c = (abcd%100)/10;
    int d = (abcd%10);


    string ans;


    for(int i=0;i<8;i++){
        int res = a;
      	ans = to_string(a);
        if(i&0b100){ res+=b;ans+= "+" + to_string(b); }
        else{ res-=b;ans+= "-" + to_string(b);}
        
        if(i&0b010){ res+=c;ans+= "+" + to_string(c); }
        else{ res-=c; ans+= "-" + to_string(c);}
       
        if(i&0b001){ res+=d;ans+= "+" + to_string(d); }
        else{ res-=d; ans+= "-" + to_string(d);}





        if (res==7){
            cout << ans << "=7" << endl;
          	return 0;
        }


    }

}



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

int main(void)
{
  int numberOfPerson = 0;
  int initialPoint = 0;
  int numberOfRound = 0;
  std::cin >> numberOfPerson >> initialPoint >> numberOfRound;
  
  std::vector<int> pointList;
  pointList.resize(numberOfPerson);
  
  int person = 0;
  for(int count = 0; numberOfRound > count; ++count)
  {
    std::cin >> person;
    pointList[person - 1] += 1;
  }
  
  for(const int point : pointList)
  {
    std::cout << ((1 <= point - numberOfRound + initialPoint)
                  ? "Yes" : "No") << std::endl;
  }
}

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

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


int main() {
	const double PI = 3.14159265358979323846;
	double R;
	cin >> R;
	cout << fixed << setprecision(8) << R * 2 * PI << endl;
}


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

namespace C
{
    public class Program
    {
        static void Main(string[] args)
        {
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);
            Solve();
            Console.Out.Flush();
        }

        public static void Solve()
        {
            var N = int.Parse(Console.ReadLine());
            var A1 = Console.ReadLine().Trim().Split(' ').Select(int.Parse).ToArray();
            var A2 = Console.ReadLine().Trim().Split(' ').Select(int.Parse).ToArray();
            var answer = 0;
            var aggA1 = new int[N + 1];
            for (var i = 0; i < A1.Length; i++) aggA1[i + 1] = A1[i] + aggA1[i];
            var aggA2 = new int[N + 1];
            for (var i = 0; i < A2.Length; i++) aggA2[i + 1] = A2[i] + aggA2[i];

            for (var i = 0; i < N; i++)
            {
                var a1 = aggA1[i + 1] - aggA1[0];
                var a2 = aggA2[N] - aggA2[i];
                answer = Math.Max(answer, a1 + a2);
            }
            Console.WriteLine(answer);
        }
    }
}


Measured memory_bytes: 13396
#include <set>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>

using namespace std;
using ll = long long;

#define INF 1000000007
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define ALL(x) (x).begin(),(x).end()
#define SIZE(x) ((int)(x).size())
#define MSG(a) cout << #a << " " << a << endl;

int main()
{
    int n, k;
    cin >> n >> k;
    vector<int> h(n);
    int tmp;
    ll ans = 0;
    while (cin >> tmp) {
        h.push_back(tmp);
    }
    sort(ALL(h), greater<int>());
    for (int i = 0; i < h.size(); i++) {
        if (k > 0) {
            k--;
        } else {
            ans += h[i];
        }
    }
    cout << ans << endl;

    return 0;
}


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

int main()
{
    long long a, b, k;
    cin >> a >> b >> k;
    long long z = min(a, k);
    k -= z;
    a -= z;
    z = min(b, k);
    b -= z;
    cout << a << " " << b << endl;
    return 0;
}


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

int main(){
    int a,b,c,d;
    cin >> a >> b >> c >> d;
    if(abs(a-b)<=d&&abs(b-c)<=d){
        cout << "Yes" << endl;
    }else if(abs(a-c)<=d){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256