akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i,n) for(ll i = 0; i<(ll)(n); i++)
#define REPS(i,n) for (ll i = 1; i<=(ll)(n); i++)
#define REPD(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=(a);i<=(b);i++)
#define FORD(i,a,b) for(ll i=(a);i>=(b);i--)
#define pb push_back
#define MOD 1000000007
#define MOD2 998244353
#define PI 3.141592653

int main(){
	ll n; cin >> n;
	vector<string> s(n);
	REP(i,n) cin >> s[i];
	sort(s.begin(), s.end());
	ll ans = 1;
	FOR(i,1,n-1){
		if (s[i]==s[i-1]){
			continue;
		}
		else{
			ans += 1;
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 9552
#include <cstdio>
#include <algorithm>
using namespace std;

int n,m,on[105][105],ans=0,light[105];
int now[105];

void print(){
	int ll[105];
	for(int i=1;i<=m;i++)
	ll[i]=light[i];
	for(int i=1;i<=n;i++){
		if(now[i]==1)
		for(int j=1;j<=on[i][0];j++)
		ll[on[i][j]]=1-ll[on[i][j]];
	}
	for(int i=1;i<=m;i++)
	if(ll[i])return ;
	ans++;
}

void dfs(int k){
	if(k>n){
		print();
		return ;
	}
	now[k]=1;
	dfs(k+1);
	now[k]=0;
	dfs(k+1);
}

int main(void){
	scanf("%d %d",&n,&m);
	for(int i=1;i<=m;i++){
		int s,a;
		scanf("%d",&s);
		for(int j=1;j<=s;j++)
		scanf("%d",&a),
		on[a][++on[a][0]]=i;
	}
	for(int i=1;i<=m;i++)
	scanf("%d",&light[i]);
	dfs(1);
	printf("%d",ans);
}

Measured memory_bytes: 128
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;
template<class S,class T> ostream& operator << (ostream& out,const pair<S,T>& o){ out << "(" << o.first << "," << o.second << ")"; return out; }
template<class T> ostream& operator << (ostream& out,const vector<T> V){ for(int i = 0; i < V.size(); i++){ out << V[i]; if(i!=V.size()-1) out << " ";} return out; }
template<class T> ostream& operator << (ostream& out,const vector<vector<T> > Mat){ for(int i = 0; i < Mat.size(); i++) { if(i != 0) out << endl; out << Mat[i];} return out; }
template<class S,class T> ostream& operator << (ostream& out,const map<S,T> mp){ out << "{ "; for(auto it = mp.begin(); it != mp.end(); it++){ out << it->first << ":" << it->second; if(mp.size()-1 != distance(mp.begin(),it)) out << ", "; } out << " }"; return out; }

/*
 <url:http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=2767>
 問題文============================================================
 =================================================================
 解説=============================================================
 ================================================================
 */

ll solve(){
    ll res = 0;
    ll N; cin >> N;
    string S; cin >> S;
    vector<int> alpha;
    for(int i = 0; i < 26;i++){
        int x = (int)count(S.begin(),S.end(),'a'+i);
        if(x == 0) continue;
        alpha.push_back(x);
    }
    sort(alpha.begin(),alpha.end());
    ll len0 = 0, len1 = 0;
    for(auto v:alpha){
        if(v == 1) len0 += 1;
        else len0 += 3;
    }
    len0 += alpha.size()-1;
    
    for(int x = 1; x <= 9; x++){
        int y = (int)count(alpha.begin(),alpha.end(),x);
        if(y == 0) continue;
        if(x == 1){
            len1 += (2*y-1);
        }else{
            if(y == 1){
                len1 += 3*y;
            }else{
                len1 += (4+2*y-1);
            }
        }
    }
    alpha.erase(unique(alpha.begin(),alpha.end()),alpha.end());
    len1 += alpha.size()-1;
    res = min(len0,len1);
    return res;
}
int main(void) {
    cin.tie(0); ios_base::sync_with_stdio(false);
    cout << solve() << endl;
    return 0;
}



Measured memory_bytes: 3208
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const LL mod=1000000007;
#define MAX 10000

int main(){
    int A,B,C,D,E,F;
    cin >> A >> B >> C >> D >> E >> F;
 
    int suger, water;
    water = 100*A;
    suger = 0;
    double max = 0.0;
    const double max_node = 100.0*E/(100.+E);
    for(int ia=0;ia<=F/(100*A);ia++){
        for(int ib=0;ib<=F/(100*B);ib++){
            int total_water = 100*(A*ia + B*ib);
            if(total_water > F) break;
 
            for(int ic=0;ic<=F/C;ic++){
                if(total_water + C*ic > F) break;
                for(int id=0;id<=F/D;id++){
                    int total_suger = C*ic + D*id;
 
                    if(total_suger + total_water > F) break;
                    double tmp = 100.0*total_suger / (total_water + total_suger);
                    if(max < tmp && tmp <= max_node){
                        max = tmp;
                        suger = total_suger;
                        water = total_water;
                    }
                }
            }
        }
    }
    cout << suger+water << " " << suger << endl;
 
    return 0;
}

Measured memory_bytes: 256
n, q = map(int, input().split())
s = input()

csum = [0, 0]
for i in range(1, n):
    if s[i-1]+s[i] == 'AC':
        csum.append(csum[i-1]+1)
    else:
        csum.append(csum[i])

for _ in range(q):
    l, r = map(int, input().split())
    print(csum[r]-csum[l])


Measured memory_bytes: 6176
import collections
N,M = map(int, input().split())
p_list = []
for i in range(N):
  fli = list(map(int,input().split()))
  p_list.extend(fli[1:])
  c = collections.Counter(p_list)
  values, counts = zip(*c.most_common())
#print(N in counts)
#print(counts)
print(counts.count(N))

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

namespace abc167_c
{
  class Program
  {
    static void Main(string[] args)
    {
      var N = CIn.ReadInt();
      var M = CIn.ReadInt();
      var X = CIn.ReadInt();
      var C = new int[N];
      var A = new int[N, M];

      for (int i = 0; i < N; i++)
      {
        C[i] = CIn.ReadInt();

        for (int j = 0; j < M; j++)
        {
          A[i, j] = CIn.ReadInt();
        }
      }

      var pow = (int)Math.Pow(2, N);

      var ans = int.MaxValue;

      for (int i = 0; i < pow; i++)
      {
        var aSum = new int[M];
        var cSum = 0;
        var a = i;

        for (var j = 0; j < N; j++)
        {
          if ((a & 1) == 1)
          {
            for (int k = 0; k < M; k++)
            {
              aSum[k] += A[j, k];
            }
            cSum += C[j];
          }

          a >>= 1;
        }

        if (aSum.All(e => e >= X))
        {
          ans = Math.Min(ans, cSum);
        }
      }

      Console.WriteLine(ans != int.MaxValue ? ans : -1);
    }
  }

  static class CIn
  {
    private static readonly Queue<string> fieldBuffer = new Queue<string>();

    public static string Read()
    {
      if (fieldBuffer.Count == 0)
      {
        foreach (var field in Console.ReadLine().Split())
        {
          fieldBuffer.Enqueue(field);
        }
      }
      return fieldBuffer.Dequeue();
    }

    public static int ReadInt() => int.Parse(Read());
    public static long ReadLong() => long.Parse(Read());
    public static double ReadDouble() => double.Parse(Read());

    public static string[] ReadStringArray(int n)
    {
      var array = new string[n];
      for (var i = 0; i < n; i++)
      {
        array[i] = Read();
      }
      return array;
    }

    public static int[] ReadIntArray(int n)
    {
      var array = new int[n];
      for (var i = 0; i < n; i++)
      {
        array[i] = ReadInt();
      }
      return array;
    }

    public static long[] ReadLongArray(int n)
    {
      var array = new long[n];
      for (var i = 0; i < n; i++)
      {
        array[i] = ReadLong();
      }
      return array;
    }

    public static double[] ReadDoubleArray(int n)
    {
      var array = new double[n];
      for (var i = 0; i < n; i++)
      {
        array[i] = ReadDouble();
      }
      return array;
    }

    public static char[,] ReadCharMatrix(int h, int w)
    {
      var array = new char[h, w];
      for (var i = 0; i < h; i++)
      {
        var l = Console.ReadLine().ToCharArray();
        for (var j = 0; j < w; j++)
        {
          array[i, j] = l[j];
        }
      }
      return array;
    }
  }
}


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

#define ll long long
#define vecll vector<long long>
#define vec2ll vector<vector<long long>>
#define vecbool vector<bool>
#define vecpairll vector<pair<long long,long long>>
#define forll(s,a,b) for(long long s = a;s < b;s++)
#define forllde(s,a) for(long long s = a;s > 0;s--)

int main()
{
  string a, b;
  cin >> a >> b;
  if (a == b)
	cout << "EQUAL";
  else if (a.length() > b.length())
	cout << "GREATER";
  else if (a.length() < b.length())
	cout << "LESS";
  else{
	if (a > b)
	  cout << "GREATER";
	else
	  cout << "LESS";
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define lint long long int
#define rep(i,n) for(int i=0;i<int(n);i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define arep(i,a,n) for(int i=a;i<n;i++)
#define sort(a) sort(a.begin(),a.end())
#define reverse(a) reverse(a.begin(),a.end())
#define fill(a,x) fill(a.begin(),a.end(),x)
#define eb(data) emplace_back(data)
#define pb(data) emplace_back(data)
#define mp make_pair
#define ALNUM 26
#define vint vector<int>
#define vlint vector<lint>
#define F first
#define S second
#define ALL(data) data.begin(),data.end()
#define GEts(s) getline(cin,s);
#define UNIQUE(vec) vec.erase(unique(vec.begin(), vec.end()), vec.end())

using namespace std;
template<typename Rast>inline void out(Rast rast){cout<<rast<<"\n";return;}
template<typename Rast>inline void in(Rast& rast){cin>>rast;return;}
template<typename T>istream& operator >> (istream& is, vector<T>& vec){for(T& x: vec) is >> x;return is;}
template<typename First, typename... Rest>void in(First& first, Rest&... rest){cin >> first;in(rest...);return;}
template<typename First, typename... Rest>void out(First first, Rest... rest){cout << first<<" ";out(rest...);return;}
template<typename T>T gcd(T a,T b){if(b==0)return a;return gcd(b,a%b);}
template<typename T1,typename T2>bool chmax(T1& a,T2 b){if(a<b){a=b;return true;}else{return false;}}
template<typename T1,typename T2>bool chmin(T1& a,T2 b){if(a>b){a=b;return true;}else{return false;}}
template<typename T>T lcm(T a, T b){return a * b / gcd(a, b);}
static const double pi = 3.141592653589793;
int modpow(int a,int n,int p){if (n==0)return 1%p; if(n==1)return a%p;if(n%2==1)return (a*modpow(a,n-1,p))%p;lint t=modpow(a,n/2,p);return (t*t)%p;}//a^n%p
lint MOD=pow(10,9)+7;
//lint MOD=998244353;
lint inf=pow(2,50);
int intinf=pow(2,30);
/**int dirx[]={1,0};int diry[]={0,1};//*///右、下
/**int dirx[]={0,1,0,-1};int diry[]={-1,0,1,0};//*///四方位
/**int dirx[]={-1,0,1,1,1,0,-1,-1};int diry[]={-1,-1,-1,0,1,1,1,0};//*///八方位


class unionfind{
public:
	vector<int> table;
	void init(int size){
		table.resize(size);
		rep(i,size)table[i]=i;
	};
	int root(int index){
		if(table[index]==index)return index;
		else{
			int hoge=root(table[index]);
			table[index]=hoge;
			return hoge;
		}
	};
	bool same(int x,int y){
		return(root(x)==root(y));
	};
	int marge(int x,int y){
		int yroot=root(y);
		int xroot=root(x);
		if(xroot==yroot)return 0;
		table[yroot]=xroot;
		return 0;
	}
};

int main(){
	cin.tie(0);ios::sync_with_stdio(false);cout<<std::fixed<<std::setprecision(19);
	int n;
	in(n);
	int ans=0;
	arep(a,1,n){
		arep(b,1,n){
			if(a*b<n)ans++;
			else break;
		}
	}
	out(ans);
	return 0;
}


Measured memory_bytes: 3636
# -*- coding: utf-8 -*-

def check(a,b,c):
	if((a<b)and(b<c))or((a>b)and(b>c)):
		return 1
	return 0

import sys
n = int(input())
tmp = input().split()
hoge = list(map(lambda a: int(a), tmp))

#print(hoge)
hoge.sort()
n=len(hoge)
#print(hoge)

m=n//2
if(hoge[m-1] == hoge[m]):
	print(0)
	sys.exit()

l=hoge[m]-hoge[m-1]

#sum=0
#for i in range(n-2):
#	sum += check(hoge[i],hoge[i+1],hoge[i+2])

print(l)


Measured memory_bytes: 14396
def main():
  n, d = map(int, input().split())
  ans = 0
  for i in range(n):
    x, y = map(int, input().split())
    if x**2 + y**2 <=d**2:
      ans += 1
  print(ans)
    
if __name__ == "__main__":
  main()

Measured memory_bytes: 9128
#include <iostream>
#include <cstdio>

using namespace std;

typedef long long ll;

ll n, m, k, x, y;
string s1, s2;
ll x1, x2, y1, y2;

int main()
{
    cin>>n>>m>>k>>x>>y;
    cin>>s1>>s2;
    x1 = 1, y1 = 1, x2 = n, y2 = m;
    for(ll i = s1.size() - 1; i >= 0; i--)
    {
        if(s2[i] == 'R') y1--;
        else if(s2[i] == 'L') y2++;
        else if(s2[i] == 'U') x2++;
        else x1--;
        x1 = max(x1, 1LL), x2 = min(x2, n);
        y1 = max(y1, 1LL), y2 = min(y2, m);
        if(s1[i] == 'R') y2--;
        else if(s1[i] == 'L') y1++;
        else if(s1[i] == 'U') x1++;
        else x2--;
        if(x1 > x2 || y1 > y2)
        {
            cout<<"NO"<<endl;
            return 0;
        }
    }
    if(x1 <= x && x <= x2 && y1 <= y && y <= y2)
    {
        cout<<"YES"<<endl;
    }
    else
    {
        cout<<"NO"<<endl;
    }
    return 0;
}


Measured memory_bytes: 776
#include<iostream>
#include<string>
#include<ctype.h>
#include<stdio.h>
using namespace std;
int main(){
	string a;
	getline(cin,a);
	for(int i=0;i<a.size();i++){
    if(isalnum(a[i])!=0)
		a[i]=toupper(a[i]);
	cout<<a[i];	
	}
	cout<<endl;
	return 0;
}

Measured memory_bytes: 1172
import math

def is_prime(n):
    if n == 1: 
        return False
    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False
    return True

x = int(input())
while True:
    if is_prime(x):
        print(x)
        break
    else:
        x += 1

Measured memory_bytes: 3060
n,m=map(int,input().split())
s=list(input())
s.reverse()
now=0;l=[]
while True:
  tmp=now
  now+=m
  now=min(n,now)
  if now==n:
    l.append(str(now-tmp))
    break
  while s[now]=='1':
    now-=1
    if now==tmp:
      print(-1)
      exit()
  l.append(str(now-tmp))
l.reverse()
print(' '.join(l))

Measured memory_bytes: 10832
//47
#include<iostream>
#include<complex>

using namespace std;

typedef complex<double> P;

bool in(P x,P *a){
  bool sg[2]={};
  for(int i=0;i<3;i++){
    P e=a[(i+1)%3]-a[i];
    P d=x-a[i];
    sg[e.real()*d.imag()-e.imag()*d.real()<0]=true;
  }
  return sg[0]^sg[1];
}

int main(){
  int n;
  cin>>n;
  while(n--){
    P p[5];
    for(int i=0;i<5;i++){
      double x,y;
      cin>>x>>y;
      p[i]=P(x,y);
    }
    cout<<(in(p[3],p)^in(p[4],p)?"OK":"NG")<<endl;
  }
  return 0;
}
      

Measured memory_bytes: 1216
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;


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

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

namespace ConsoleApp2
{
	class Program
	{
		static void Main(string[] args)
		{
			int n = int.Parse(Console.ReadLine());
			var q = from p in Console.ReadLine().Split(' ')
					select int.Parse(p);
			var pList = new List<int>(q);
			var ordered = new List<int>(pList);
			ordered.Sort();

			int diffCount = 0;
			for (int i = 0; i < pList.Count; i++)
			{
				if (pList[i] != ordered[i])
				{
					diffCount++;
					if (diffCount > 2)
					{
						Console.WriteLine("NO");
						return;
					}
				}
			}
			Console.WriteLine("YES");
		}
	}
}


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

#define ll long long int

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

	    int l,r,d;
	    cin>>l>>r>>d;
  int c=0;
      for(int i=l;i<=r;i++)
      {
        if(i%d==0)
          c++;
      }
  cout<<c;

  return 0;
}

Measured memory_bytes: 3636
#include <vector>
#include <iostream>
#include <utility>
#include <algorithm>
#include <string>
#include <deque>
#include <queue>
#include <tuple>
#include <queue>
#include <functional>
#include <cmath>
#include <iomanip>
#include <map>
#include <set>
#include <numeric>
#include <unordered_map>
#include <unordered_set>
#include <complex>
#include <iterator>
#include <array>
#include <memory>
#include <stack>

#define ll long long int
#define int ll
#define vi vector<int>
#define vvi vector<vector<int> >
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vc vector<char>
#define vs vector<string>
#define ld long double
#define II 1e9
#define EPS 0.0000000001
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,s,n) for(int i=s;i<n;i++)
#define all(in) in.begin(), in.end()
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
#define MAX 9999999
int INF=II*II;
using namespace std;
typedef pair<int, int> pii;
typedef pair<double,double>pdd;
signed main(){
    int v,e; cin>>v>>e;
    using piii = pair<pii,int>;
    vector<bool>used(v,true);
    vector<vector<pii>>edge(v,vector<pii>());
    rep(i,e){
        int a,b,c; cin>>a>>b>>c;
        edge[a].push_back(pii(b,c));
        edge[b].push_back(pii(a,c));
    }
    priority_queue<pii,vector<pii>,greater<pii>>que;
    que.push(pii(0,0));
    used[0]=true;
    int res=0;
    while(!que.empty()){
        pii now=que.top(); que.pop();
        if(used[now.second]==false)continue;
        res+=now.first;
        rep(i,edge[now.second].size()){
            que.push(pii(edge[now.second][i].second,edge[now.second][i].first));
        }
        used[now.second]=false;
    }
    cout<<res<<endl;
}

Measured memory_bytes: 12320
a = gets.chomp.to_i
b = gets.chomp.to_i
c = gets.chomp.to_i
d = gets.chomp.to_i
e = gets.chomp.to_i
k = gets.chomp.to_i

if (e-a)<=k
    puts "Yay!"
else
    puts ":("
end

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

using namespace std;

#define MAX_N 20
#define INF (1<<29)

int main()
{
    int N, M;
    while (cin >> N) {
        cin >> M;
        int d[MAX_N][MAX_N];
        for (int i = 0; i < N; i++) {
            for (int j = 0; j < N; j++) {
                d[i][j] = INF;
            }
            d[i][i] = 0;
        }
        int a, b, c1, c2;
        for (int i = 0; i < M; i++) {
            scanf("%d,%d,%d,%d", &a, &b, &c1, &c2);
            a--; b--;
            d[a][b] = c1;
            d[b][a] = c2;
        }
        scanf("%d,%d,%d,%d", &a, &b, &c1, &c2);
        a--; b--;

        for (int k = 0; k < N; k++) {
            for (int i = 0; i < N; i++) {
                for (int j = 0; j < N; j++) {
                    d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
                }
            }
        }

        cout << c1 - c2 - d[a][b] - d[b][a] << endl;
    }           
    return 0;
}

Measured memory_bytes: 3124
/*Author - Shubham Gupta (@shubham107)*/
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef vector<ll> vl;		typedef vector<int> vi;
typedef vector<vl> vvl;	  	typedef vector<vi> vvi;
typedef pair<ll, ll> pll;	typedef pair<int, int> pii;
#define forn(i,n) for(int i=0;i<n;i++)
#define rforn(i,n) for(int i=n-1;i>=0;i--)
#define forne(i,n) for(int i=1;i<=n;i++)
#define forse(i,s,e) for(int i=s;i<e;i++)
#define rforse(i,s,e) for(int i=e-1;i>=s;i--)
#define all(x) x.begin(),x.end()
#define sz(x) (int)x.size()
#define MOD 1000000007
#define F first
#define S second
#define pb push_back
#define fill(a,x) memset(a,x,sizeof a);
#define trav(a,x) for(auto &a:x)
#define INF	ll(1e18)
#ifdef SHUBHAM107
#include "../code-pieces/trace.h"
#else
#define trace(args...)
#endif

ll modpow(ll a, ll b, ll m = MOD) {
	a %= m; ll res = 1; while (b) {if (b & 1)res = res * a % m; a = a * a % m; b >>= 1;}
	return res;
}
ll bpow(ll a, ll b) {ll res = 1; while (b) {if (b & 1)res = res * a; a = a * a; b >>= 1;} return res;}
ll modinv(ll a) {return modpow(a, MOD - 2, MOD);}
void graph(vvi &adj, int m) {int x, y; forn(i, m) {cin >> x >> y; adj[x - 1].pb(y - 1); adj[y - 1].pb(x - 1);}}

const int mxN = 2e5 + 5;
void solve() {
	ll x;
	cin >> x;
	for(ll a = -200; a <= 200; a++){
		for(ll b = -200; b <= 200; b++){
			if(bpow(a, 5) - bpow(b, 5) == x){
				cout << a << ' ' << b;
				return;
			}
		}
	}
	assert(false);
}
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
#ifdef SHUBHAM107
	freopen("inp.txt", "r", stdin);
	freopen("out.txt", "w", stdout);
	freopen("err.txt", "w", stderr);
#endif
	int t = 1;
	// cin >> t;
	while (t--) {
		solve();
	}
}


Measured memory_bytes: 3656
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        String s = scan.next();
        if (s.charAt(s.length() - 1) == 's') System.out.println(s + "es");
        else System.out.println(s + "s");
    }
}


