akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#include<iostream>
#include<cstdio>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
using namespace std;
#define rep(i,x) for(ll i = 0; i < (ll)(x); i++)
#define rrep(i,x) for(ll i = (ll)(x)-1;0 <= i; i--)
#define reps(i,x) for(ll i = 1; i < (ll)(x)+1; i++)
#define rreps(i,x) for(ll i = (ll)(x); 1 <= i; i--)
#define debug(x) cerr << #x << ": " << (x) << "\n";
#define all(x) (x).begin(), (x).end()
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll,ll> Pll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<vector<vector<ll>>> vvvl;
const ll INF = numeric_limits<ll>::max()/4;
const int n_max = 1e5+10;

int main(){
    string s;cin >> s;
    ll n = s.size();
    string t(n, 'x');
    cout << t << endl;
}

Measured memory_bytes: 256
import std.algorithm;
import std.stdio;

long solve (long a, long b, long c, long k)
{
	k &= 1;
	if (k & 1)
	{
		swap (a, b);
	}
	return a - b;
}

void main ()
{
	long a, b, c, k;
	while (readf (" %s %s %s %s", &a, &b, &c, &k) > 0)
	{
		writeln (solve (a, b, c, k));
	}
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#pragma comment(linker, "/STACK:1024000000,1024000000")
#define mem(a,b) memset((a),(b),sizeof(a))
#define MP make_pair
#define pb push_back
#define fi first
#define se second
#define sz(x) (int)x.size()
#define all(x) x.begin(),x.end()
#define _GLIBCXX_PERMIT_BACKWARD_HASH
#include <ext/hash_map>
using namespace __gnu_cxx;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> PII;
typedef pair<ll,ll> PLL;
typedef vector<int> VI;
typedef vector<ll> VL;
struct str_hash{size_t operator()(const string& str)const{return __stl_hash_string(str.c_str());}};
const int INF=0x3f3f3f3f;
const ll LLINF=0x3f3f3f3f3f3f3f3f;
const double PI=acos(-1.0);
const double eps=1e-4;
const int MAX=1e5+10;
const ll mod=1e9+7;
/***************************************  head  **********************************************/
int main()
{
	int n,i,a[333],ans;
	while(~scanf("%d",&n))
	{
		ans=0;
		for(i=0;i<n;i++) scanf("%d",&a[i]);
		while(1)
		{
			for(i=0;i<n;i++)
			{
				if(a[i]%2==0) a[i]/=2;
				else goto end;
			}
			ans++;
		}
		end:;
		printf("%d\n",ans);
	}
	return 0;
}

Measured memory_bytes: 256
n = int(input())
h_list = list(map(int, input().split()))
for i in range(n - 2, -1, -1):
    if h_list[i] > h_list[i + 1]:
        h_list[i] -= 1
    if h_list[i] > h_list[i + 1]:
        print('No')
        break
else:
    print('Yes')

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

#define int long long
#define pb push_back
#define ff first
#define ss second

const int mod=(int)(1e9+7);
int32_t main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    
    int t=1;
    //cin>>t;
    
    while(t--)
    {
        int n;
        cin>>n;
        
        if(n==1)
        {
            cout<<0;
            return 0;
        }
        int ans1=1;
        int ans2=1;
        int ans3=1;
 
        for(int i=0;i<n;i++)
        {
            ans1=(ans1*10LL)%mod;
        }
        for(int i=0;i<n;i++)
        {
            ans2=(ans2*9LL)%mod;
        }
        for(int i=0;i<n;i++)
        {
            ans3=(ans3*8LL)%mod;
        }
        //cout<<ans1<<" "<<ans2<<" "<<ans3<<" ";
        int ans=(ans1-2*ans2+ans3);    
        cout<<(ans%mod+mod)%mod<<"\n";
    }
}

Measured memory_bytes: 3632
n=int(input())
x=[int(x) for x  in input().split()]
d={}

for i in x:
  if i not in d:
    d[i]=1
  else:
    d[i]+=1
for i in range(1,n+1):
    if i in d:
        print(d[i])
    else:
        print(0)

Measured memory_bytes: 33584
S = input()
odd = set(["R","U","D"])
even = set(["L","U","D"])
ok = True
for s in S[::2]:
    if s not in odd:
        ok = False
if len(S) > 1:
    for s in S[1::2]:
        if s not in even:
            ok = False
print("Yes" if ok else "No")


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < n; ++i)
using ll = long long;
const ll MOD = 1000000007;//998244353;
int main() {
   ios::sync_with_stdio(false);
   cin.tie(0);
   vector<ll> v, w;
   v.push_back(0);
   w.push_back(0);
   ll n, m, k; cin >> n >> m >> k;
   rep(i,n){
      int a; cin >> a;
      v.push_back(-a);
   }
   rep (i,n)
      v[i+1] += v[i];
   rep(i,m){
      int b; cin >> b;
      w.push_back(-b);
   }
   rep (i,m)
      w[i+1] += w[i];
   reverse(w.begin(), w.end());
   ll ans = 0;
   rep(i,n+1){
      if (-v[i] > k)break;
      ans = max(ans, i+m-ll(lower_bound(w.begin(), w.end(), -(k+v[i]))-w.begin()));
   }
   cout << ans << endl;
}

Measured memory_bytes: 7948
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <deque>
#include <queue>
#include <stack>
#include <cstdio>
#include <string>
#include <vector>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <utility>
#include <iostream>
#include <algorithm>
#include <functional>
#include <unordered_map>
#include <unordered_set>

using namespace std;

#define ll long long
#define ull unsigned long long
#define INF (1 << 29)
#define LLINF (1LL << 61)
#define MOD7 1000000007
#define MOD9 1000000009
#define EPS 1e-10
#define P pair<int, int>
#define pii pair<int, int>
#define pll pair<ll, ll>
#define pul pair<ull, ull>
#define all(a) (a).begin(), (a).end()
#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);--i)
#define REP(i,n) for (int i=0;i<(n);++i)
#define RREP(i,n) for (int i=(n)-1;i>=0;--i)
#define TO_STRING(VariableName) # VariableName

void YES() { cout << "YES" << endl; }
void NO() { cout << "NO" << endl; }
void Yes() { cout << "Yes" << endl; }
void No() { cout << "No" << endl; }
void yes() { cout << "yes" << endl; }
void no() { cout << "no" << endl; }

map<ll, int> mp;

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

	ll m1 = 0, m2 = 0;
	for (auto x : mp) {
		if (x.second > 1) {
			m1 = max(m1, x.first);
		}
	}
	for (auto x : mp) {
		if (x.second > 3) {
			m2 = max(m2, x.first);
		}
		else if (x.second > 1 && m1 != x.first) {
			m2 = max(m2, x.first);
		}
	}

	cout << m1 * m2 << endl;

	return 0;
}

