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

public class MainClass
{
	public const long Giri = 1000000007;
	public const long DpInf = 99999999999;
	
	public static void Main(string[] args)
	{
		var p = Input().ToInt();
		var k = new HashSet<int>();
		for(int i = 0; i < p.Length; i++)
		{
			if(!k.Contains(p[i]))
				k.Add(p[i]);
		}
		Console.WriteLine(k.Count == 2 ? "Yes" : "No");
	}
	
	
	static long GCD(long a, long b)
	{
		var v = new[] { a, b };
		while (v[1] != 0) { v = new[] { v[1], v[0] % v[1] }; }
		return v[0];
	}
	public static string[] Input() { return Console.ReadLine().Split(); }
}

public static class Smarter
{
	public static int ToInt(this string str) { return int.Parse(str); }
	public static long ToLong(this string str) { return long.Parse(str); }
	public static int[] ToInt(this string[] str, int offset = 0)
	{
		var r = new int[str.Length];
		for(int i = 0; i < str.Length; i++) r[i] = str[i].ToInt() + offset;
		return r;
	 }
}

class HeapQueue<T> 
{
	private List<T> _buffer;
	private Comparison<T> _comparer;
	
	public HeapQueue()
	{
		_buffer = new List<T>();
	}
	
	public HeapQueue(int capacity, Comparison<T> comparer = null)
	{
		_buffer = new List<T>(capacity);

		_comparer = comparer;
	}
	
	public void Push(T el)
	{
		List<T> array = _buffer;
		int n = array.Count;
		array.Add(el);
		
		while (n != 0)
		{
			int i = (n - 1) / 2;
			if (Compare(array[n], array[i]) > 0)
			{
				T tmp = array[n]; array[n] = array[i]; array[i] = tmp;
			}
			n = i;
		}
	}
	
	public T Pop()
	{
		T el = _buffer[0];
		
		List<T> array = _buffer;
		
		int n = array.Count - 1;
		array[0] = array[n];
		array.RemoveAt(n);

		for (int i = 0, j; (j = 2 * i + 1) < n; )
		{
			if ((j != n - 1) && (Compare(array[j], array[j + 1]) < 0))
				j++;
			if (Compare(array[i], array[j]) < 0)
			{
				T tmp = array[j]; array[j] = array[i]; array[i] = tmp;
			}
			i = j;
		}
		return el;
	}
	
	public T Peep()
	{
		if(_buffer.Count <= 0)
			return default(T);

		return _buffer[0];
	}
	
	public bool Contains(T t)
	{
		return _buffer.Contains(t);
	}
	
	private int Compare(T left, T right)
	{
		return _comparer(left, right);
	}
	
	public int Count
	{
		get{ return _buffer.Count; }
	}
	
}


Measured memory_bytes: 13396
#include<bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
const long long mod = 1e9+7;
const int dx[4] = {0,1,0,-1};
const int dy[4] = {1,0,-1,0};
//////////////////////////////////

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

    return 0;
}

// EOF


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define repr(i,k,n) for(int i = (k); i < (n); i++)
#define rep(i,n) repr(i,0,n)
#define ALL(a) begin(a),end(a)
const int INF = 114514810;
const int MOD = 1000000007;
typedef vector<int> vi;
typedef vector<string> vs;
typedef long long ll;
int ctoi(const char c){
  switch(c){
    case '0': return 0;
    case '1': return 1;
    case '2': return 2;
    case '3': return 3;
    case '4': return 4;
    case '5': return 5;
    case '6': return 6;
    case '7': return 7;
    case '8': return 8;
    case '9': return 9;
    default : return -1;
  }
}
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N,K,A,c=0,f;
	vi Ai;
	cin >> N >> K;
	rep(i,N){
		cin >> A;
		Ai.push_back(A);
	}
	if (N==K){
		cout << '1' << endl;
	}else{
		c++;
		f=N-K;
		if (f<=K-1){
			cout << '2' << endl;
		}else{
			c+=f/(K-1);
			if (f%(K-1)!=0){
				c++;
			}
			cout << c << endl;
		}
	}
}

Measured memory_bytes: 892
#include <bits/stdc++.h>
#define pii pair<int,int>
#define pll pair<ll,ll>
#define fr first
#define sc second
#define ll  long long
#define mp make_pair
#define mod 1000000007

using namespace std;

vector<int>p[100100];

pii z[100100];
set<int>st;
int res[100100];
bool v[100100];
bool b =0;
stack<int>st1;
bool dfs(int x,int s){
    v[x] = 1;
    bool b1 = st.empty();
    for(int i=0 ;i <p[x].size() ; i++){
        if(x == s){
            memset(v,0,sizeof v);
            v[x] = 1;
        }
        if(v[p[x][i]])
            continue;
        bool b2 = 0;
        if(st.count(p[x][i])){
            st.erase(p[x][i]);
            b2 = 1;
        }
        if(dfs(p[x][i],s)){
            st1.push(p[x][i]);
            return 1;
        }
        if(b2)
            st.insert(p[x][i]);
        b1 = 0;
    }
    return b1;
}

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

    for(int i=1 ;i <=n ;i ++){
        z[i].fr = p[i].size();
        z[i].sc = i;
    }
    sort(z+1,z+n+1);
    for(int j=1; j<=n ; j++){
        st.clear();
        while(!st1.empty())
            st1.pop();
        memset(v,0,sizeof(v));
        for(int i=0 ; i<p[z[j].sc].size() ; i++)
            st.insert(p[z[j].sc][i]);
            if(dfs(z[j].sc,z[j].sc)){
                st1.push(z[j].sc);
                cout<<st1.size()<<endl;
                bool b = 0;
                while(!st1.empty()){
                    if(b)
                        printf(" ");
                    b = 1;
                    printf("%d",st1.top());
                    st1.pop();
                }
                cout<<endl;
                return 0;
            }
    }
    return 0;
}


Measured memory_bytes: 16848
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
using PLL = pair<ll, ll>;
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repn(i,n) for(int i = 0; i <= (int)(n); i++)
#define srep(i,l,n) for(int i = l; i < (int)(n); i++)
#define srepn(i,l,n) for(int i = l; i <= (int)(n); i++)
#define drep(i,n) for(int i = (int)(n-1); i >= 0; i--)
#define drepn(i,n) for(int i = (int)(n); i >= 0; i--)
#define size(s) (int)s.size()
#define debug(var)  do{std::cout << #var << " : ";view(var);}while(0)
template<typename T> void view(T e){std::cout << e << std::endl;}
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ view(v); } }
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; }
template<class T = int> using V = vector<T>;
template<class T = int> using VV = vector<V<T>>;
bool isIn(int i, int j, int h, int w) {return i >= 0 && i < h && j >= 0 && j < w;}
void Yes(){cout << "Yes" << endl;}
void No(){cout << "No" << endl;}
void YES(){cout << "YES" << endl;}
void NO(){cout << "NO" << endl;}
void err() {cout << -1 << endl;}
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define pb push_back
#define ep emplace_back