Measured memory_bytes: 38504
import java.io.*;
public class Main{
	public static void main(String [] args) throws NumberFormatException, IOException{
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		String[] st=br.readLine().split(" ");
		int a=Integer.parseInt(st[0]);
		int b=Integer.parseInt(st[1]);
		int t=a-b;
		if(t==0)System.out.println("a == b");
		else System.out.println(t<0?"a < b":"a > b");		
	}}

Measured memory_bytes: 16896
N = int(input())
H = list(map(int, input().split()))

res = 0
c = 0
pre = -1
for h in H:
    if pre == -1:
        pre = h
        continue

    if pre >= h:
        c += 1
    else:
        res = max(res, c)
        c = 0
    pre = h
res = max(res, c)

print(res)

Measured memory_bytes: 15020
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
typedef long long int ll;
#define BIG_NUM 2000000000
#define MOD 1000000007
#define EPS 0.000001
using namespace std;

struct Info{
	void init(){
		cost = BIG_NUM;
	}
	int row,col,cost;
};

int main(){

	int W,H,first,minimum = BIG_NUM,minimum_first,next,current;
	Info start,goal;
	vector<Info> V[6];
	char buf[1001];

	while(true){
		scanf("%d %d",&W,&H);
		if(W == 0 && H == 0)break;

		for(int i = 1; i <= 5; i++)V[i].clear();

		for(int i = 0; i < H; i++){
			scanf("%s",buf);
			for(int k = 0; buf[k] != '\0'; k++){
				if(buf[k] == '.'){
					//Do nothing
				}else{
					if(buf[k] == 'S'){
						start.row = i;
						start.col = k;
					}else if(buf[k] == 'G'){
						goal.row = i;
						goal.col = k;
					}else{
						Info info;
						info.row = i;
						info.col = k;
						V[buf[k] - '0'].push_back(info);
					}
				}
			}
		}

		minimum = BIG_NUM;

		for(first = 1; first <= 5; first++){
			for(int i = 1; i <= 5; i++){
				for(int k = 0; k < V[i].size();k++)V[i][k].init();
			}
			goal.cost = BIG_NUM;

			if(first == 5){
				next = 1;
			}else{
				next = first+1;
			}

			for(int i = 0; i < V[next].size(); i++){
				V[next][i].cost = abs(start.row-V[next][i].row)+abs(start.col-V[next][i].col);
			}

			current = next;

			for(int i = 1; i <= 3; i++){
				next++;
				if(next == 6)next = 1;

				for(int a = 0; a < V[current].size(); a++){
					for(int b = 0; b < V[next].size();b++){
						V[next][b].cost = min(V[next][b].cost,V[current][a].cost+abs(V[next][b].row-V[current][a].row)+abs(V[next][b].col-V[current][a].col));
					}
				}
				current = next;
			}

			for(int i = 0; i < V[current].size();i++){
				goal.cost = min(goal.cost,V[current][i].cost+abs(goal.row-V[current][i].row)+abs(goal.col-V[current][i].col));
			}

			if(goal.cost < minimum){
				minimum = goal.cost;
				minimum_first = first;
			}
		}

		if(minimum == BIG_NUM){
			printf("NA\n");
		}else{
			printf("%d %d\n",minimum_first,minimum);
		}
	}

	return 0;
}