Measured memory_bytes: 6528
#include <cmath>
#include <chrono>
#include <random>
#include <ctime>
#include <algorithm>
#include <iosfwd>
#include <iostream>
#include <list>
#include <ostream>
#include <streambuf>
#include <string>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>

using namespace std;

typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;
#define fori(i, n) for(ll i = 0; i < (n); ++i)
#define forI(i, n) for(ll i = 1; i <= (n); ++i)
#define pll pair<ll, ll>
#define ff first
#define ss second

//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("fast-math")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")

#define pt pair<ll, ll>
#define x first
#define y second

pll operator+(pll a, pll b) { return {a.x + b.x, a.y + b.y}; }

ll rand0m() {
    return (ull(rand()) << 15ull | ull(rand()));
}                   //[0 ... n)
ll rand0m(ll x) {
    return rand0m() % x;
}               //[0 ... n)
ll rand0m(ll minn, ll maxx) {
    return rand0m(maxx - minn + 1) + minn;
}   //[minn ... maxx]

const ll MAXN = 1e5 + 1;
const ll mod = 1e9 + 7;
const ll INF = 1e18;

ll n, m;

ll d[401][401];
ll s[401][401];
ll a[401];

void solve() {
    cin >> n;
    fori(i, n) cin >> a[i];
    fori(i, n){
        s[i][i] = 0;
        for(ll j = i + 1; j <= n; ++j) s[i][j] = s[i][j - 1] + a[j - 1];
    }
    for(ll len = 2; len <= n; ++len){
        fori(l, n){
            ll r = l + len;
            if(r > n) continue;
            d[l][r] = INF;
            for(ll k = l + 1; k < r; ++k){
                d[l][r] = min(d[l][r], d[l][k] + d[k][r] + s[l][r]);
            }
        }
    }
    cout << d[0][n];
}

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

    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    //stress();
    solve();
}

Measured memory_bytes: 2816
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
using namespace std;

#ifdef LOCAL
	#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
	#define eprintf(...) 42
#endif

typedef long long ll;
typedef pair<int, int> pii;
#define mp make_pair

int cnt[20];
int a[30];
int ANS = 0;

int solve(int mask) {
	int n = 0;
	if (cnt[0] > 0) a[n++] = 0;
	for (int i = 0; i < 12; i++) {
		if (cnt[i + 1] == 0) continue;
		if (cnt[i + 1] == 2) {
			a[n++] = i + 1;
			a[n++] = -(i + 1);
			continue;
		}
		if ((mask >> i) & 1)
			a[n++] = i + 1;
		else
			a[n++] = -(i + 1);
	}
	sort(a, a + n);
	a[n++] = a[0] + 24;
	int res = 24;
	for (int i = 0; i < n - 1; i++)
		res = min(res, a[i + 1] - a[i]);
	return res;
}

int main()
{
//	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);

	int n;
	scanf("%d", &n);
	while(n--) {
		int x;
		scanf("%d", &x);
		cnt[x]++;
	}
	cnt[0]++;
	if (cnt[0] > 1) {
		printf("0\n");
		return 0;
	}
	for (int i = 1; i <= 12; i++) {
		if (cnt[i] > 2) {
			printf("0\n");
			return 0;
		}
	}
	for (int mask = 0; mask < (1 << 12); mask++)
		ANS = max(ANS, solve(mask));
	printf("%d\n", ANS);

	return 0;
}


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

using namespace std;

int minCost(vector<int>& heights){
	int n = heights.size();
    vector<int> dp(n, 1e9 + 5);
    dp[0] = 0;

    for(int i = 0; i < n; i++){
      for(int j : {i + 1, i + 2}){
        if(j < n){
          dp[j] = min(dp[j], abs(heights[i] - heights[j]) + dp[i]);
        }
      }
    }

  return dp[n - 1];
}

int main(){

  int n;
  cin >> n;
  vector<int> heights(n);
  for(int i = 0; i < n; i++)cin >> heights[i];

  cout << minCost(heights) << endl;

  return 0;
}


Measured memory_bytes: 1024
program main
implicit none
integer :: n
integer , allocatable :: h(:)
integer :: i, res, z

read(*,*) n
allocate( h(n) )
read(*,*) h


res = 0
z   = 0
do i = 1, n
   if( h(i) .ge. z ) then
      res = res + 1
      z   = h(i)
   end if
end do
write(*,'(i0)') res


end program main


Measured memory_bytes: 768
#include <bits/stdc++.h> 
#define int long long
#define quickie ios_base::sync_with_stdio(false); cin.tie(NULL);
#define rep(i, a, b) for(int i=a; i<b; i++)
#define rep1(i, a, b) for(int i=a; i<=b; i++)
#define repp(i, a, b) for(int i=b-1; i>=a; i--)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
#define db double
#define mi map<int, int>
#define mc map<char, int>
#define ms map<string, int>
#define vi vector<int>
#define qi queue<int>
#define MI(x) power(x, mod-2)
#define test int t; cin >> t;
#define mod 1000000007LL
//#define mod 998244353 
using namespace std;
int power(int x, int y) ;
int gcd(int a, int b) ;

signed main() {
    quickie
    int n ;
    cin >> n ;
    int a[n+1], b[n+1], c[n] ;
    rep1(i, 1, n) cin >> a[i] ;
    rep1(i, 1, n) cin >> b[i] ;
    rep1(i, 1, n-1) cin >> c[i] ;
    int s= 0 ;
    s += b[a[1]] ;
    rep1(i, 2, n) {
        if(a[i] == a[i-1]+1) {
            s += b[a[i]]+c[a[i-1]] ;
        }
        else s += b[a[i]] ;
    }
    cout << s << endl ;
}
 
int power(int x, int y) {
    int res = 1; x %= mod;
    while (y > 0) {
        if (y & 1)
            res = (res*x) % mod;
        y = y>>1;
        x = (x*x) % mod;
    }
    return res%mod;
}
 
int gcd(int a,int b){
    if(a==0) return b;
    return gcd(b%a,a);
}

Measured memory_bytes: 256
s = gets.chomp.chars
t = gets.chomp.chars
n = s.size
m = t.size

dp = Array.new(n+1){Array.new(m+1, 0)}
n.times do |i|
  dp_cur = dp[i]
  dp_next = dp[i+1]
  m.times do |j|
    if s[i] == t[j]
      dp_next[j+1] = dp_cur[j] + 1
    else
      a = dp_cur[j+1]
      b = dp_next[j]
      dp_next[j+1] = a > b ? a : b
    end
  end
end

i, j = n, m
ans = ''
while i > 0 && j > 0 do
  if dp[i][j] == dp[i-1][j]
    i -= 1
  elsif dp[i][j] == dp[i][j-1]
    j -= 1
  else
    ans << s[i-1]
    i -= 1
    j -= 1
  end