const int MOD = 1000000007;
const int INF = 1e9;

#define PI acos(-1);
int dx[4] = {1,-1,0,0};
int dy[4] = {0,0,1,-1};
int ddx[8] = {1,1,1,-1,-1,-1,0,0};
int ddy[8] = {0,1,-1,0,1,-1,1,-1};


int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll n;
    cin >> n;
    string ans = "";
    while(n > 0) {
        n--;
        ans += (char)('a' + n % 26);
        n /= 26;
    }
    reverse(all(ans));
    cout << ans << endl;
}

Measured memory_bytes: 3672
n, l = gets.chomp.split.map(&:to_i)
arr = (0..(n-1)).to_a.map{|a| l + a}
sum = arr.inject(:+)

if l >= 0
	puts sum - arr[0]
elsif l < 0
	if n > l.abs 
		puts sum
	else 
		puts sum - arr[-1]
	end
end



Measured memory_bytes: 14352
// clang-format off
	#include <bits/stdc++.h>
	using namespace std; using ll = long long; using uint = unsigned int; using ull = unsigned long long;
	#define SFINAE(x, ...)	template <class, class = void> struct x : false_type {}; template <class T> struct x<T, void_t<__VA_ARGS__>> : true_type {};
	SFINAE(DefaultIO, decltype(cout << declval<T &>()))
	SFINAE(IsTuple, typename tuple_size<T>::type)
	SFINAE(Iterable, decltype(begin(declval<T>())))
	template <class T> constexpr char Space(const T &) { return (Iterable<T>::value or IsTuple<T>::value) ? '\n' : ' '; }
	template <auto &os> struct Writer {
		template <class T> void Impl(T const &t) const {
			if constexpr (DefaultIO<T>::value) os << t;
			else if constexpr (Iterable<T>::value) { int i = 0; for (auto &&x : t) ((i++) ? (os << Space(x), Impl(x)) : Impl(x)); }
			else if constexpr (IsTuple<T>::value) apply([this](auto const &... args) { int i = 0; (((i++) ? (os << ' ', Impl(args)) : Impl(args)), ...);}, t);
			else static_assert(IsTuple<T>::value, "No matching type for print");
		}
		template <class F, class... Ts> auto &operator()(F const &f, Ts const &... ts) const { return Impl(f), ((os << ' ', Impl(ts)), ...), os << '\n', *this; }
	};
	template <auto &is> struct Reader {
		template <class T> auto& Rd(T &t) const {
			if constexpr (DefaultIO<T>::value) is >> t;
			else if constexpr (Iterable<T>::value) for (auto &x : t) Rd(x);
			else if constexpr (IsTuple<T>::value) apply([this](auto &... args) { (Rd(args), ...); }, t);
			else static_assert(IsTuple<T>::value, "No matching type for read");
			return *this;
		}
		template <class T> auto operator[](T t) const { Rd(t); return t; }
		template <class... Ts> auto operator()(Ts... ts) const { (Rd(ts), ...); return tuple{move(ts)...}; }
	};
	#ifdef NARUT_LOCAL
	#define Debug(...) cerr << "\033[0;31m", Writer<cerr>{}(__VA_ARGS__), cerr << "\033[0m\n"
	#define ASSERT(...) if(not(__VA_ARGS__)) throw runtime_error("local assertion failed")
	#else
	#define Debug(...) 0
	#define ASSERT(...) 0
	#endif
	[[maybe_unused]] constexpr Reader<cin> Cin; [[maybe_unused]] constexpr Writer<cout> Cout;
	#define FOR(i, j, n) for (int i = int(j); i < int(n); ++i)
	#define ROF(i, j, n) for (int i = int(n) - 1; i >= int(j); --i)
	#define let auto const

// clang-format on





ll Main() {
	auto [x,k,d] = Cin(0ll,0ll,0ll);
	x = abs(x);
	let n = x/d;
	if(n > k) {
		return x - k*d;
	} else {
		k -= n;
		x -= n*d;
		if (k&1) {
			return abs(x-d);
		} else {
			return x;			
		}
	}
}

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cout << fixed << setprecision(10);
#ifdef NARUT_LOCAL
	assert(freopen("io/test.in", "r", stdin));
	cin.exceptions(cin.badbit | cin.failbit);
	cerr << fixed << setprecision(10);
#endif

	cout<<Main();
}


Measured memory_bytes: 3660
import numpy as np 
# 初期入力
mod = 10**9 +7
ans =0
N =int(input())
A =list(map(int,input().split()))
A_np =np.array(A,dtype=np.int64)

# xor 各桁の０と1の数を求め
for i in range(60):
    c =np.count_nonzero(A_np &1)
    ans +=2**i*c*(N-c)
    A_np >>=1
print(ans %mod)

Measured memory_bytes: 68804
#include <iostream>
#include <sstream>
#include <string>
#include <cmath>
#include <array>
#include <vector>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <utility>
#include <iomanip>
#include <numeric>
#include <climits>
#include <algorithm>
#include <cstdint>
using namespace std;

int main()
{
    string str;
    cin >> str;
    for (int i = 0; i < str.length(); i++)
        if (str[i] == '1')
            str[i] = '9';
        else str[i] = '1';
    cout << str;
}

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