Measured memory_bytes: 2624
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
const int INF = 1e9;
const int EPS = 1e-9; 
const int SEARCH_MAX = 6e3;

int main() {
  int K;
  cin >> K;
  int ans = 0;
  for (int a = 1; a <= K; ++a) {
    for (int b = 1; b <= K; ++b) {
      for (int c = 1; c <= K; ++c) {
        ans += __gcd(__gcd(a, b), c);
      }
    }   
  }
  cout << ans << endl;
}

Measured memory_bytes: 3644
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int A = sc.nextInt();
        int B = sc.nextInt();
        if ((A - B) % 2 == 0) {
            System.out.println("Alice");
        } else {
            System.out.println("Borys");
        }
    }

}


Measured memory_bytes: 23508
n=int(input())
h=list(map(int,input().split()))
h[0]-=1
for i in range(1,n):
    if h[i]<h[i-1]:
        print('No')
        import sys
        sys.exit()
    elif h[i]==h[i-1]:
        continue
    else:
        h[i]-=1
print('Yes')



Measured memory_bytes: 14224
#include <stdio.h>
#include <math.h>
#include <algorithm>

using namespace std;

#define FOR(i,init,n) for(int i = init; i < n ;i++)
#define REP(i,n)  FOR(i,0,n)
#define MON 1
#define SAT 6