end

puts ans.reverse


Measured memory_bytes: 74524
#include <iostream>
#include <vector>
#include <cmath>
#include <string>
#include <algorithm>
#include <numeric>
#include <climits>
#define ll long long
#define LIM 100000
using namespace std;
ll v[LIM];
int main() {
  ll a, b, c;
  cin >> a >> b >> c;
  if (a + b == c || a == b + c || a + c == b) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#define MAXANS		2147483647
#define MIN(x,y)	((x)<(y)?(x):(y))

int main(){
	int		n,k;
	long long ans;
	scanf("%d%d",&n,&k);
	ans = k;
	for(int i=0; i<n-1; i++){ ans *= (k-1); }
	printf("%lld\n", MIN( MAXANS, ans));
	return 0;
}

Measured memory_bytes: 1700
N, M = map(int, input().split())
Hi = list(map(int, input().split()))
is_judge_list = [1 for i in range(N)]

for j in range(M):
    A, B = map(int, input().split())
    if Hi[A-1] > Hi[B-1]:
       is_judge_list[B-1] = 0 
    elif Hi[B-1] > Hi[A-1]:
        is_judge_list[A-1] = 0
    else:
        is_judge_list[A-1] = 0
        is_judge_list[B-1] = 0
print(is_judge_list.count(1))

Measured memory_bytes: 85076
/*
LANG:C++
PROB:

*/
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <functional>
#include <iostream>
// #define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)


using namespace __gnu_pbds;
using namespace std;


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

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef long long i64;
typedef vector<i64> vi64;
typedef vector<vi64> vvi64;
typedef pair<i64, i64> pi64;
typedef double ld;
typedef unsigned long long ui64;

template<class T> bool uin(T &a, T b) { return a > b ? (a = b, true) : false; }
template<class T> bool uax(T &a, T b) { return a < b ? (a = b, true) : false; }
const int mod=1000000007;
  i64 poww(i64 a, i64 b)
  {
    a%=mod;
    i64 res=1;
    while(b)
      {
if(b&1)res=res*a%mod;

      a=a*a%mod;
      b/=2;

      }
      return res;
  }
  i64 inv(i64 a)
  {
    return poww(a,mod-2);
  }
  void solve()
  {

string s;
cin>>s;
s+="%";
int mx=0,cur=0;
for(int i=0;i<4;i++)
{
  if(s[i]=='R')cur++;
  else mx=max(mx,cur),cur=0;


}

cout<<mx;
  }
  
  int main()
  {
ios::sync_with_stdio(false);
    cin.tie(nullptr);
    #ifndef ONLINE_JUDGE
freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);
    #endif
int t=1;
while(t--)
{
  solve();
}

    return 0;
  }


Measured memory_bytes: 3648
import java.util.*;
class Main{
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		int m=sc.nextInt();
		int[] a=new int[n];
		int[][] bc=new int[m][2];
		long sum=0L;
		for(int i=0;i<n;i++){
			a[i]=sc.nextInt();
		}
		for(int i=0;i<m;i++){
			bc[i][0]=sc.nextInt();
			bc[i][1]=sc.nextInt();
		} 
		Arrays.sort(bc,Comparator.comparingInt(o->o[1]));
	/*	LinkedList<Integer> D=new LinkedList<Integer>();
		outside:
		for(int i=m-1;i>=0;i--){
			for(int j=0;j<bc[i][0];j++){
				D.add(bc[i][1]);
				if(D.size()>n)
					break outside;
			}
		}	
		Arrays.sort(a);
		for(int i=0;i<D.size()&&i<n;i++){
			if(a[i]<D.get(i))
			a[i]=D.get(i);
		}
		for(int i=0;i<n;i++){			
			sum+=a[i];
		}	*/
		Arrays.sort(a);
		int x=0;
		int y=0;
		int max=0;
		for(int i=0;i<n;i++){
			if(x!=m)
				if(a[i]<bc[m-1-x][1]&&y==0){
					y=bc[m-1-x][0];
					x++;
				}
			if(x==0)
				max=1;
			if(a[i]>=bc[m-max-x][1]||y==0)
				sum+=a[i];
			else{
				sum+=bc[m-max-x][1];
				y--;
			}
			max=0;
		}
		System.out.println(sum);	
	}
}

Measured memory_bytes: 98904
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <numeric>

#define REP(i, a, b) for (int i = int(a); i < int(b); i++)
using namespace std;
typedef long long int ll;