int main()
{
  string S; cin >> S;
  string T; cin >> T;

  ll ans = 0;
  for (int i=0; i<3; i++) {
    if (S[i] == T[i]) ans++;
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
object Main extends App {
    val input = scala.io.Source.stdin.getLines.toList
    val n = input(0).toInt
    val stairs = input(1).split(" ").map(_.toInt)
    var max = 0
    var current = 0
    for (i <- 0 until n - 1) {
      if (stairs(i) >= stairs(i + 1))
        current = current + 1
      else {
        if (current > max) {
          max = current
        }
        current = 0
      }
    }
    if (current > max)
      max = current
    
    println(max)
}

Measured memory_bytes: 46876
#include <bits/stdc++.h>
using namespace std;
int main(){
  long long int n;
  cin >> n;
  cout << (n * (n + 1) / 2 + 15 * (n / 15) * (n / 15 + 1) / 2 - (3 * (n / 3) * (n / 3 + 1) / 2) - 5 * (n / 5) * (n / 5 + 1) / 2) << endl;
}

Measured memory_bytes: 3636
Var a,b,c:Array[1 .. 200000] of Int64;
    i,n,sum,r1,r2:Int64;
Begin
    Readln(n);
    For i:=1 to n do begin
        Read(a[i]);
        Inc(b[a[i]]);
    End;
    For i:=1 to n do c[i]:=(b[i]*(b[i]-1) div 2);
    For i:=1 to n do sum:=sum+c[i];
    For i:=1 to n do begin
        If c[a[i]]=0 then begin
            Writeln(sum); Continue;
        End;
        r1:=b[a[i]]-1; r2:=b[a[i]]-2;
        Writeln(sum-c[a[i]]+(r1*r2 div 2));
    End;
End.

Measured memory_bytes: 6912
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <set>
#include <map>
#include <queue>
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <ctime>
#include <cstring>
#include <cctype>
#include <cassert>
#include <limits>
#include <functional>
#include <iomanip>
#include <complex>
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define rer(i,l,u) for(int (i)=(int)(l);(i)<=(int)(u);++(i))
#define reu(i,l,u) for(int (i)=(int)(l);(i)<(int)(u);++(i))
#if defined(_MSC_VER) || __cplusplus > 199711L
#define aut(r,v) auto r = (v)
#else
#define aut(r,v) __typeof(v) r = (v)
#endif
#define each(it,o) for(aut(it, (o).begin()); it != (o).end(); ++ it)
#define all(o) (o).begin(), (o).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
#define mset(m,v) memset(m,v,sizeof(m))
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3fLL
using namespace std;
typedef vector<int> vi; typedef pair<int, int> pii; typedef vector<pair<int, int> > vpii; typedef long long ll;
typedef pair<pii,int> ppiii ;
template<typename T, typename U> inline void amin(T &x, U y) { if(y < x) x = y; }
template<typename T, typename U> inline void amax(T &x, U y) { if(x < y) x = y; }
typedef complex<double> P;
int main(){
	vector<ll> hoge(3);
	rep(i,3)cin>>hoge[i];
	sort(hoge.begin(),hoge.end());
	if((hoge[0]%2==1)&&(hoge[1]%2==1)&&(hoge[2]%2==1)){
		cout<<hoge[0]*hoge[1]<<endl;
	}else{
		cout<<"0"<<endl;
	}
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
    int x,a,b,cnt;
    scanf("%d",&x);
    scanf("%d",&a);
    scanf("%d",&b);
    x-=a;
    while(x>=b)
    {
        x-=b;
    }
    printf("%d",x);
    return 0;
}

Measured memory_bytes: 128
/*input

*/


//assic value of ('0'-'9') is(48 - 57) and (a-z) is (97-122) and (A-Z) is(65-90) and 32 for space
#include<bits/stdc++.h>
using namespace std;
#define ll          long long
#define pb          push_back
#define pii         pair<ll int,ll int>
#define vpii        vector< pii >
#define vi          vector<ll int>
#define vs			vector< string >
#define vvi         vector< vector< ll > >
#define inf			(ll)1e18
#define all(it,a)   for(auto it=(a).begin();it!=(a).end();it++) 
#define F           first
#define S           second
#define sz(x)       (ll int)x.size()
#define rep(i,a,b)	for(ll int i=a;i<b;i++)
#define repr(i,a,b) for(ll int i=a;i>b;i--)
#define lbnd        lower_bound
#define ubnd        upper_bound
#define mp          make_pair
#define whatis(x)   cout << #x << " is " << x << "\n";
#define graph(n)    adj(n,vector< ll > () )
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const ll N = 21;
ll n,m;
vvi adj(N,vi (N,0));
vvi mat(N,vi (N,0));

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

ll temp_ans = inf;
vvi dp(N,vi (N,-1));

void fun(pii curi)
{
	queue<pair< pii,ll > > q;
	q.push(mp(curi,0));
	dp[curi.F][curi.S]=0;
	mat[curi.F][curi.S]=0;
	while(sz(q))
	{
		pii cur = q.front().F;
		ll d = q.front().S;
		q.pop();
		mat[cur.F][cur.S]=0;
		rep(i,0,4)
		{
			ll i1 = cur.F+dx[i];
			ll j1 = cur.S+dy[i];

			if(i1>=0 && j1>=0 && i1<n && j1<m && mat[i1][j1]==1 && dp[i1][j1]>d+1 )
			{
				dp[i1][j1]=d+1;
				q.push(mp(mp(i1,j1),d+1));
				mat[i1][j1]=0;
			}
		}
	}

	return ;
}

int solve()
{
	cin>>n>>m;
	rep(i,0,n)
	{
		string s;cin>>s;
		rep(j,0,m) if(s[j]=='.') adj[i][j]=1; else adj[i][j]=0;
	}

	ll ans=0;
	mat=adj;
	// cout<<fun(mp(0,0),mp(0,2))<<"\n";
	rep(i,0,n) rep(j,0,m) if(adj[i][j]==1)
	{
		mat=adj;
		rep(i1,0,n) rep(j1,0,m) dp[i1][j1]=inf;
		fun(mp(i,j));
		rep(i1,0,n) rep(j1,0,m) if(dp[i1][j1]!=inf) ans=max(ans,dp[i1][j1]);
	} 
	cout<<ans<<"\n";
	// cout<<i<<" "<<j<<" "<<i1<<" "<<j1<<" "<<
	// <<"\n";
	return 0;
}

int main()
{
	auto start = chrono::high_resolution_clock::now();

	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);

	ll test_cases=1;
	//cin>>test_cases;
	while(test_cases--)
		solve();

	auto stop = chrono::high_resolution_clock::now();
	auto duration = chrono::duration_cast<chrono::milliseconds>(stop-start);
	// cout<<"\nduration: "<<(double)duration.count()<<" milliseconds";
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <map>
#include <vector>
using namespace std;
typedef pair<int,int> P;
int n,c;
int fie[11][11];
vector<P> G[11][11];
int dx[6]={-1,0,-1,1,0,1};
int dy[6]={-1,-1,0,0,1,1};
bool used[11][11];
bool flag;

int dfs(int x,int y){
	used[x][y]=true;
	int cnt=1;
	for(int i=0;i<G[x][y].size();i++){
		int nx=G[x][y][i].first,ny=G[x][y][i].second;
		if(!used[nx][ny] && fie[nx][ny]==fie[x][y])cnt+=dfs(nx,ny);
		if(fie[nx][ny]==0)flag=true;
	}
	return cnt;
}

int main(void){
	while(1){
		scanf("%d %d",&n,&c);
		if(n+c==0)break;
		for(int i=1;i<=n;i++){
			for(int j=1;j<=i;j++){
				scanf("%d",&fie[j][i]);
				G[j][i].clear();
				for(int k=0;k<6;k++){
					int nx=j+dx[k],ny=i+dy[k];
					if(nx>=1 && nx<=ny && ny>=1 && ny<=n){
						G[j][i].push_back(P(nx,ny));
					}
				}
			}
		}
		int res=-100;
		for(int i=1;i<=n;i++){
			for(int j=1;j<=i;j++){
				if(fie[j][i]==0){
					fie[j][i]=c;
					int point=0;
					memset(used,0,sizeof(used));
					for(int k=1;k<=n;k++){
						for(int l=1;l<=k;l++){
							if(fie[l][k]>=1 && !used[l][k]){
								flag=false;
								int cnt=dfs(l,k);
								if(!flag){
									if(fie[l][k]==c)point-=cnt;
									else point+=cnt;
								}
							}
						}
					}
					res=max(res,point);
					fie[j][i]=0;
				}
			}
		}
		printf("%d\n",res);
	}
	return 0;
}

Measured memory_bytes: 1036
using System;
using System.Linq;
using System.Text;

class Program
{
    static void Main()
    {
        string s;
        StringBuilder sb = new StringBuilder();
        while ((s = Console.ReadLine()) != null)
        {
            int ans = s.Split().Select(int.Parse).Sum().ToString().Count();
            sb.AppendLine(ans.ToString());
        }
        Console.Write(sb);
    }
}


Measured memory_bytes: 16364
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <cmath>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <iostream>
#include <random>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include <fstream>
#include <unordered_map>
#include <cstdlib>
#include <complex>
#include <cctype>
#include <bitset>
using namespace std;

using ll = long long;
using vll = vector<long long>;
using pll = pair<long long, long long>;
#define rep(i,n) for(long long i(0);(i)<(n);(i)++)
#define REP(i,n) for(long long i(0);(i)<(n);(i)++)
ll INF = 1LL << 60;

//* prime factorization in O(sqrt(n))
void prime_factor(ll n, map<ll, ll> &res){
    for(ll i=2; i*i <= n; i++){ //* n shrinks during the for-loop!
        while(n % i == 0){
            ++res[i];
            n /= i;
        }
    }
    if(n != 1) {
        ++res[n];
    }
}

void solve(long long N){
    if(N<=9){
        cout << 0 << endl;
        return;
    }
    map<ll, ll> fact;
    for(ll i=2; i<=N; i++){
        prime_factor(i, fact);
    }
    ll res = 0;
    //* pick up one >=74
    ll cnt74=0;
    for(auto x: fact){
        if(x.second>= 74)
            cnt74++;
    }
    res += cnt74;

    //* pickup one >=24 and one >= 2 in the rests
    ll cnt24=0, cnt2=0;
    for(auto x:fact){
        if(x.second>= 24){
            cnt24++; cnt2++;
        }
        else if(x.second >= 2){
            cnt2++;
        }
    }
    res += cnt24*(cnt2-1);
    //* pickup one >= 14 and one >=4 in the rests
    ll cnt14=0, cnt4=0;
    for(auto x:fact){
        if(x.second>= 14){
            cnt14++; cnt4++;
        }
        else if(x.second >= 4){
            cnt4++;
        }
    }
    res += cnt14*(cnt4-1);
    //* pickup two >= 4 and one >=2 in the rests
    cnt4=0; cnt2=0;
    for(auto x:fact){
        if(x.second>=4){
            cnt4++; cnt2++;
        }
        else if(x.second>=2){
            cnt2++;
        }
    }
    res += cnt4*(cnt4-1)/2 * (cnt2-2);

    cout << res << endl;
}

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


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <numeric>
#include <queue>
#include <utility>
#include <cmath>
#include <map>
#include <iomanip>
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(a)  (a).begin(),(a).end()

typedef long long lint;
typedef pair<int,int> P;

#define SIZE_OF_ARRAY(array) (sizeof(array)/sizeof(array[0]))

int main()
{

    int N;
    cin >> N;

    int x;
    int y;

    vector<P> xy;

    REP(i,N){
    	cin >> x >> y;
    	xy.push_back(P(x,y));
    }


    map<P,lint> map;
    FOR(i,0,N){
    	FOR(j,i+1,N){
    		map[P(xy[i].first-xy[j].first,xy[i].second-xy[j].second)] ++;
    		map[P(xy[j].first-xy[i].first,xy[j].second-xy[i].second)] ++;
    	}
    }

    lint ans=0;
    for(auto i : map){
        ans = max(ans, i.second);
    }
    ans = N-ans;

    cout << ans << endl;

}


Measured memory_bytes: 384
#include<stdio.h>
int main(void)
{
	int m[100], d[100];
	scanf("%d%d%d%d", &m[0], &d[0], &m[1], &d[1]);
	if (m[0] != m[1]) {
		printf("1\n");
	}
	else {
		printf("0\n");
	}

	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
 
 
 
int main() {
  ios_base::sync_with_stdio(false); cin.tie(0);
  int n, W; cin >> n >> W;
  vector<long long> dp(1<<17, 1ll<<60);
  dp[0] = 0;
  for (int i = 1; i <= n; ++i) {
    int w, v; cin >> w >> v;
    for (int j = (1<<17) - 1; j >= v; --j) {
      dp[j] = min(dp[j], dp[j - v] + w);
    }
  }
  for (int i = (1<<17) - 1; i >= 0; --i) if (dp[i] <= W) {
    cout << i << '\n';
    exit(0);
  }
  assert(0);
}


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

#define int long long
#define double long double
#define rep(i, n) for (int i = 0; i < (n); i++)
#define reps(i, n) for (int i = 1; i <= (n); i++)
#define all(x) (x).begin(), (x).end()
#define uniq(x) (x).erase(unique(all(x)), (x).end())
#define bit(n) (1LL << (n))
#define dump(x) cerr << #x " = " << (x) << endl
using vint=vector<int>;
using vvint=vector<vint>;
using pint=pair<int, int>;
using vpint=vector<pint>;
template<typename T> using priority_queue_rev=priority_queue<T, vector<T>, greater<T>>;
constexpr double pi = 3.1415926535897932384626433832795028L;
constexpr int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
constexpr int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int gcd(int a, int b) {
    while (b) { swap(a %= b, b); }
    return a;
}
int lcm(int a, int b) { return a / gcd(a, b) * b; }
template<typename T> void fin(T mes) {
    cout << mes << endl;
    exit(0);
}
template<typename T1, typename T2> bool chmax(T1 &a, const T2 &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template<typename T1, typename T2> bool chmin(T1 &a, const T2 &b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}
template<typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &rhs) {
    os << "(" << rhs.first << ", " << rhs.second << ")";
    return os;
}
template<typename T> ostream &operator<<(ostream &os, const vector<T> &rhs) {
    os << "{";
    for (auto itr = rhs.begin(); itr != rhs.end(); itr++) {
        os << *itr << (next(itr) != rhs.end() ? ", " : "");
    }
    os << "}";
    return os;
}
struct setup {
    static constexpr int PREC = 20;
    setup() {
        cout << fixed << setprecision(PREC);
        cerr << fixed << setprecision(PREC);
    };
} setup;

int N;
int a[110000], b[110000];
vpint G[110000];
int K = 0;
int c[110000];

void dfs(int idx, int par, int prevc) {
    int cur = 1;
    rep(i, G[idx].size()) {
        pint p = G[idx][i];
        if (p.first == par) { continue; }
        if (cur == prevc) { cur++; }
        c[p.second] = cur;
        chmax(K, cur);
        dfs(p.first, idx, cur);
        cur++;
    }
}

signed main() {
    cin >> N;
    reps(i, N - 1) {
        cin >> a[i] >> b[i];
        G[a[i]].push_back({b[i], i}), G[b[i]].push_back({a[i], i});
    }
    dfs(1, 0, -1);
    cout << K << endl;
    reps(i, N - 1) { cout << c[i] << endl; }
}


Measured memory_bytes: 12032
#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;

using ll = long long;

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

    int W;
    cin >> W;

    vector<int> weights( N );
    vector<int> values( N );
    for ( int i = 0; i < N; ++i ) cin >> weights[ i ] >> values[ i ];

    vector<vector<ll>> dp( N + 10, vector<ll>( W + 10, 0 ) );
    for ( int i = 0; i < N; ++i )
    {
        for ( int j = 0; j <= W; ++j )
        {
            dp[ i + 1 ][ j ] = j >= weights[ i ] ? max( dp[ i ][ j ], dp[ i ][ j - weights[ i ] ] + values[ i ] ) : dp[ i ][ j ];
        }
    }

    cout << dp[ N ][ W ] << endl;
}

Measured memory_bytes: 87296
/*********************************************************************************\
*  _________  _      _  ________  _       _       __       ________               *
* |___   ___|| |    | ||  ______|| |     | |     /  \     |  ____  |              *
*     | |    | |    | || |______ | |_____| |    / /\ \    | |____| |              *
*     | |    | |    | ||______  ||  _____  |   / /__\ \   |  __  __|              *
*     | |    | |____| | ______| || |     | |  / ______ \  | |  \ \                *
*     |_|    |________||________||_|     |_| /_/      \_\ |_|   \_\               *
*                                                                                 *
*   Department of Computer Science & Engineering                                  *
*   Student ID : 18CSE035                                                         *
*   Bangabnadhu Sheikh Mujibur Rahman Science & Technology University,Gopalgonj.  *
*                                                                                 *
\*********************************************************************************/

//Now Write to Code ___________________________


#include <bits/stdc++.h>
using namespace std ;
 
 
typedef long long                ll;
typedef long double              ld;
typedef unsigned long long       ull;
typedef pair <int,int>           pii;
typedef pair <ll,ll>             pll;
typedef vector <int>             vi;
typedef vector <ll>              vll;
typedef vector <vector <int> >   vvi;
 
inline int    Int(){int x; cin >> x; return x;}
inline ll     Long(){ll x; cin >> x; return x;}
inline float  Float(){float x; cin >> x; return x;}
inline double Double(){double x; cin >> x; return x;}
inline void   Yes(){cout << "Yes" << endl;}
inline void   No(){cout << "No" << endl;}
inline void   YES(){cout << "YES" << endl;}
inline void   NO(){cout << "NO" << endl;}
 
const int N             =(int)2e5 + 5;
const int maxN          =(int)1e6 + 6;
const ll  Mod           =(ll)1e9 + 7;
const int inf           =(int)2e9;
const ll  Inf           =(ll)1e18;
 
#define     T           int t,q; cin >> t; for(q=1;q<=t;q++)
#define     debug(x)    cerr << #x << " = " << x << '\n' ;
#define     rep(i,b,e)  for(__typeof(e) i=(b); i!=(e+1)-2*(b > e); i =i+1-2*(b > e))
#define     Int         Int()
#define     Long        Long()
#define     Float       Float()
#define     Double      Double()
#define     all(x)      x.begin() , x.end()
#define     sz(x)       (int)x.size()
#define     ff          first
#define     ss          second
#define     pb          push_back
#define     eb          emplace_back
#define     mem(a)      memset(a , 0 ,sizeof a)
#define     memn(a)     memset(a , -1 ,sizeof a)
#define     biday       return 0 
#define     PI          3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342
 
 
int main()
{
	int i;
	string s;
	cin >> s;

	for(i=0; i<3; i++)cout << s[i];

	cout << endl;
    

    biday;
}
 
//...............BYE BYE................

Measured memory_bytes: 3572
#include <algorithm>
#include <iomanip>
#include <iostream>
#include <vector>

using namespace std;

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

    vector<int> vec(n);
    for (auto &num : vec) {
        cin >> num;
    }
    sort(vec.begin(), vec.end());

    double res = 1.0 * (vec[0] + vec[1]) / 2;
    for (int i = 2; i < n; i += 1) {
        res = (res + vec[i]) / 2;
    }

    cout << fixed << setprecision(10) << res << "\n";
    return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<vector>
#include<map>
#include<queue>
#include<algorithm>
#include<functional>

using namespace std;

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


struct q_t
{
	int x;
	bool operator<(const q_t& rhs) const
	{
		return x>rhs.x;
	}
};


priority_queue<q_t> que;


void push(q_t q)
{
	que.push(q);
}


int pop(q_t& q)
{
	if(que.empty()) return 0;
	q=que.top();
	que.pop();
	return 1;
}


template<typename T>
vector<vector<T> > vv_alloc(int w, int h, const T& f=T())
{
	vector<vector<T> > ret;

	ret.resize(h);
	for(auto& x : ret) x.resize(w, f);
	return ret;
}


ll mod_pow(ll x, ll n, ll m)
{
	ll ret = 1LL;
	for(;n>0;n>>=1)
	{
		if(n&1) ret=(ret*x)%m;
		x=(x*x)%m;
	}
	return ret;
}


ll mod_inv(ll x, ll m)
{
	return mod_pow(x, m-2, m)%m;
}


#ifdef IS_DEBUG
#define dprintf(...) printf(VA_ARGS)
#else
#define dprintf(...)
#endif


struct hoge
{
	const char *p;
	int l;
};


int cmp(const hoge *a, const hoge *b)
{
	for(int i=0;i<a->l && i<b->l;i++)
	{
		if(a->p[i]!=b->p[i])
		{
			if(a->p[i]<b->p[i]) return -1;
			return a->p[i]>b->p[i];
		}
	}
	if(a->l<b->l) return -1;
	return a->l>b->l;
}


int main(void)
{
	char s[5000+2];
	int k;

	while(scanf("%[a-z]\n%d\n", s, &k)==2)
	{
		int l=strlen(s);
		hoge r[5+1];

		for(int i=0;i<6;i++)
		{
			r[i].p="{";
			r[i].l=1;
		}

		for(int i=0;i<l;i++)
		{
			for(int j=1;i+j<=l;j++)
			{
				r[5].p=s+i;
				r[5].l=j;
				if(cmp(&r[5], &r[4])<0)
				{
					int k;
					int is_dup=0;
					for(k=5-1;k>=0;k--)
					{
						int c=cmp(&r[5], &r[k]);
						if(c==0)
						{
							is_dup=1;
							break;
						}
						if(c>0) break;
					}
					if(!is_dup)
					{
						for(int l=4;l>k;l--)
						{
							r[l+1]=r[l];
						}
						r[k+1].p=s+i;
						r[k+1].l=j;
					}
				}
			}
		}
/*
		for(int i=0;i<6;i++)
		{
			printf("%d : %.*s\n", r[i].l, r[i].l, r[i].p);
		}
*/
		printf("%.*s\n", r[k-1].l, r[k-1].p);
	}
	return 0;
}


Measured memory_bytes: 256
parseInt(x::SubString{String}) = parse(Int, x)
parseMap(x::Array{SubString{String},1}) = map(parseInt, x)
function abmp(a,b,p);if b==0;1;elseif b%2==0;k=abmp(a,div(b,2),p);(k*k)%p;else;(a*abmp(a,b-1,p))%p;end;end;;
function binarr(n,p);z=1;for i in 1:n;z=z*i%p;end;fac=Array{Int}(n+1);inv=Array{Int}(n+1);inv[n+1]=abmp(z,p-2,p)
for i in 0:n-1;inv[n-i]=(inv[n+1-i]*(n-i))%p;end;for i in 0:n;fac[i+1]=(((z*inv[i+1])%p)*inv[n+1-i])%p;end;fac;end;

function main()
	p = 1000000007
	n,k = readline() |> split |> parseMap
	a = binarr(n-k+1,p)
	b = binarr(k-1,p)
	for i in 1:min(k,n-k+1)
		println(a[i+1]*b[i]%p)
	end
	if k>n-k+1
		for i in n-k+2:k
			println(0)
		end
	end
end

main()

Measured memory_bytes: 167224
#include <iostream>
#include <bits/stdc++.h>
#include <vector>
#include <algorithm>
typedef long long int ll;
using namespace std;
#define P 1000000007
#define rep(i,n) for(i=0;i<n;++i)
#define repp(i,a,n) for(i=a;i<n;++i)
#define repr(i,a,n) for(i=a;i>=n;--i)
#define pb push_back
#define mp make_pair
#define fi first
#define se second

ll binpowmod(ll a, ll b, ll m) {
    a %= m;
    ll res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a % m;
        a = a * a % m;
        b >>= 1;
    }
    return res;
}

ll binpow(ll a, ll b) {
    ll res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a;
        a = a * a;
        b >>= 1;
    }
    return res;
}