int isPrime(int cand){

	//int i, limit;

	int limit = sqrt(cand);
	//limit = (int)sqrt((double)cand);
	int i = limit;

	if (cand < 2){
		return(0);
	}

	while (i > 1){
		if (cand % i == 0){
			break;
		}
		i--;
	}

	//for (; i > 1; i--){
	//	//for (i = limit; i > 1; i--){
	//	if (cand % i == 0){
	//		break;
	//	}
	//}

	if (i == 1){
		return(1);
	}
	else{
		return(0);
	}

	//else{
	//	return(0);
	//}
}

int isMonSatPrime(int cand){

	if (cand % 7 != 1 && cand % 7 != 6){
		return(0);
	}

	if (cand < 2){
		return(0);
	}

	int i = 6;
	int next = MON;

	while (i > 1){
		if (cand % i == 0){
			break;
		}

		i += next == SAT ? 5 : 2;
		next = next == SAT ? MON : SAT;
		//if (next == SAT){
		//	i += 5;
		//	next = MON;
		//}
		//else if (next == MON){
		//	i += 2;
		//	next = SAT;
		//}
	}

	return i == cand ? 1 : 0;
	//if (i == (cand)){
	//	return(1);
	//}
	//else{
	//	//puts("?????????????´???°??§??????????????????");
	//	return(0);
	//}
}