// clang-format off
#ifdef _DEBUG_
#define dump(...) do{ cerr << __LINE__ << ":\t" << #__VA_ARGS__ << " = "; PPPPP(__VA_ARGS__); cerr << endl; } while(false)
template<typename T> void PPPPP(T t) { cerr << t; }
template<typename T, typename... S> void PPPPP(T t, S... s) { cerr << t << ", "; PPPPP(s...); }
#else
#define dump(...)
#endif
template<typename T> vector<T> make_v(size_t a, T b) { return vector<T>(a, b); }
template<typename... Ts> auto make_v(size_t a, Ts... ts) { return vector<decltype(make_v(ts...))>(a, make_v(ts...)); }
template<typename T>
bool chmin(T &a, T b) { if (a > b) {a = b; return true; } return false;}
template<typename T>
bool chmax(T &a, T b) { if (a < b) {a = b; return true; } return false;}
// clang-format on

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    ll sum = 0;
    const ll inf = 1LL << 60;
    ll m = inf;
    REP(i, 0, n) {
        ll a, b;
        cin >> a >> b;
        if (a > b) {
            chmin(m, b);
        }
        sum += a;
    }
    if (m == inf) {
        cout << 0 << endl;
    } else {
        cout << sum - m << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
using namespace std;
int main() {
	int x, r, d;
	cin >> r >> d >> x;
	for (int i = 0; i < 10; i++) {
		x = r * x - d;
		cout << x << endl;
	}
}

Measured memory_bytes: 256
////////////////////////
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
namespace my {
char itoc(int i) { return i + '0'; }
int ctoi(char c) { return c - '0'; }
ll gcd(ll a, ll b) {  // O( log(a) )
  a = abs(a);
  b = abs(b);
  if (a < b) swap(a, b);
  while (b != 0) {
    a %= b;
    swap(a, b);
  }
  return a;
}
ll lcm(ll a, ll b) { return a * b / my::gcd(a, b); }  // O( log(a) )
bool isPrime(ll n) {                                  // O( sqrt(n) )
  bool flag = true;
  for (ll i = 2; i * i <= n; i++) {
    if (n % i == 0) flag = false;
  }
  return flag;
}
vector<pair<ll, ll>> primeFac(ll n) {  // O( sqrt(n) )
  vector<pair<ll, ll>> ret;
  for (ll i = 2; i * i <= n; i++) {
    if (n % i != 0) continue;
    ll exp = 0;
    while (n % i == 0) {
      n /= i;
      exp++;
    }
    ret.push_back(make_pair(i, exp));
  }
  if (n != 1) ret.push_back(make_pair(n, 1));
  return ret;
}
}  // namespace my
////////////////////////

int main() {
  int n;
  cin >> n;
  // set<int> l_;
  vector<int> l;
  for (int i = 0; i < n; i++) {
    int tmp;
    cin >> tmp;
    // l_.insert(tmp);
    l.push_back(tmp);
  }

  // vector<int> l;
  // for (auto li_ : l_) {
  //   l.push_back(li_);
  // }

  ll ans = 0;
  for (int i = 0; i < l.size(); i++) {
    for (int j = i + 1; j < l.size(); j++) {
      for (int k = j + 1; k < l.size(); k++) {
        int a = l.at(i);
        int b = l.at(j);
        int c = l.at(k);
        if (a == b || b == c || c == a) continue;
        if (a + b > c && b + c > a && c + a > b) ans++;
      }
    }
  }

  cout << ans << endl;
}

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

int main(){
  string s;
  std::cin >> s;
  int v=700;
  for (int i = 0; i < s.size(); i++) {
    /* code */
    if(s.at(i)=='o')v+=100;
    
  }
  std::cout << v << std::endl;
}

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

#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
using namespace std;
using ll = long long;

#define N 3005
int dp[N][N];

string lcs(string s, string t) {
    int n = s.size(), m = t.size(), i, j, len;

    for (i = 1; i <= n; ++i) {
        for (j = 1; j <= m; ++j) {
            if (s[i-1] == t[j-1]) dp[i][j] = 1 + dp[i-1][j-1];
                else dp[i][j] = max(dp[i-1][j], dp[i][j-1]);
        }
    }

    string r = "";
    len = dp[n][m];
    i = n;
    j = m;

    while (len) {
        if (dp[i][j] == dp[i-1][j]) {
            --i;
        } else if (dp[i][j] == dp[i][j-1]) {
            --j;
        } else {
            --i; --j; --len;
            r += s[i];
        }
    }
    reverse(r.begin(), r.end());

    return r;
}

int main() {
    FAST;

    string s, t;
    cin >> s >> t;
    cout << lcs(s, t);

    return 0;
}


Measured memory_bytes: 35456
import java.util.*;
public class Main {
  public static void main(String[] args){

    Scanner sc = new Scanner(System.in);
    int r = sc.nextInt();
    int b = sc.nextInt();
    int g = sc.nextInt();
    int rbg = (r * 100) + (b * 10) + g;

    if ((rbg % 4) == 0) {
      System.out.println("YES");
    } else {
      System.out.println("NO");
    }

  }
}

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

int main(void){
    vector<string> S(110),ans(110);
    vector<int> m(110);
    vector<int> shift(110);
    int num;
    
    for(int i=0;i<110;i++){
        cin>>S.at(i);
        if(S.at(i)=="-")break;
        cin>>m.at(i);
        for(int j=0;j<m.at(i);j++){
            cin>>num;
            shift.at(i)+=num;
        }
        shift.at(i)=shift.at(i)%S.at(i).size();
    }
    for(int i=0;i<110;i++){
        if(S.at(i)=="-")break;
        ans.at(i)= S.at(i).substr(shift.at(i),S.at(i).size()) + S.at(i).substr(0,shift.at(i));
        cout<<ans.at(i)<<endl;
    }
    
}



Measured memory_bytes: 3156
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
using namespace std;
int n,m,i,j,k,x;
char s[505][505],w1[505][505],w2[505][505];
int main()
{
	scanf("%d%d",&n,&m);
	for(i=1;i<=n;++i)
	{
		scanf("%s",s[i]+1);
		for(j=1;j<=m;++j)
			w1[i][j]=w2[i][j]=s[i][j];
	}
	for(i=1;i<=n;i+=2)
		for(j=2;j<m;++j)
			w1[i][j]='#';
	for(i=1;i<=n;++i)
		w1[i][1]='#';
	for(i=2;i<=n;i+=2)
		for(j=2;j<m;++j)
			w2[i][j]='#';
	for(i=1;i<=n;++i)
		w2[i][m]='#';
	for(i=1;i<=n;++i)
		puts(w1[i]+1);
	puts("");
	for(i=1;i<=n;++i)
		puts(w2[i]+1);
	return 0;
}


Measured memory_bytes: 1408
/*+lmake
 * STD = c++14
 * DEFINE += WAAUTOMATON
 */
#include <bits/stdc++.h>
using namespace std;
using LL=long long;
using ULL=unsigned long long;
#ifdef WAAUTOMATON
#define debug(args...)                                                                             \
    {                                                                                              \
        dbg, args;                                                                                 \
        cerr << endl;                                                                              \
    }
#define massert(x) assert(x)
#else
#define debug(args...) // Just strip off all debug tokens
#define massert(x)
#endif
struct debugger
{
    template<typename T> debugger& operator , (const T& v)
    {    
        cerr<<v<<" ";    
        return *this;    
    }
} dbg;

#define MAXN 100000
struct Edge
{
	int to,next;
}e[4*MAXN+10];
int head[MAXN+10];
int col[MAXN+10];
void addEdge(int a,int b)
{
	static int c=0;
	e[++c]=(Edge){b,head[a]};
	head[a]=c;
	e[++c]=(Edge){a,head[b]};
	head[b]=c;
}
struct Data
{
	int c,t;
}x[MAXN+10][11];
int main(){	
#ifdef WAAUTOMATON
	freopen("in.txt","r",stdin);
#endif
	int n,m,q;
	cin>>n>>m;
	for(int i=1; i<=n; ++i)
		addEdge(i,i);
	for(int i=1; i<=m; ++i) {
		int a,b;
		cin>>a>>b;
		addEdge(a,b);
	}
	cin>>q;
	for(int i=1; i<=q; ++i) {
		int v,c,d;
		cin>>v>>d>>c;
		x[v][d].c=c;
		x[v][d].t=i;
	}
	for(int j=10; j>=1; --j) {
		for(int i=1; i<=n; ++i) {
			if (x[i][j].t==0) continue;
			for(int k=head[i]; k!=0; k=e[k].next) {
				int v=e[k].to;
				if (x[v][j-1].t==0 || x[v][j-1].t<x[i][j].t) {
					x[v][j-1]={x[i][j].c,x[i][j].t};
				}
			}
		}
	}
	for(int i=1; i<=n; ++i) {
		cout<<x[i][0].c<<endl;
	}
	return 0;
}


Measured memory_bytes: 13184
#include <stdio.h>
#include <stdlib.h>

int main()
{
    int N, K;
    scanf("%d%d", &N, &K);
    char *S = malloc(sizeof(char) * (N+1));
    scanf("%s", S);

    int ch = 0, res = 0;
    char Sp = S[0];
    for(int ni=1; ni<N; ni++){
        char Si = S[ni];
        if(Sp != Si){
            ch++;
        } else {
            res++;
        }
        Sp = Si;
    }

    if(ch%2 == 0){
        if(K > ch/2){
            res += ch;
        } else {
            res += 2 * K;
        }
    } else {
        if(K > ch/2){
            res += ch;
        } else {
            res += 2 * K;
        }
    }

    printf("%d\n", res);

    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <iostream>

using namespace std;

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

        for(int i = 1; i <= n; i++){
                if((i % 3) == 0 || (i % 10) == 3) cout << " " << i;
                else{
                        for(x = i; x > 0; x /= 10){
                                if((x % 10) == 3){ 
                                        cout << " " << i;
                                        break;
                                }
                        }
                }
        }
        cout << "\n";

        return 0;
}

Measured memory_bytes: 1164
import java.util.*;

public class Main {

	public static void main (String[] args)  {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
		Store[] arr = new Store[n];
		for (int i = 0; i < n; i++) {
			arr[i] = new Store(sc.nextInt(), sc.nextInt());
		}
		Arrays.sort(arr, new Comparator<Store>() {
		public int compare(Store s1, Store s2) {
			return s1.a - s2.a;
		}
		});
		long total = 0;
		for (int i = 0; i < n && m > 0; i++) {
			int amount = Math.min(arr[i].b, m);
			total += (long)amount * arr[i].a;
			m -= amount;
		}
		System.out.println(total);
	}
	
	static class Store {
		int a;
		int b;
		public Store(int a, int b) {
			this.a = a;
			this.b = b;
		}
	}
}


Measured memory_bytes: 90192
S = [int(i) for i in input()]

N = len(S)
ans = 0
for i in range(N):
    left = i
    right = N - i - 1
    score = 1
    for k in range(0, right + 1):
        if right - k > 0:
            ans += S[i] * score * (1 << left) * (1 << (right - k - 1))
        else:
            ans += S[i] * score * (1 << left)
        score *= 10

print(ans)

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

//ll a[10000000];

map<ll, ll> b;

int main() {

	ll i, j, k, l, test, n;
	cin >> n;
	bool flag = 1;
	for (i = 0; i < n; i++) {
		cin >> l;

		if (b.count(l) && flag==1) {
			cout << "NO";
			flag = 0;
		}
		b[l] = l;
	}
	if (flag == 1) cout << "YES";
}

Measured memory_bytes: 12800
#include<bits/stdc++.h>
#define lln long long int
#define llu unsigned lln
#define sc(n) scanf("%d",&n);
#define scl(n) scanf("%lld",&n);
#define scd(n) scanf("%lf",&n);
#define pf(res) printf("%d\n",res);
#define pfl(res) printf("%lld\n",res);
#define pfd(res) printf("%lf\n",res);
#define maxii 100005
using namespace std;
typedef pair<int,int> pii;
typedef pair<lln,lln> pll;
typedef vector<int> vi;
typedef vector<lln> vl;
typedef vector<pii> vii;
typedef vector<pll> vll;


int arr[maxii];
int arr2[maxii];
int gcd(int a,int b)
{
    if(b==0){
      return a;
     }
    return gcd(b,a%b);
}
int lcm(int a,int b)
{
    int res=(a*b)/gcd(a,b);
    return res;
}
int po(int a,int b)
{
    int res=1;
    while(b)
    {
        if(b%2!=0)
        {
            res*=a;
            b--;
        }
        else
        {
            a*=a;
            b/=2;
        }
    }
    return res;
}

lln modMul(lln  a, lln b,lln mod){
    lln ans = 0;
    a = a % mod;
    while (b > 0){
        if ( b % 2 )ans = (ans%mod+ a%mod) % mod;
        a = (a%mod * 2%mod) % mod;
        b /= 2;
    }
    return ans % mod;
}
lln powerMod(lln a,lln b,lln mod){
	if(b==0)return 1LL%mod;
	lln x=powerMod( a,b/2,mod );
	x = ( x%mod * x%mod ) % mod;
	if( b%2==1 )x = ( x%mod * a%mod ) % mod;
	return x%mod;
}

int main()
{
   char a,b;
   cin>>a>>b;
   if(a=='H' && b=='H' || a=='D' && b=='D')cout<<"H";
   else cout<<"D";
}






Measured memory_bytes: 3636
#include <stdio.h>
#include <string.h>
int main(){
  char O[51];
  char E[51];

  scanf("%s%s",O,E);
  for(int i=0;i<strlen(O);i++){
    printf("%c",O[i]);
    if(E[i]!='\0')printf("%c",E[i]);
  }
  return 0;
}

Measured memory_bytes: 128
#include <stdio.h>

void core() {
	int N;
	scanf("%d", &N);
	int c = 0, t;
	for (int i = 0; i < N; i++) {
		scanf("%d", &t);
		c += t & 1;
	}
	printf("%s\n", c & 1 ? "NO" : "YES");
}

int main() {
	core();
	return 0;
}



Measured memory_bytes: 256
from collections import deque
n,m = map(int, input().split())
g = [[] for _ in range(n)]

for _ in range(m):
  a,b = map(int, input().split())
  a,b = a-1, b-1
  g[a].append(b)
  g[b].append(a)
stack = deque([0])
dist = [-1]*n
dist[0] = 0

while stack:
  v = stack.popleft()
  for nv in g[v]:
    if dist[nv] == -1:
      dist[nv] = v+1
      stack.append(nv)

print("Yes")
print(*dist[1:], sep= "\n")

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

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

    int r;
    cin >> r;

    int result;

    result = r * r;

    cout << result << endl;
}

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