ll modInverse(ll n, ll p)
{
    return binpowmod(n, p-2, p);
}

int main() 
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll t,m,n,i,f=0,j,ans=0;
    cin >> n ;
    ll l=0,k=26;
    while(l<n)
    {
        l+=k;
        k*=26;
        f++;
    }
    
    k/=26;
    l-=k;
    n-=l;
    k/=26;
    string s="";
    //cout << k << endl ;
    //cout << f << endl ;
    ll flag=0;
    k=binpow(26,f-1);
    rep(i,f)
    {
         ll temp;
        if(n==1) 
        {
            s+='a';
            continue;
        }
        char ch='a';
        temp=0;
        //cout << n << endl ; 
        while(n>temp)
        {
            temp+=k;
            ch++;
        }
        temp-=k;
            
            n-=temp;
            ch--;
            s+=ch;
            k/=26;
    }
    cout << s ;
   
    
    return 0;
}

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

int main(){
  int K,N;
  cin >> K >> N;
  
  int A[N];
  for(int i = 0;i < N;i++)  cin >> A[i];
  
  int d[N];
  for(int i = 0;i < N - 1;i++)  d[i] = A[i + 1] - A[i];
  d[N - 1] = K - A[N - 1] + A[0];

  int *max = max_element(d, d+sizeof(d)/sizeof(d[0]));
  cout << K - *max << endl;
  return 0;
}