int main()
{
	//FILE* fin = freopen("input.txt", "r", stdin);
	//FILE* fout = freopen("output.txt", "w", stdout);
	while (1){
		int num;
		scanf("%d", &num);
		if (num == 1){
			break;
		}
		printf("%d:", num);
		//int i = 6;
		int next = MON;

		for (int i = 6; i <= num; i += next == SAT ? 5 : 2,next = next == SAT ? MON : SAT){
			if (num%i == 0){
				if (isMonSatPrime(i) == 1){
					printf(" %d", i);
				}
			}
		}
		//while (i <= num){
		//	if (num%i == 0){
		//		if (isMonSatPrime(i) == 1){
		//			printf(" %d", i);
		//		}
		//	}
		//	i += next == SAT ? 2 : 5;
		//	next = next == SAT ? MON : SAT;
		//	//if (next == SAT){
		//	//	i += 5;
		//	//	next = MON;
		//	//}
		//	//else if (next == MON){
		//	//	i += 2;
		//	//	next = SAT;
		//	//}
		//}
		puts("");
	}
	return 0;
}

Measured memory_bytes: 1036
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
import heapq

n, m = map(int, input().split())
if m == n-1:
  print(0)
  exit()
if n < 2*(n-m-1):
  print("Impossible")
  exit()
A = tuple(map(int, input().split()))
G = [[] for _ in range(n)]
for _ in range(m):
  x, y = map(int, input().split())
  G[x].append(y)
  G[y].append(x)
ans = 0
L = []
seen = [False]*n
def dfs(v):
  global ans
  K = []
  stack = [v]
  while stack:
    v = stack.pop()
    heapq.heappush(K, A[v])
    seen[v] = True
    for nv in G[v]:
      if seen[nv]:
        continue
      stack.append(nv)
  ans += heapq.heappop(K)
  for k in K:
    heapq.heappush(L, k)
for i in range(n):
  if not seen[i]:
    dfs(i)
for _ in range(n-m-2):
  ans += heapq.heappop(L)
print(ans)

Measured memory_bytes: 32204
#include <iostream>
#include <cmath>
#include <vector>
#include <string>
#include <cstdlib>


using namespace std;

void BubbleSort(char *a, int *c, int n){
  for(int i=0;i<n;i++){
    for(int j=n-1;j>i;j--){
      if(c[j] < c[j-1]){
	swap(a[j],a[j-1]);
	swap(c[j],c[j-1]);
      }
    }
  }
}

void SelectionSort(char *a, int *c, int n){
  for(int i=0;i<n;i++){
    int minj=i;
    for(int j=i;j<n;j++){
      if(c[minj] > c[j]){
	minj=j;
      }
    }
    if(minj!=i){
      swap(c[i],c[minj]);
      swap(a[i],a[minj]);
    }
  }
}

void isStable(string *a, string *b, int n){
  for(int i=0;i<n;i++){
    if(a[i]!=b[i]){
      cout << "Not stable" << endl;
      return;
    }
  }

  cout << "Stable" << endl;
  return;
}
  

int main(){
  int n;
  cin >> n;
  char *a = new char[n];
  int *b = new int[n];
  string *s = new string[n];
  
  for(int i=0;i<n;i++){
    cin >> s[i];
    a[i] = s[i][0];
    b[i] = atoi(&s[i][1]);
  }
  
  char *a1 = a;
  int *b1 = b;
  string *s1 = s;

  char *a2= new char[n];
  int *b2 = new int[n];
  string *s2 = new string[n];
  for(int i=0;i<n;i++){
    a2[i] = a[i];
    b2[i] = b[i];
    s2[i] = s[i];
  }
    
  BubbleSort(a1, b1, n);
  string *s1_out = new string[n];

  for(int i=0;i<n;i++){
    s1_out[i] = a1[i];
    s1_out[i] += b1[i] + '0';
  }
  // cout << endl;
  
  for(int i=0;i<n;i++){
    if(i!=0){cout<<" ";}
    cout << s1_out[i];
  }
  cout << endl;
  cout << "Stable" << endl;
  
  SelectionSort(a2, b2, n);
  string *s2_out = new string[n];

  for(int i=0;i<n;i++){
    s2_out[i] = a2[i];
    s2_out[i] += b2[i] + '0';
  }

  for(int i=0;i<n;i++){
    if(i!=0){cout<< " ";}
    cout << s2_out[i];
  }
  cout << endl;

  isStable(s1_out, s2_out, n);
}
  
    

Measured memory_bytes: 1228
N, M = map(int, input().split())
S = list(map(int, input().split()))
T = list(map(int, input().split()))

dp = [[0] * (M + 1) for _ in range(N + 1)]
MOD = 10 ** 9 + 7

for i in range(N + 1):
    dp[i][0] = 1

for j in range(M + 1):
    dp[0][j] = 1

for i in range(N):
    for j in range(M):
        if S[i] == T[j]:
            dp[i + 1][j + 1] = dp[i][j + 1] + dp[i + 1][j]
        else:
            dp[i + 1][j + 1] = dp[i][j + 1] + dp[i + 1][j] - dp[i][j]
        dp[i + 1][j + 1] %= MOD
            
print(dp[-1][-1])



Measured memory_bytes: 72796
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        
        int n = Integer.parseInt(sc.next());
        int[] taste = new int[n];
        
        for(int i = 0; i < n;i++){
            taste[i] = Integer.parseInt(sc.next());
        }
        
        int sum=0;
        
        for(int i = 0; i < n-1;i++){
            for(int j = i+1; j < n;j++){
                sum+=taste[i]*taste[j];
            }
        }
        System.out.println(sum);
    }
}

Measured memory_bytes: 21716
H, N = map(int, input().split())
damage = []
mp = []
 
for i in range(N):
    a, b = map(int, input().split())
    damage.append(a)
    mp.append(b)
 
dp = [[0]+[float("inf")]*H for _ in range(N + 1)]