using namespace std;

#define ALL(x) (x).begin(), (x).end()
#define AND(x,y,z) set_intersection((x).begin(),(x).end(),(y).begin(),(y).end(),inserter((z),(z).end()))
#define CONCAT(x,y) (x).insert((x).end(),(y).begin(),(y).end())
#define DUMP(xs) for (auto x:xs) cout<<x<<' ';cout<<endl
#define FOR(i,a,b) for (int i=(int)(a);i<(int)(b);++i)
#define OR(x,y,z) set_union((x).begin(),(x).end(),(y).begin(),(y).end(),inserter((z),(z).end()))
#define OUT(x) cout<<x<<endl
#define REP(i,n) FOR(i,0,n)

typedef long long ll;
typedef pair<ll, ll> P;
typedef vector<int> VEC;

int main() {
  int N;cin>>N;
  int tmp = 0;
  while (N-tmp*7>=0) {
    if ((N-tmp*7)%4==0) {
      OUT("Yes");
      return 0;
    }
    tmp++;
  }
  OUT("No");

  return 0;
}

Measured memory_bytes: 256
N = int(input())
A = list(map(int, input().split()))

A.sort()
ans = 0
tmp = 0
for i in range(N):
    if i == 0:
        continue
    elif i == 1:
        ans += A.pop()
    elif i % 2 == 0:
        tmp = A.pop()
        ans += tmp
    else:
        ans += tmp