Measured memory_bytes: 1792
#include<queue>
#include<algorithm>
#include<iostream>
#include<iomanip>
#include<string>
#include<cstdlib>
#include<cstring>
#include<cmath>
using namespace std;
int main(){
  int i,j;
  int a[8],c[30][256],m,n,o,u,v,x,y;
  unsigned b[30][30];
  double z;
  priority_queue<pair<double,pair<int,int> >,vector<pair<double,pair<int,int> > >,greater<pair<double,pair<int,int> > > > e;
  while(cin>>m>>n>>o>>u>>v&&m+n+o+u+v){
    u--;
    v--;
    for(i=0;i<m;i++)
      cin>>a[i];
    memset(b,-1,sizeof(b));
    for(i=0;i<o;i++){
      int p,q,r;
      cin>>p>>q>>r;
      p--;
      q--;
      b[p][q]=b[q][p]=r;
    }
    memset(c,-1,sizeof(c));
    while(e.empty()==0)
      e.pop();
    e.push(make_pair(0,make_pair(u,0)));
    while(e.empty()==0){
      z=e.top().first;
      x=e.top().second.first;
      y=e.top().second.second;
      if(x==v)
	break;
      e.pop();
      if(c[x][y]==-1){
	c[x][y]=1;
	for(i=0;i<m;i++){
	  if((y&(1<<i))==0){
	    for(j=0;j<n;j++){
	      if((int)b[x][j]!=-1)
		e.push(make_pair(z+(double)b[x][j]/a[i],make_pair(j,y|(1<<i))));
	    }
	  }
	}
      }
    }
    if(e.empty())
      cout<<"Impossible"<<endl;
    else
      cout<<showpoint<<z<<endl;
  }
  return 0;
}