for i in range(N):
    for j in range(H + 1):
        if j - damage[i] >= 0:
            dp[i + 1][j] = min(dp[i][j], dp[i + 1][j - damage[i]] + mp[i])
        else:
            dp[i + 1][j] = min(dp[i][j], dp[i + 1][0] + mp[i])

print(dp[N][H])

Measured memory_bytes: 374140
#include<bits/stdc++.h>
#include<iostream>
using namespace std;
#define		int 			long long int
#define		pb				push_back
#define		fi(n)			for(int i=0;i<n;i++)
#define		fj(n)			for(int j=0;j<n;j++)
#define		fi1(n)			for(int i=1;i<n;i++)
#define		fj1(n)			for(int j=1;j<n;j++)
#define		firev(n)		for(int i=n-1;i>=0;i--)
#define		fjrev(n)		for(int j=n-1;j>=0;j--)
#define		rep(z,a,n)		for(z=a;z<n;z++)
#define		rep2(z,a,n)		for(z=a;z<n;z+=2)
#define		clr(x)			memset(x, 0, sizeof(x))
#define		print(x,n)		for(int i=0;i<n;i++) cout<<x[i]<<" ";  cout<<"\n"
#define		nl 				"\n"
#define		vi				vector<int>
#define		pairi			pair<int,int>
#define		mp				make_pair
#define		vpairi			vector<pair<int,int>>
#define		ff				first
#define		ss				second
#define		inf 			2e18
#define		setp(val,n)		cout<<fixed;cout<<setprecision(n)<<val<<nl;
#define 	input 			"C://Users//Piyush Aggarwal//Documents//Cpp files//input-output//input.txt"
#define 	output 			"C://Users//Piyush Aggarwal//Documents//Cpp files//input-output//output.txt"
#define 	error 			"C://Users//Piyush Aggarwal//Documents//Cpp files//input-output//error.txt"
int ctoi(char a){ int x=a-48-48;return x;}
string itos(int a){
	string out_string;
	stringstream ss;
	ss<<a;
	out_string=ss.str();
	return out_string;
}
char itoc(int a){ return itos(a)[0];}
int pow(int e,int x){
	int ans=1;
	while(x>0){
		if(x&1) ans*=e;
		e*=e;
		x>>=1;
	}return ans;
}
string bin(int x){
	bitset<sizeof(1)*CHAR_BIT> bits(x);
	// bitset<31> bits(x);
	string b=bits.to_string(); return b;
}
signed main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL); cout.tie(NULL);
	int T=1;
	// cin>>T;
	while(T--){
		int n,k,m;
		cin>>n;
		int a[n][3],dp[n][3];clr(dp);
		fi(n){
			cin>>a[i][0]>>a[i][1]>>a[i][2];
			if(i==0){
				dp[i][0]=a[i][0];
				dp[i][1]=a[i][1];
				dp[i][2]=a[i][2];
			}
		}
		fi1(n){
			dp[i][0]=a[i][0]+max(dp[i-1][1],dp[i-1][2]);
			dp[i][1]=a[i][1]+max(dp[i-1][0],dp[i-1][2]);
			dp[i][2]=a[i][2]+max(dp[i-1][1],dp[i-1][0]);
		}
		cout<<max(dp[n-1][0],max(dp[n-1][1],dp[n-1][2]));
	}
	return 0;
}

Measured memory_bytes: 4992
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;

int N;
char S[310][310], T[310][310];

bool check(int A, int B) {
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < N; j++) {
      T[i][j] = S[(i+A)%N][(j+B)%N];
    }
  }
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < N; j++) {
      if (T[i][j] != T[j][i]) return false;
    }
  }
  return true;
}

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  
  cin >> N;
  for (int i = 0; i < N; i++) {
    cin >> S[i];
  }
  int ans = 0;
  for (int i = 0; i < N; i++) {
    ans += check(0, i) * N;
  }
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 512
def s_in():
    return input()

def n_in():
    return int(input())

def l_in():
    return list(map(int, input().split()))

a = l_in()
b = l_in()
c = l_in()
N = n_in()

s = set()

for _ in range(N):
  s.add(n_in())

def check(L):
  return all(l in s for l in L)

if any(check(L) for L in [
  a,b,c,
  [a[0],b[0],c[0]],
  [a[1],b[1],c[1]],
  [a[2],b[2],c[2]],
  [a[0],b[1],c[2]],
  [a[2],b[1],c[0]],
  ]):
  print("Yes")
else:
  print("No")


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int x, S1, S2, S3;
  cin >> x;
  S1 = x / 100;
  S2 = (x - (S1 *100)) / 10;
  S3 = x- (S1 * 100) - S2 * 10;
  cout << S1 + S2 + S3 << endl;
}

Measured memory_bytes: 256
def ii(): return int(input())
def si(): return input()
def mi(): return map(int,input().split())
def li(): return list(mi())

import math 

for i in range(1):
    a,b,c=mi()
    if a==b!=c or b==c!=a or c==a!=b:
        print("Yes")
    else:
        print("No")

Measured memory_bytes: 3060
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] V = new int[N];
        for (int i = 0; i < N; i++) {
            V[i] = sc.nextInt();
        }
        Arrays.sort(V);

        long sum = V[0] + V[1];
        long mul = 2;
        for (int i = 2; i < N; i++) {
            sum += V[i] * mul;
            mul *= 2;
        }

        double ans = ((double)sum) / (double)(1L<<(N-1));
        System.out.println(ans);
    }
}

Measured memory_bytes: 23764
#include <bits/stdc++.h>
	  #define endl "\n"
	  #define ll long long int
	  #define mod 1000000007
	  #define inf 1000000000000000001;
	  using namespace std;
	  int main()
	  {
	    //  #ifndef ONLINE_JUDGES
	    //  // for getting input from input.txt
	    //  freopen("input.txt", "r", stdin);
	    //  // for writing output to output.txt
	    //  freopen("output.txt", "w", stdout);
	    // #endif
	    std::ios::sync_with_stdio(false);
	    cin.tie(NULL);
	    int n,c=0;
	    cin>>n;
	    int k = n % 1000;
	    if(k == 0){
	    	cout<<"0"<<endl;
	    }
	    else{
	    	cout<<1000 - k<<endl;
	    }
	    return 0;
	  }


Measured memory_bytes: 3648
#include <bits/stdc++.h>
#include <bits/extc++.h>
using namespace std;
using namespace __gnu_pbds;
using vi  = vector<int>;
using ii  = pair<int,int>;
using vii = vector<ii>;
using ll  = long long;

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

#define F first
#define S second
#define PB push_back
#define EB emplace_back
#define ALL(x) (x).begin(), (x).end()
#define SIZE(x) int((x).size())
#define REP(i, a, b) for (auto (i) = (a); (i) <= (b); (i)++)
#define PER(i, a, b) for (auto (i) = (a); (i) >= (b); (i)--)
#define ITR(i, x) for (auto (i) = (x).begin(); (i) != (x).end(); (i)++)