print(ans)

Measured memory_bytes: 94276
#include<bits/stdc++.h>
#define int long long
using namespace std;
const int maxn = 1e5 + 5;
int n;
vector<int> X[maxn], Y[maxn];
struct dots{
	int x, y;
};
dots dot[maxn];
bool mark[maxn];
vector<pair<int, int>> cnt;
set<int> xx, yy;

void dfs(int v) {
	int x = dot[v].x;
	int y = dot[v].y;
//	cout << "{" << x << " ," << y << "} , ";
	mark[v] = 1;
	xx.insert(x);
	yy.insert(y);
	for(int i : X[x]) {
		if(!mark[i]) {
			dfs(i);
		}
	}
	for(int i : Y[y])
		if(!mark[i])
			dfs(i);
}

int32_t main() {
	cin >> n;
	for(int i = 0; i < n; i++) {
		int x, y;
		cin >> x >> y;
		x--, y--;
		dot[i].x = x;
		dot[i].y = y;
		X[x].push_back(i);
		Y[y].push_back(i);
	}
	
	for(int i = 0; i < n; i++) {
		if(!mark[i]) {
			xx.clear();
			yy.clear();
//			cout << dot[i].x << " , " << dot[i].y << " = ";
			dfs(i);
//			cout << endl;
			cnt.push_back({(int)xx.size(), (int)yy.size()});
		}
	}
	int ans = 0;
	for(auto i : cnt) {
//		cout << i.first << " : " << i.second << '\n';
		ans = (ans + i.first * i.second);
	}
	cout << ans - n;
}

Measured memory_bytes: 19072
#include <bits/stdc++.h>
using namespace std;
 