Measured memory_bytes: 0
n = int(input())
btc = 380000.0
def is_float(s):
  try:
    float(s)
  except:
    return False
  return True
def get_f(a):
  if is_float(a):
    return float(a)
  else:
    return(a)
fortune = [list(map(get_f,input().split())) for _ in range(n)]
jpy = [f[0] for f in fortune if f[1] == "JPY"]
bit = [f[0] for f in fortune if f[1] == "BTC"]
bit = list(map(lambda x:x*btc,bit))
print(sum(jpy)+sum(bit))

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

int i,j,n,m,c,p;
string s;
int main(){
  vector<tuple<string,int,int>> r;
  for(cin>>n,i=1;i<=n;i++){
    cin>>s>>p;
    r.push_back(make_tuple(s,-1*p,i));
  }
  sort(r.begin(),r.end());
  for(auto x:r)cout<<get<2>(x)<<endl;
}

Measured memory_bytes: 256
import java.math.BigInteger;
import java.util.Scanner;


public class Main{
	
	static Scanner sc = new Scanner(System.in);

	static int n;
	static BigInteger a[], b[];
	
	public static void main(String[] args) {
		
		while(read()){
			solve();
		}

	}
	
	public static boolean read(){
		if(!sc.hasNext()) return false;
		
		n = sc.nextInt();
		
		a = new BigInteger[n];
		b = new BigInteger[n];
		
		for(int i=0; i < n; i++){
			a[i] = sc.nextBigInteger();
			b[i] = sc.nextBigInteger();
		}
		
		return true;
	}
	