string to_string(string s) { return '\"' + s + '\"'; }
string to_string(const char* s) { return to_string((string) s); }
string to_string(bool b) { return (b ? "true" : "false"); }
template <typename A, typename B> string to_string(pair<A,B> p)
{ return "(" + to_string(p.F) + ", " + to_string(p.S) + ")"; }
template <typename T> string to_string(T v) {
	int f = 0; string res = "{";
	for (const auto &x: v)
		res += (f++ ? ", " : "") + to_string(x);
	return res + "}";
}
void debug_out() { cerr << "]\n"; }
template <typename T, typename... V>
void debug_out(T a, V... v)
{ cerr << to_string(a); if (sizeof...(v)) cerr << ", "; debug_out(v...); }

#ifdef LOCAL // add -DLOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "] = [", debug_out(__VA_ARGS__)
#else
#define debug(...)
#endif // debug(var1, var2, ...);

const int q = 1e6+5;
bitset<q> isPrime;
vi prime;

signed main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);

	isPrime.set();
	isPrime[0] = 0; isPrime[1] = 0;
	for (ll i = 2; i < q; i++)
	{
		if (isPrime[i])
		{
			prime.PB(i);
			for (ll j = i*i; j < q; j += i)
				isPrime[j] = 0;
		}
	}
	ll n;
	cin >> n;
	int ans = 0;
	for (int p: prime)
	{
		int e = 0;
		while (n % p == 0)
		{
			e++;
			n /= p;
		}
		int add = 0;
		while (add*(add+1)/2 <= e)
			add++;
		ans += add-1;
	}
	if (n > 1) ans++;
	cout << ans << '\n';
	return 0;
}

Measured memory_bytes: 3944
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define FOR(i,x,n) for(int i=x; i<(n); i++)
#define ALL(n) begin(n),end(n)
#define MOD (1000000007)
#define INF (1e9)
#define INFL (1e18)

typedef long long ll;
typedef unsigned int ui;
typedef unsigned long long ull;
template<class T>using arr=vector<vector<T>>;
template<class T>void pr(T x){cout << x << endl;}
template<class T>void prvec(vector<T>& a){rep(i, a.size()-1){cout << a[i] << " ";} pr(a[a.size()-1]);}
template<class T>void prarr(arr<T>& a){rep(i, a.size()) if(a[i].empty()) pr(""); else prvec(a[i]);}
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 P = pair<int, int>;
void prp(P& p) {cout << p.first << " " << p.second << endl;}
int main()
{
    int n, m; cin >> n >> m;
    vector<P> x(m);
    rep(i, m){
        cin >> x[i].second >> x[i].first;
    }
    sort(ALL(x));
    int cnt = 1;
    int p = x[0].first;
    rep(i, m){
        if(x[i].second >= p){
            cnt++;
            p = x[i].first;
        }
    }
    pr(cnt);
    return 0;}

Measured memory_bytes: 4036
N, M = map(int, input().split())
c = [1 for _ in range(N)]
H = list(map(int, input().split()))

for i in range(M):
    a, b = map(int, input().split())
    if H[a-1] < H[b-1]:
      c[a-1] = 0
    elif H[a-1] > H[b-1]:
      c[b-1] = 0
    elif H[a-1] == H[b-1]:
      c[a-1] = 0
      c[b-1] = 0

print(c.count(1))

Measured memory_bytes: 20840
#include<iostream>
using namespace std;
int main(){
int siharai=1;
int oturi;
int a;

while(siharai!=0){
cin>>siharai;
oturi=0;
if(siharai==0)
break;

oturi=1000-siharai;

if(oturi>500){
a+=1;
oturi-=500;
}


while(oturi>=100){

a+=1;
oturi-=100;


}

while(oturi>=50){

a+=1;
oturi-=50;


}

while(oturi>=10){

a+=1;
oturi-=10;


}

while(oturi>=5){

a+=1;
oturi-=5;

}

while(oturi>=1){

a+=1;
oturi-=1;


}
cout<<a<<'\n';
a=0;
}

return 0;

}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pli = pair<ll, int>;
using pil = pair<int, ll>;
using uint = unsigned int;
template <typename T>
using Graph = vector<vector<T>>;
const int MOD = 1e9 + 7;
const ld PI = acosl(-1);

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

    int N;
    cin >> N;

    bool ans = false;
    int cnt = 0;
    for (int i = 0; i < N; ++i) {
        int D1, D2;
        cin >> D1 >> D2;
        if (D1 == D2)
            cnt++;
        else
            cnt = 0;
        if (cnt >= 3)
            ans = true;
    }

    cout << (ans ? "Yes" : "No") << endl;

    return 0;
}


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


#define f(i,a,b) for(int i=(int)(a);i<=(int)(b);i++)
#define char_f(i,a) for(int i=(int)(a);(char)s[i]!='\0';i++)
#define rf(i,a,b) for(int i=(int)(a);i>=(int)(b);i--)
#define llf(i,a,b) for(long long int i=(long long int)(a);i<=(long long int)(b);i++)
#define llrf(i,a,b) for(long long int i=(long long int)(a);i>=(long long int)(b);i--)



#define ll long long
#define fi first
#define se second
#define pb push_back
#define pop pop_back
#define mem(ara) memset((ara),0,sizeof(ara))
#define memn(ara) memset((ara),-1,sizeof(ara))
#define bb begin()
#define ee end()
#define em emplace
#define eb emplace_back





#define si set<int>
#define sd set<double>
#define sll set<long long int>
#define ss set<string>
#define sc set<char>

#define pii pair<int,int>
#define pli pair<long long int,int>
#define pil pair<int,long long int>
#define pll pair<long long int,long long int>
#define pci pair<char,int>
#define pic pair<int,char>
#define pcl pair<char,long long int>
#define plc pair<long long int,char>

#define pss pair<string,string>
#define pcc pair<char,char>

#define pis pair<int,string>
#define psi pair<string,int>
#define pls pair<long long int,string>
#define psl pair<string,long long int>
#define pdd pair<double,double>
#define pcs pair<char,string>
#define psc pair<string,char>



#define vi  vector<int>
#define vll vector<long long int>
#define vd vector<double>
#define vs vector<string>
#define vc vector<char>
#define vii vector<pii>



#define mod 1000000007
#define mx (1<<30)-1
#define llmx (1ll<<62)
#define n_size 100005
#define g_size 10000005
double PI=acos(-1);



///unsigned int uMAX=4294967295;
///unsigned ll int ullMAX=18446744073709551615;