int main() {
 	int W, H, N;
  	cin >> W >> H >> N;
  	int a[N][3];	
  
  	for(int i=0; i < N;i++){
      for(int j=0; j < 3 ;j++){
       cin >> a[i][j];
      }
    }
  
    int x_left = 0, x_right = W, y_down = 0, y_up = H;
  
  	for(int i=0; i < N; i++){
      if(a[i][2] == 1)
        x_left = max(a[i][0], x_left);
      if(a[i][2] == 2)
        x_right = min(a[i][0], x_right);
      if(a[i][2] == 3)
        y_down =   max(a[i][1], y_down);
      if(a[i][2] == 4)
        y_up  =  min(a[i][1], y_up);
    }
	
  	if(x_left >= x_right || y_down >=  y_up)
      cout << 0 << endl;
  		else
          cout << (x_right - x_left)*(y_up - y_down) << endl;
  	


}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define v vector<ll> 
#define vv vector<v>
#define p pair<ll,ll>
#define mid (start+end)/2
#define fi first
#define se second	
int main() {
	int n;
	cin>>n;
	v arr(n+1);
	for (int i=1; i<=n; i++)
		cin>>arr[i];
	int ans=0;
	int counter=0;
	for (int i=2; i<=n; i++)
	{
		if (arr[i]<=arr[i-1])
			counter++;
		else
			counter=0;
		ans=max(ans,counter);
		}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 1024
n,d = map(int,input().split())

xy=[list(map(int,input().split())) for _ in range(n)]

c = 0
for i in range(n) :
    dd = (xy[i][0]**2 + xy[i][1]**2)**0.5
    if dd <= d :
        c += 1

print(c)


Measured memory_bytes: 45820
using System;
using System.Linq;
using System.Collections.Generic;
using System.IO;
using System.Diagnostics;
using System.Text;

public class Program{
    public static void Main(){
        var watch =  new Stopwatch();
        watch.Start();
        bool istest = false;
        var stream = new StreamWriter(Console.OpenStandardOutput()){AutoFlush = false};
        Console.SetOut(stream);
        TextReader reader;
        string filename="";
        if(filename.Length!=0){
            reader = new StreamReader(filename);
        }else{
            reader = Console.In;
        }

        var n = int.Parse(reader.ReadLine());
        var yo = (long)Math.Pow(10, 9)+7;
        //制限がゆるいのでなんとなくでいいや
        //var yoyo = Enumerable.Range(1, n).Aggregate(((double sum, double nex)=>( (sum%yo)*(nex%yo) % yo)));
        long yoyo = 1;
        foreach (var k in Enumerable.Range(1, n))
        {
            yoyo = (yoyo*k)%yo;
        }
        Console.WriteLine(yoyo);
        watch.Stop();
        if(istest){
            Console.WriteLine($"実行時間{watch.ElapsedMilliseconds}ミリ秒");
        }
        Console.Out.Flush();
    }
}

Measured memory_bytes: 13268
#include<cstdio>

using namespace std;

int n,s;
int memo[1024][1000];

int search(int stat,int sum,int dep){
	if(dep==n)	return memo[stat][sum]=(s==sum);
	if(~memo[stat][sum])	return memo[stat][sum];
//	if(sum>s)	return 0;

	int cnt=0;
	for(int i=0;i<10;i++){
		if((stat&(1<<i))==0){
			stat|=1<<i;
			cnt+=search(stat,sum+i*(n-dep),dep+1);
			stat&=~(1<<i);
		}
	}
	return memo[stat][sum]=cnt;
}

int main(){
	for(;~scanf("%d%d",&n,&s);){
		for(int i=0;i<1024;i++)for(int j=0;j<1000;j++)	memo[i][j]=-1;
		if(n>10 || s>=1000){
			puts("0");
			continue;
		}
		printf("%d\n",search(0,0,0));
	}
	return 0;
}

Measured memory_bytes: 4768
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    # divisors.sort()
    return divisors
n=int(input())
ans=[0]*n
count=[0]*n

a=list(map(int,input().split()))
for i in range(n,0,-1):
    if count[i-1]%2!=a[i-1]:
        ans[i-1]=1
        b=make_divisors(i)
        for j in b:
            count[j-1]+=1
print(sum(ans))
kai=[]
for i in range(n):
    if ans[i]==1:
        kai.append(i+1)
print(*kai)

Measured memory_bytes: 71784
#include <algorithm>
#include <iostream> //入出力
#include <stdio.h>
#include <map>
#include <set>
#include <string>
#include <math.h> //算術演算子
#include <vector>
#include <cstdlib>
#include <queue>
#include <stack>
#include <list>
#include <iomanip> //小数点以下を表示させる(setprecision())
//#include <bits/stdc++.h>
using namespace std;
typedef long long ll; //64bit型

#define debug(x) cerr << x << " " \
                      << "(L:" << __LINE__ << ")" << '\n'
#define PRINT(V)                                   \
        {                                          \
                for (int i = 0; i < V.size(); i++) \
                {                                  \
                        cout << V[i] << " ";       \
                }                                  \
                cout << endl;                      \
        }

int gcd(int a, int b)
{
        return b ? gcd(b, a % b) : a;
}


int main()
{
        //input->compute->output//
        string x1,y1,x2;
        cin>>x1>>y1>>x2;

       string m;
       m=x1[0]-'a'+'A';
       m+=y1[0]-'a'+'A';
       m+=x2[0]-'a'+'A';
        
        cout<<m<<endl;


        

        return 0;
}


Measured memory_bytes: 256
// inputに入力データ全体が入る
function Main(input) {
	// 1行目がinput[0], 2行目がinput[1], …に入る
  input = input.split(" ");
  var appleNum = Number(input[0]) - 1;
  var azi = Number(input[1]);
  var result = 0;
  var abs = azi;

  for(var i = 0; i <= appleNum ; i++){
    result = result +  (azi + i);
    if(Math.abs(abs) > Math.abs(azi + i)){
      abs = (azi + i);
    }
  }
  console.log(result - abs);
 }
 //*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
 Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 7372
N, W = map(int, input().split())
WV = [list(map(int, input().split())) for _ in range(N)]
dp = [0]*(1+W)
w,v = WV[0]
dp[w:] = [v]*(W+1-w)
for i in range(1,N):
    w,v = WV[i]
    for j in range(W, w-1, -1):
        tmp = dp[j-w] + v
        dp[j] = max(dp[j], tmp)
print(max(dp))

Measured memory_bytes: 43720
#include <bits/stdc++.h>
#define ll long long
#define PI 3.14159265358979323846
using namespace std;
int main()
{
    double n, rez;
    cin>>n;
    rez=2*n*PI;
    cout<<fixed<<setprecision(5)<<rez;
    return 0;
}


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

int main(int argc, char const *argv[])
{
	int a, b, c;
	std::cin >> a >> b >> c;
	if (a > b)
	{
		std::swap(a, b);
	}
	int count;
	for (int i = a; (a <= i)&&(i <= b); ++i)
	{
		if ((c % i)== 0)
		{
			count++;
		}
	}
	std::cout << count << std::endl;
	return 0;
}


Measured memory_bytes: 3108
N = int(input())
W = list(map(int, input().split()))

W2 = [0]*N
tmp = 0
for i in range(N):
    tmp += W[i]
    W2[i] = tmp

ans = 99
tmp = 0
for i in range(N):
    tmp = W2[N-1]-2*W2[i]
    if tmp >= 0:
        ans = min(ans, tmp)
    else:
        ans = min(ans, 2*W2[i]-W2[N-1])

print(ans)

Measured memory_bytes: 38256
#include "bits/stdc++.h"
// Begin Header {{{
#define all(x)          (x).begin(), (x).end()
#define rep(i, s, n)    for (i64 i = (s), i##_limit = (n); i < i##_limit; ++i)
#define repr(i, s, t)   for (i64 i = (s), i##_limit = (t); i >= i##_limit; --i)
#define var(type, ...)  type __VA_ARGS__; read(__VA_ARGS__);
#ifndef DBG
#define dump(...)
#endif
using namespace std;
using i64 = int_fast64_t;
using pii = pair<i64, i64>;
template <class T, class U> inline bool chmax(T &a, const U &b) { return b > a && (a = b, true); }
template <class T, class U> inline bool chmin(T &a, const U &b) { return b < a && (a = b, true); }
constexpr int INF  = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;

template <class T>
inline vector<T> makeV(const T &initValue, size_t sz) {
    return vector<T>(sz, initValue);
}

template <class T, class... Args>
inline auto makeV(const T &initValue, size_t sz, Args... args) {
    return vector<decltype(makeV<T>(initValue, args...))>(sz, makeV<T>(initValue, args...));
}

template <class T>
inline istream& operator>> (istream &is, vector<T> &vec) {
    for (auto &e : vec) is >> e;
    return is;
}

inline void read() {}

template <class Head, class... Tail>
inline void read(Head &head, Tail&... tail) { cin >> head; read(tail...); }

inline void print() { cout << "\n"; }

template <class Head, class... Tail>
inline void print(Head &&head, Tail&&... tail) {
    cout << head;
    if (sizeof...(tail)) cout << ' ';
    print(forward<Tail>(tail)...);
}

template <class T>
inline ostream& operator<< (ostream &os, const vector<T> &vec) {
    static constexpr const char *delim[] = { " ", "" };
    for (const auto &e : vec) os << e << delim[&e == &vec.back()];
    return os;
}

template <class Container>
struct Rev {
    Container &x_;
    inline Rev(Container &x): x_(x) {}
    inline auto begin() { return rbegin(x_); }
    inline auto end() { return rend(x_); }
};
// }}} End Header

int V, E;
vector<vector<int>> G;
vector<i64> dist;
vector<int> prv;

void dfs(int u) {
    for (const int nxt : G[u]) {
        if (dist[nxt] != LINF) continue;
        chmin(dist[nxt], dist[u] + 1);
        prv[nxt] = u;
        dfs(nxt);
    }

    return;
}

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

    read(V, E);
    G.resize(V);

    rep(i, 0, E) {
        var(int, a, b);
        --a, --b;
        G[a].emplace_back(b);
    }

    i64 minlen = LINF;
    int s, t;
    vector<int> path;
    dist.resize(V);
    rep(a, 0, V) {
        for (const int b : G[a]) {
            fill(all(dist), LINF);
            prv.assign(V, -1);
            dist[b] = 0;
            dfs(b);
            if (chmin(minlen, dist[a])) {
                s = a; t = b;
                path = move(prv);
            }
        }
    }

    if (minlen == LINF) {
        print(-1);
        return 0;
    }

    vector<int> ans;
    ans.reserve(minlen + 1);
    int cur = s;
    while (cur != t) {
        ans.push_back(cur);
        cur = path[cur];
    }
    ans.push_back(t);
    reverse(all(ans));

    print(ans.size());
    for (const int e : ans) print(e + 1);

    return 0;
}


Measured memory_bytes: 384
import java.util.*;

public class Main {
     public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        char[] arr = sc.next().toCharArray();
        int count = 0;
        for (int i = 1; i < n; i++) {
            if (arr[i] == arr[i - 1]) {
                count++;
            }
        }
        System.out.println(Math.min(count + k * 2, n - 1));
    }
}


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

using namespace std ;

int n ;
vector< vector< int > > v( 100001 ) ;
int dp[ 100001 ][ 3 ] ;