	public static void solve(){
		
		for(int i=0; i < n; i++){
			if(a[i].add(b[i]).toString().length() > 80){
				System.out.println("overflow");
			}
			else{
				System.out.println(a[i].add(b[i]));
			}
		}
	}

}

Measured memory_bytes: 12000
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pl;
const ll N = 2e3 + 50;
const ll MOD = 1e9+7;

int a, b, c, d;

int main() {
    cin>>a>>b>>c>>d;
	int flag = 1;
  while(a > 0 &&  c > 0 ) {
  	if(flag) c -= b;
    else a -= d;
    flag = flag ^ 1;
  }
  if(a <= 0) {
  	cout<<"No"<<endl;
  }else {
  	cout<<"Yes"<<endl;
  }

   return 0;
}

Measured memory_bytes: 3636
#include "bits/stdc++.h"
#define in std::cin
#define out std::cout
#define rep(i,N) for(int i=0;i<N;++i)
typedef long long int LL;
typedef std::pair<LL, LL> P;
struct edge { LL to, cost; };

const LL inf = 1123456789012345;
LL n, m, s, t;
std::vector<std::vector<edge>>G;

std::vector<LL> dijkstra(LL s)
{
	std::vector<LL>dist(2 * n + 1, inf);
	std::priority_queue<P, std::vector<P>, std::greater<P>>que;
	dist[s] = 0;
	que.push(P(0, s));
	while (!que.empty())
	{
		P p = que.top(); que.pop();
		LL v = p.second;
		if (dist[v] < p.first) { continue; }
		rep(i, G[v].size())
		{
			edge e = G[v][i];
			if (dist[e.to] > dist[v] + e.cost)
			{
				dist[e.to] = dist[v] + e.cost;
				que.push(P(dist[e.to], e.to));
			}
		}
	}
	return dist;
}

int main()
{
	in >> n >> m >> s >> t;
	std::vector<LL>u(m), v(m), a(m), b(m);
	std::priority_queue<P, std::vector<P>, std::greater<P>>res;
	G.resize(2 * n + 1);
	rep(i, m)
	{
		in >> u[i] >> v[i] >> a[i] >> b[i];
		G[u[i]].push_back({ v[i],a[i] });
		G[v[i]].push_back({ u[i],a[i] });
		G[u[i] + n].push_back({ v[i] + n,b[i] });
		G[v[i] + n].push_back({ u[i] + n,b[i] });
	}
	auto yen = dijkstra(s);
	auto snk = dijkstra(t + n);
	rep(i, n) res.push(std::make_pair(yen[i + 1] + snk[i + 1 + n], i));
	rep(i, n)
	{
		while (res.top().second < i) res.pop();
		out << 1000000000000000 - res.top().first << std::endl;
	}
	return 0;
}


Measured memory_bytes: 24444
#include <bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp> 
//using boost::multiprecision::cpp_int;
using namespace std;
#define ll long long int
#define F first
#define S second
//#define endl "\n"
//#define nl cout<<endl;
#define pb push_back
#define ull unsigned long long 
#define f(i,a,b) for(ll i=a;i<b;i++)
#define Knucklehead ios_base::sync_with_stdio(false);cin.tie(NULL);
//#define mod 100000007
#define mat vector<vector<ll>>
mat cn(ll n, ll m){return vector< vector<ll> >(n, vector<ll>(m));}
bool compare(char &s1,char &s2){return s1 > s2;} 
bool sortmahstyle(const pair<ll,ll> &a,  const pair<ll,ll> &b) 
{ 
    if(a.first < b.first )
        return true;
    if( a.first==b.first && a.S != b.second )
       return true;
    return false;
}
bool cmp(int n, pair<int, int> const& p)
{
    return (p.first < n);
}
//me
ll const mod = 1e9+7;//998244353;
ll const inf = 1e18;
ll const maxn = 2e5+1;

int stoint(string s)
{
     int n = s.size();
     int num = 0;
     f(i,0,n){
          num = num*10+ (int)(s[i]-'0');

     }
     return num;
}


void solve()
{      
     string s ; cin >> s;

     ll n = s.size();

     ll dp[n][2];

     dp[0][0]=1, dp[0][1]=0;

     dp[1][0]=(s[1]==s[0]?1:2), dp[1][1]=1;

     for(ll i = 2; i < n; i++ ){

          if(s[i]==s[i-1]){
               dp[i][0] = dp[i-1][1] + 1;
               dp[i][1] = dp[i-2][0] + 1;
          }
          else{
               dp[i][0] = dp[i-1][0] + 1;
               dp[i][1] = dp[i-2][0] + 1;
          }

     }

     cout << max(dp[n-1][0], dp[n-1][1]) << endl;
}    

int main() {
Knucklehead 
//*
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
/**/ 
          
          ll t;
          /**/t=1;
          /*/cin>>t;/**/
          f(testcases,0,t){
               //cout << "Case #" <<testcases+1<<": ";
               solve();
          }
 
 
    return 0;
}

Measured memory_bytes: 6828
import java.util.*;
import java.lang.*;
import java.math.*;
import java.io.*;

import static java.lang.Math.*;
import static java.util.Arrays.*;

public class Main{

	Scanner sc;

	static final int INF=1<<28;
	static final double EPS=1e-9;