int arr[g_size];



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

	int n,m,T,res;

	int maxi=-mx,mini=mx,count=0;

	int i,j,k;

	bool flag;

	string s1,s2;

	char s[100000];

	int ara[n_size],ara2[n_size];

	flag=true;
	bool f2=false;

	cin>>n>>m>>k;

	count=k;

	int c=0;

	while(count<=n){

        if(flag==true){
            c++;
            count+=m;
            flag=false;
        }
        else if(flag==false)
        {
            count+=k;
            flag=true;
        }
	}

	cout<<c-1<<endl;

}


Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long n = sc.nextLong();
        long n_ = n;
        List<Integer> prime = new ArrayList<>();
        int[] fact = new int[10000000];
        for(int i=2;i<9999999;i++){
            if(n_ % i == 0){
                prime.add(i);   //素因数
            }
            while(n_ % i == 0){
                n_ /= i;
                fact[i]++;      //実際に何乗しているか
            }
            if(n_ == 1){
                break;
            }
        }
        if(n == 1){
            System.out.println(0);
        }else if(prime.isEmpty()){    //素数だった時
            System.out.println(1);
        }else {
            int count = n_ == 1 ? 0 : 1;    //割り切れてない場合素数が残っている
            for (int p : prime) {
                int i = 1;
                while (i <= fact[p]) {
                    fact[p] -= i;
                    i++;
                    count++;
                }
            }
            System.out.println(count);
        }
    }
}


Measured memory_bytes: 66456
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define loop(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  loop(i,0,n)
#define all(c) c.begin(),c.end()
#define rall(c) c.rbegin(),c.rend()
#define vi vector<int>
#define vl vector<ll>
#define pll pair<ll,ll>
#define vpll vector<pll>

int main(){
    int n;
    cin>>n;
    ll int d[n];
    ll int ans=0; 
    rep(i,n)cin>>d[i];
    for(int i=0;i<n;i++){
        for(int j=i+1;j<n;j++){
            ans+=d[i]*d[j];
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
# -*- coding:utf-8 -*-

n, k = map(int, input().split())
d = list(map(int, input().split()))

while True:
    res = n
    for x in d:
        res = str(res).replace(str(x), "X")
    if "X" in res:
        n += 1
    else:
        print(res)
        exit()


Measured memory_bytes: 2940
#include <stdio.h>
#include <vector>
#include <algorithm>
#include <string>
#include <iostream>
#include <math.h>
#define rep(i,n) for(int i = 0; i <(n); i++)
using namespace std;
typedef long long ll;

int main(void) {
	int tmp, i = 0,j, can = 1, can2 = 0;
	ll N, x1, x2, y1, y2, t1, t2,dist,dt;
	scanf("%lld", &N);
	scanf("%lld %lld %lld", &t1, &x1, &y1);
	if (N == 1) {
		dist = x1 + y1;
		dt = t1;
		if (dist > dt) {
			can = 0;
		}
		if ((dist & 1) == (dt & 1)) {

		}
		else {
			can = 0;
		}
		
	}
	else {
		rep(i, N - 1) {
			scanf("%lld %lld %lld", &t2, &x2, &y2);
			dist = abs(x1 - x2) + abs(y1 - y2);
			dt = abs(t1 - t2);
			if (dist > dt) {
				can = 0;
				break;
			}
			if ((dist & 1) == (dt & 1)) {

			}
			else {
				can = 0;
				break;
			}
			x1 = x2; y1 = y2; t1 = t2;

		}
	}

	if (can == 1) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
	
	return 0;
}

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

#define INF_LL (int64)1e18
#define INF (int32)1e9
#define REP(i, n) for(int64 i = 0;i < (n);i++)
#define FOR(i, a, b) for(int64 i = (a);i < (b);i++)
#define all(x) x.begin(),x.end()
#define fs first
#define sc second

using int32 = int_fast32_t;
using uint32 = uint_fast32_t;
using int64 = int_fast64_t;
using uint64 = uint_fast64_t;
using PII = pair<int32, int32>;
using PLL = pair<int64, int64>;

const double eps = 1e-10;

template<typename A, typename B>inline void chmin(A &a, B b){if(a > b) a = b;}
template<typename A, typename B>inline void chmax(A &a, B b){if(a < b) a = b;}

int main(void){
	int32 n, m, s, g1, g2;
	while(cin >> n >> m >> s >> g1 >> g2 && n+m+s+g1+g2){
		int32 d[110][110];
		REP(j, n){
			REP(k, n) d[j][k] = INF;
			d[j][j] = 0;
		}
		REP(i, m){
			int32 u, v, c;
			cin >> u >> v >> c; u--; v--;
			d[u][v] = c;
		}
		REP(k, n){
			REP(i, n){
				REP(j, n){
					if(d[i][j] > d[i][k]+d[k][j]) d[i][j] = d[i][k]+d[k][j];
				}
			}
		}
		int32 res = INF;
		s--; g1--; g2--;
		REP(i, n){
			res = min(res, d[s][i]+d[i][g1]+d[i][g2]);
		}
		cout << res << endl;
	}
}


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

int main() {
  
  int N=0;
  cin >> N;
  
  int ans=0;
  
  if(N%2==0) {
    
    ans = N/2;
    
    cout << ans << endl;
    
  } else if(N%2!=0) {
    
    ans = N/2+1;
    
    cout << ans << endl;
    
  }
  
}

Measured memory_bytes: 256
import math

pts = []
line = input()
N = int(line)
for _ in range(0, N):
    line = input()
    x, y = list(map(int, line.split()))
    pts += [[x, y]]

def dist(i, j):
    x1, y1 = pts[i]
    x2, y2 = pts[j]
    return math.sqrt((x1 - x2)**2 + (y1 - y2)**2)
    
def btsp():
    dp = [ [0] * N for _ in range(0, N)]
    for i in range(1, N):
        dp[0][i] = dp[0][i - 1] + dist(i - 1, i)
    for i in range(1, N):
        for j in range(i, N):
            if i == j - 1 or i == j:
                m = 10 ** 10
                for k in range(0, i):
                    m = min(m, dp[k][i] + dist(j, k))
                dp[i][j] = m
            else:
                dp[i][j] = dp[i][j - 1] + dist(j - 1, j)
    return dp[N - 1][N - 1]

print(btsp())


Measured memory_bytes: 25628
n = int(input())
x = [0]*n
y = [0]*n
z = [0]*n
for i in range(n):
  x[i],y[i],z[i] = map(int,input().split())
a = [0]*n
b = [0]*n
c = [0]*n
a[0] = x[0]
b[0] = y[0]
c[0] = z[0]

for i in range(1,n):
  a[i] = max(b[i-1],c[i-1]) + x[i]
  b[i] = max(c[i-1],a[i-1]) + y[i]
  c[i] = max(a[i-1],b[i-1]) + z[i]
print(max(a[-1],b[-1],c[-1]))

Measured memory_bytes: 26740
def d(a,b);(a[0]-b[0]).abs+(a[1]-b[1]).abs;end
M=$<.map{|l|l.split.map(&:to_i)}
n,m=M.shift
S=M.shift(n)
puts S.map{|s|(1..m).min_by{|i|d(M[i-1],s)}}

Measured memory_bytes: 1788