void solvehelper()
{
   dp[ 1 ][ 0 ] = v[ 1 ][ 0 ] ;
   dp[ 1 ][ 1 ] = v[ 1 ][ 1 ] ;
   dp[ 1 ][ 2 ] = v[ 1 ][ 2 ] ;

   int ans = max( dp[ 1 ][ 0 ] , max( dp[ 1 ][ 1 ] , dp[ 1 ][ 2 ] ) ) ;
   for( int i = 2 ; i<= n ; i++ )
   {
       for( int j = 0 ; j < 3 ; j++ )
       {
           dp[ i ][ j ] = max( dp[ i - 1 ][ ( j + 1 ) % 3 ] + v[ i ][ j ] , dp[ i - 1 ][ ( j + 2 ) % 3 ] + v[ i ][ j ] ) ;
           ans = max( ans , dp[ i ][ j ] ) ;
       }
   }

   cout << ans << endl ;
}

int main()
{
    cin >> n ;

    for( int i = 1 ; i <= n ; i++ )
        for( int j = 0 ; j < 3 ; j++ )
        {
            int x ;
            cin >> x ;
            v[ i ].push_back( x ) ;
            dp[ i ][ j ] = -1 ;
        }

    solvehelper() ;
}


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

using namespace std;

bool a[100010];
int l[1100];
int r[1100];

int main() {
    int N;
    cin >> N;
    for (int i = 0; i < N; i++) {
        cin >> l[i];
        cin >> r[i];
    }
    for (int i = 0; i < N; i++) {
        for (int j = l[i]; j <= r[i]; j++) {
            a[j] = true;
        }
    }
    cout << count(a, a + 100010, true) << endl;
}

Measured memory_bytes: 384
#include <stdio.h>

int main(void)
{
	int i, j;
	int n;
	long long factorial = 1;
	
	scanf("%d", &n);
	for (i = 1; i <= n; i++){
		factorial *= i;
	}
	printf("%lld\n", factorial);
	
	return (0);
}

Measured memory_bytes: 592
from itertools import permutations
import math
menu=5
times=[int(input()) for i in range(menu)]
orders=list(permutations(times,menu))
minimum=sum(math.ceil(time/10)*10 for time in times)
for order in orders:
    total=order[0]
    for i in range(1,menu):
        total+=math.ceil(order[i]/10)*10
    minimum=min(minimum,total)
print(minimum)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
int main(){
  int x,y,z,ans=0;
  cin>>x>>y>>z;
  while ((ans*y+(ans+1)*z)<=x) {
    if (((ans+1)*(y+z)+z)<=x) {
      ans+=1;
    }
    else{
      break;
    }
  }
  cout<<ans<<endl;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;
 


int main(){
    fast;
    int s, w;
    cin >> s >> w;

    if (s <= w)
    {
        cout << "unsafe";
    }
    else
    {
        cout << "safe";
    }
	return 0;
}




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

public class Main {
	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[] A = new int[N];
		int cnt = 0;
		for(int i=0;i<N;i++){
			A[i] = sc.nextInt();
		}
		Arrays.sort(A);
		int pre = A[0];
		cnt++;
		for(int i=1;i<N;i++){
			if(A[i] == pre){
				cnt--;
				pre = 0;
			}else{
				pre = A[i];
				cnt++;
			}
		}
		System.out.println(cnt);
	}
}


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

const int E_MAX = 100010;
struct edge {int u, v, cost;};

bool comp(const edge& e1, const edge& e2){
    return e1.cost < e2.cost;
}


int V, E;
edge G[E_MAX];

struct UnionFind{
    vector<int> par;
    UnionFind(int N) : par(N){
        for(int i = 0; i < N; i++){
            par[i] = -1;
        }
    }
    int root(int x){
        if(par[x] < 0) return x;
        else return par[x] = root(par[x]);
    }
    void unite(int x, int y){
        int rx = root(x);
        int ry = root(y);
        if(rx == ry) return;
        else{
            if(par[rx] > par[ry]) swap(rx, ry);
            par[rx] += par[ry];
            par[ry] = rx;
       }
    }
    bool same(int x, int y){
        return root(x) == root(y);
    }
    void check(){
        for(auto x : par){
            cout << x << " ";
        }
        cout << endl;
    }
};

int kruskal() {
    sort(G, G + E, comp);
    UnionFind uf(V);
    int res = 0;
    for(int i = 0; i < E; i++){
        edge e = G[i];
        if(uf.same(e.u, e.v)) continue;
        else{
            uf.unite(e.u, e.v);
            res += e.cost;
        }
    }
    return res;
}

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

    cin >> V >> E;
    for(int i = 0; i < E; i++){
        int s, e, w;
        cin >> s >> e >> w;
        G[i].u = s;
        G[i].v = e;
        G[i].cost = w;
    }

    cout << kruskal() << endl;

    return 0;
}


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

#define ll long long int
int main()
{


   int a,b,c,d,e;
   cin>>a>>b>>c>>d>>e;
   if(a==0)
   {
       cout<<1<<endl;
   }
   else if(b==0)
   {
       cout<<2<<endl;
   }
   else if(c==0)
   {
       cout<<3<<endl;
   }
   else if(d==0)
   {
       cout<<4<<endl;
   }
   else cout<<5<<endl;
}



Measured memory_bytes: 3564
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <unordered_map>
#include <queue>
#include <algorithm>

#include <bits/stdc++.h>
#include <cmath>
#include <limits>

using namespace std;
using Graph = vector<vector<int>>;

char T[52] = {0};
char S[52] = {0};

int mymatch(char *s, char *t){
	int len1 = strlen(s);
	int len2 = strlen(t);
	if(len1 < len2) return 0;

	int match = 0;
	int i, j;
	for(i = (len1 - len2); i >= 0; i--){
		int b = 1;
		for(j = i; j < i + len2; j++){
			if(s[j] == '?' || s[j] == t[j-i]){
				continue;
			}
			else{
				b = 0;
				break;
			}
		}
		if(b == 1){
			match = 1;
			break;
		}
	}
	if(match == 1){
		strncpy(s + i, t, len2);
	}
	return match;
}

int main(int argc, char* argv[]){
	scanf("%s", S);
	scanf("%s", T);

	int ret = mymatch(S, T);
	if(ret == 0){
		printf("UNRESTORABLE\n");
	}
	else{
		for(int i=0; i<50; i++){
			if(S[i] == '?'){ S[i] = 'a'; }
		}
		printf("%s\n", S);
	}
	return 0;
}

Measured memory_bytes: 256
import Control.Applicative
import Control.Monad
import Data.List
import Data.Array
import Data.Char

main = do
  s <- getLine
  let ans = fst $ foldl (\(isEasy, isEven) c -> if isEven && c /= 'R' then (isEasy && True, False) else if not isEven && c /= 'L' then (isEasy && True, True) else (False, not isEven)) (True, False) s
  putStrLn $ if ans then "Yes" else "No"


Measured memory_bytes: 380