	void run(){
		sc=new Scanner(System.in);
		for(;;){
			int h=sc.nextInt();
			int w=sc.nextInt();
			sc.nextLine();
			if(w==0&&h==0)
				break;
			String[] map=new String[h];
			for(int i=0; i<h; i++)
				map[i]=sc.nextLine();
			int x=0, y=0;
			boolean[][] visited=new boolean[h][w];
			boolean f=false;
			for(;;){
				if(visited[y][x]){
					f=true;
					break;
				}
				visited[y][x]=true;
				if(map[y].charAt(x)=='.')
					break;
				switch(map[y].charAt(x)){
				case '^':
					y--;
					break;
				case 'v':
					y++;
					break;
				case '<':
					x--;
					break;
				case '>':
					x++;
					break;
				}
			}
			if(f)
				println("LOOP");
			else
				println(x+" "+y);
		}
		sc.close();
	}

	void print(String s){
		System.out.print(s);
	}

	void println(String s){
		System.out.println(s);
	}

	public static void main(String[] args){
		new Main().run();
	}
}

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

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

    int num[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};

    cout << num[k-1] << endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
  int d[20];
  for(int i = 0 ; i< 20 ; i++ ) cin >> d[i];
  sort(d,d+10),sort(d+11,d+20);
  cout << d[7] + d[8] + d[9] << " " <<  d[17] + d[18] + d[19] << endl;
}

Measured memory_bytes: 1180
#include "bits/stdc++.h"
using namespace std;
bool dp[101][8][3];
int main()
{
	string s, t = "keyence";
	cin >> s;
	dp[0][0][0] = true;
	for(int i = 0; i < s.length(); ++i)
	{
		for(int j = 6; j >= 0; --j)
		{
			if(s[i] == t[j])
			{
				dp[i + 1][j + 1][2] |= dp[i][j][2];
				dp[i + 1][j + 1][2] |= dp[i][j][1];
				dp[i + 1][j + 1][0] |= dp[i][j][0];
			}
			dp[i + 1][j][1] |= dp[i][j][0];
			dp[i + 1][j][1] |= dp[i][j][1];
		}
		dp[i + 1][7][0] |= dp[i][7][0];
	}
	printf(dp[s.length()][7][0] || dp[s.length()][7][1] || dp[s.length()][7][2] ? "YES\n" : "NO\n");
}

Measured memory_bytes: 256
#include <stdio.h>
int main(void) {
  int cd, cash, fif=0, one=0;
  while(scanf("%d%d",&cd,&cash),cd+cash) {
    cash -= cd;
    one = cash / 1000;
    cash %= 1000;
    fif = cash / 500;
    cash %= 500;
    printf("%d %d %d\n",cash/100,fif,one);
  }
  return(0);
}

Measured memory_bytes: 600
#include<iostream>
#define mod 1000000007
using namespace std;

int prim[]={2,   3,   5,   7,  11,  13,  17,  19,  23,  29,  31,  37,  41,
  43,  47,  53,  59,  61,  67,  71,  73,  79,  83,  89,  97, 101,

 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167,
 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239,

 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313,
 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397,

 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467,
 479, 487, 491, 499, 503, 509, 521, 523, 541, 547, 557, 563, 569,

 571, 577, 587, 593, 599, 601, 607, 613, 617, 619, 631, 641, 643,
 647, 653, 659, 661, 673, 677, 683, 691, 701, 709, 719, 727, 733,

 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811, 821, 823,
 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887, 907, 911,

 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997,1001};

int cnt[1000];

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

    for(int i=2;i<=n;i++)
    {
        for(int j=0;prim[j]<=i;j++)
        {
            int num=i;
            while(num%prim[j]==0)
            {
                num=num/prim[j];
                cnt[j]++;
            }
        }
    }
    long long ans=1;
    for(int j=0;prim[j]<=n;j++)
    {
        ans=ans*(cnt[j]+1);
        ans%=mod;
    }
    cout<<ans;
    return 0;
}


Measured memory_bytes: 256
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

def main():
    n, m, k = map(int, input().split())

    u = UnionFind(n)

    ans = [0 for i in range(n)]

    for i in range(m):
        a, b = map(int, input().split())
        a -= 1
        b -= 1
        u.union(a, b)
        ans[a] -= 1
        ans[b] -= 1

    for i in range(k):
        c, d = map(int, input().split())
        c -= 1
        d -= 1
        if u.same(c, d):
            ans[c] -= 1
            ans[d] -= 1

    for i in range(n):
        x = u.find(i)
        c = u.parents[x]
        ans[i] -= c + 1

    print(" ".join(map(str, ans)))

main()

Measured memory_bytes: 18040
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
const int MAX = 1400;
int main() {
	char a[4];
	for (int i = 0; i < 4; i++) {
		scanf("%c", &a[i]);
	}
	if ((a[0] == a[1] && a[1] == a[2]) || (a[1] == a[2] && a[2] == a[3])) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
n = int(input())
a = list(map(int, input().split()))

b = True
c = 0
while b:
    for i in range(n):
        if a[i] % 2 != 0:
            b = False
            break
        else:
            a[i] /= 2
    if b:
        c += 1

print(c)

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

const ll mod = 1000000007;

int main() {
    char c;
    cin >> c;
    int a = c - 'a';
    if(a < 0){
        cout << 'A' << endl;
    } else {
        cout << 'a' << endl;
    }
    return 0;
}


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

using namespace std;
typedef long long ll;

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

  int a, b, c;
  cin >> a >> b >> c;

  if (c >= a && c <= b) cout << "Yes" << "\n";
  else cout << "No" << "\n";
}


Measured memory_bytes: 3560
n,m = map(int,input().split())
a_b = [list(map(int,input().split())) for _ in range(m)]
a_b = sorted(a_b,key=lambda x:x[0])

s = set()
for i in range(m):
    if a_b[i][0] == 1:
        s.add(a_b[i][1])
for i in range(m):
    if a_b[i][0] in s:
        if a_b[i][1] == n:
            print('POSSIBLE')
            exit()
print('IMPOSSIBLE')


Measured memory_bytes: 50216
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <math.h>
using namespace std;

int main() {
    vector<int> v(3);
    int k;
    cin >> v[0] >> v[1] >> v[2];
    cin >> k;
    sort(v.begin(),v.end());
    cout << v[2]*pow(2,k) + v[0] + v[1] << endl;
    return 0;
}


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

int main(void)
{
    int n,i,j;

    scanf("%d",&n);

    int t[n+1],x[n+1],y[n+1],dt,dx,dy,d;

    t[0]=x[0]=y[0]=0;
    for(i=1;i<=n;i++){
        scanf("%d%d%d",&t[i],&x[i],&y[i]);
        dt=t[i]-t[i-1];
        dx=abs(x[i]-x[i-1]);
        dy=abs(y[i]-y[i-1]);
        d=dt-dx-dy;
        if(d<0||d%2){
            printf("No");
            return 0;
        }
    }
    printf("Yes");

    return 0;
}


Measured memory_bytes: 1280