akhauriyash/Code-Regression huggingface dataset:
class Dice:
    def __init__(self, p):
        self.y = [p[0], p[1], p[5], p[4]]
        self.x = [p[0], p[2], p[5], p[3]]
        self.z = [p[1], p[2], p[4], p[3]]
    def roll(self, c):
        if c == 'y':
            self.y.append(self.y.pop(0))
            self.x[0] = self.y[0]
            self.x[2] = self.y[2]
            self.z[0] = self.y[1]
            self.z[2] = self.y[3]
        elif c == 'x':
            self.x.append(self.x.pop(0))
            self.y[0] = self.x[0]
            self.y[2] = self.x[2]
            self.z[1] = self.x[1]
            self.z[3] = self.x[3]
        elif c == 'z':
            self.z.append(self.z.pop(0))
            self.x[1] = self.z[1]
            self.x[3] = self.z[3]
            self.y[1] = self.z[0]
            self.y[3] = self.z[2]
    def num(self, n):
        n = n - 1;
        pos_y = [0, 1, 5, 4]
        pos_x = [0, 2, 5, 3]
        if n in pos_y:
            return self.y[pos_y.index(n)]
        else:
            return self.x[pos_x.index(n)]

    def same(self, other):
        for _ in range(4):
            if self == other:
                return True
            other.roll('x')
            for _ in range(4):
                if self == other:
                    return True
                other.roll('y')
                for _ in range(4):
                    if self == other:
                        return True
                    other.roll('z')
        return False
    def __eq__(self, other):
        for i in range(1,7):
            if (self.num(i) != other.num(i)):
                return False
        return True



p1 = [ int(n) for n in input().split()]
p2 = [ int(n) for n in input().split()]

dice1 = Dice(p1)
dice2 = Dice(p2)


print('Yes' if dice1.same(dice2) else 'No')


Measured memory_bytes: 5620
//============================================================================
// Name        : atcoder.cpp
// Author      :
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
using namespace std;
int N,A[105],ans=100000000;
string str;
int main() {
	cin>>N;
	for(int i=0;i<N;++i){
		cin>>A[i];
	}
	for(int i=-100;i<101;++i){
		int t=0;
		for(int j=0;j<N;++j){
			t+=(A[j]-i)*(A[j]-i);
		}
		ans=min(ans,t);
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);

        HashMap<String, Boolean> wordlist = new HashMap<String, Boolean>();

        int N = scan.nextInt();
        String preword = scan.next();
        wordlist.put(preword, true);

        for (int i=1; i<N; i++) {
            String word = scan.next();

            if (wordlist.get(word) == null) {
                wordlist.put(word, true);
            } else {
                System.out.println("No");
                System.exit(0);
            }

            String end = preword.substring(preword.length()-1,preword.length());
            String start = word.substring(0,1);

            if (!end.equals(start)) {
                System.out.println("No");
                System.exit(0);
            }
            preword = word;
        }

        System.out.println("Yes");
    }
}


Measured memory_bytes: 23764
#include <iostream>
#include <string> 
#include <vector> 
#include <algorithm> 
#include <utility> 
#include <tuple> 
#include <cstdint> 
#include <cstdio> 
#include <map> 
#include <queue> 
#include <set> 
#include <stack> 
#include <deque> 
#include <unordered_map> 
#include <unordered_set> 
#include <bitset> 
#include <cctype> 
#include<math.h>
using namespace std;
//#define int long long
#define m_p make_pair
#define mod 1000000007
#define rep(i,n)  for(int i=0; i<(int)(n); i++)
#define all(v)  v.begin(),v.end()
#define vecin(v) for(int i=0; i<(int)v.size(); i++)cin>>vec[i];
using namespace std;

int jousu(int, int);
int jousu(int x00, int y00) {
	int z00 = 1;
	for (int i = 0; i < y00; i++) {
		z00 *= x00;
	}
	return z00;
}
int kurai(int x00, int y00) {
	int z00 = (x00 % jousu(10, y00)) / jousu(10, y00 - 1);
	return z00;
}
int keta(int x00) {
	int z00 = x00;
	int w00 = 0;
	while (z00 != 0) {
		z00 /= 10;
		w00++;
	}
	return w00;
}



int main() {
	int n, m, a;
	int s1;
	string s, b;
	cin >> n >> m;
	vector<int>check(3,0);
	if (n == 1)s = "0";
	else if (n == 2)s = "10";
	else if (n == 3)s = "100";
	for (int i = 0; i < m; i++) {
		cin >> a >> b;
		if (check[a - 1] == 1 && s[a - 1] != b[0]) {
			cout << "-1" << endl;
			return 0;
		}
		s[a - 1] = b[0];
		check[a - 1] = 1;
	}
	if (s[0] == '0'&&s.size()!=1) {
		cout << "-1" << endl;
		return 0;
	}
	cout << s << endl;
}


Measured memory_bytes: 256
from collections import Counter
S = input()[::-1]
MOD = 2019

X = [0]
for i, s in enumerate(S):
    X.append((X[-1] + int(s) * pow(10, i, MOD)) % MOD)

C = Counter(X)
ans = 0
for v in C.values():
    ans += v * (v - 1) // 2
print(ans)

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

int main(void)
{
	while(1)
	{
		int N, M;
		int currX=10, currY=10;
		bool jem[21][21]={false,};

		cin >> N;
		if(N==0)break;
		
		for(int i=0; i<N; i++)
		{
			int x, y;
			cin >> x >> y;
			jem[x][y] = true;
		}
	
		cin >> M;
		for(int i=0; i<M; i++)
		{
			char d;
			int  l;
			cin >> d >> l;
			
			int  mvx, mvy;
			switch(d)
			{
			case 'N': mvx =  0; mvy = +1; break;
			case 'E': mvx = +1; mvy =  0; break;
			case 'W': mvx = -1; mvy =  0; break;
			case 'S': mvx =  0; mvy = -1; break;
			}

			for(int j=0; j<l; j++)
			{
				currX += mvx;
				currY += mvy;
				jem[currX][currY] = false;
			}
		}
		
		bool ans=true;
		for(int i=0; i<=20; i++)
		{
			for(int j=0; j<=20; j++)
			{
				if(jem[i][j])
				{
					ans = false;
					break;
				}
			}
			if(ans == false)break;
		}
		if(ans) cout << "Yes" << endl;
		else    cout << "No"  << endl;
	}

	return 0;
}

Measured memory_bytes: 1152
#include <bits/stdc++.h>
#define _ ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define pb push_back
#define sz(i) (int)(i.size())
#define F first
#define S second
#define L long double
#define P pair<int, int>
const int mod = (int)1e9 + 7;
using namespace std;
#if LOCAL
#include "../../tr.h"
#else
#define tr(...)
#define endl '\n'
#endif
template<class T> void smin(T& a, T val) {if (a > val) a = val;}template<class T> void smax(T& a, T val) {if (a < val) a = val;}
const int N = 5*(int)1e5 + 10;

int n, q;
map<int, vector<int> > events;
multiset<int> ms;

int32_t main(){_

   cin>>n>>q;

   for (int i = 0; i < n; ++i)
   {
      int s, t, x;
      cin>>s>>t>>x;
      s -= x;
      t -= x;
      events[s].emplace_back(x);
      events[t].emplace_back(-x);
   }

   auto it = events.begin();
   for (int i = 0; i < q; ++i)
   {
      int x;
      cin>>x;
      while(it != events.end() and (*it).first <= x){
         for(auto i: (*it).S){
            if(i >= 0)ms.insert(i);
            else ms.erase(ms.find(-i));
         }
         ++it;
      }
      if(sz(ms))cout<<*ms.begin()<<endl;
      else cout<<-1<<endl;
   }

   return 0;
}

// Common sense: do smth instead of nothing
// Even a single second counts...
// If other's can do it, even I can do it. It wouldn't be that tough. Let me give it a try.
// Mistakes made in past
// -Ques. ask for max-min => think binary_search, DP, greedy
// -not reading question properly / skipping to read & understand all samples properly & wasting time in wrong direction.
// -Using wrong indexing in nested loops something like a[i], when it is supposed to be a[j](WA)
// -value of const int N is not correct (WA/RTE).
// -Did you memset dp to -1 ?
// -check for small edges cases and work on small test cases manually if WA
// -not deallocating memory to pointers can lead to MLE. Use delete :))
// -not reading problem statements of harder problems E,..., thinking it couldn't be solved, but it isn't the case.
// -Avoid using #define int long long as much as possible when it's dp problem and requires high memory say, O(N^2, N=5000) (MLE)
// -Check Bitwise Operator Precedence 
// -Use pragmas to optimize (by constant factor) when necessary..
// -Think before coding & starting to debug. Have patience to look inside code and actually see how it works

Measured memory_bytes: 54400
#!/usr/bin/env python3
import sys
import math
import numpy as np
# from functools import lru_cache

args = sys.argv
if len(args) == 2:
  from IPython import embed
  em = True
else:
  em = False

#### input
N, K = map(int, input().split())
S = input()
# a = list(map(int, input().split()))
# a = list(map(lambda x: int(x)*(-1), a))  # 各要素を-1倍


# n = int(input())
# t = [int(input()) for i in range(n)]
if em: sys.stdin = open('/dev/tty')

#### functions
# @lru_cache(maxsize=10000)

#### process
# if em: embed()

score = 0
for i in range(0, len(S) - 1):
  if(S[i] == S[i+1]): score = score + 1

num_R = len([s for s in S if s == "R"])

if num_R > len(S) / 2:
  S2 = S.split("R")
else:
  S2 = S.split("L")

edge     = len([s for s in [S2[0],S2[-1]] if s != ""])
non_edge = len([s for s in S2[1:-1] if s != ""])

# if em:embed()

score = score + 2 * min(K, non_edge)
K = K - min(K, non_edge)
score = score + min(K, edge)

print(score)

## heapsort, O(logN)
# import heapq
# heapq.heapify(A)
# min = heapq.heappop(A)
# heapq.heappush(A, new_element)


Measured memory_bytes: 21320
#include <bits/stdc++.h>
#define INT long long int
#define DF 8001
using namespace std;
string s;
int X, Y;
vector<int> xx, yy;
bool PX[2][20000], PY[2][20000], zz;
 
int main()
{
    ios::sync_with_stdio(false);
    cin>>s>>X>>Y;
    int cnt = 0;
    if( s[0] == 'F' ) zz = true;
    for(int i = 0, d = 0 ; i < s.size() ; i++ )
        if( s[i] == 'F' )
        {
            if( d%2 == 0 ) cnt++;
        }
        else
        {
            d++;
            if( cnt ) xx.push_back(cnt), cnt = 0;
        }
    if( cnt ) xx.push_back(cnt);
    cnt = 0;
    for(int i = 0, d = 0 ; i < s.size() ; i++ )
        if( s[i] == 'F' )
        {
            if( d%2 == 1 ) cnt++;
        }
        else
        {
            d++;
            if( cnt ) yy.push_back(cnt), cnt = 0;
        }
    if( cnt ) yy.push_back(cnt);
    PX[0][10000] = true;
    for(int i = 0 ; i < xx.size() ; i++ )
        for(int j = 0 ; j < 20000 ; j++ )
            if( PX[i%2][j] )
            {
                if( i == 0 and zz ) PX[(i+1)%2][j+xx[i]] = true;
                else PX[(i+1)%2][j+xx[i]] = PX[(i+1)%2][j-xx[i]] = true;
                PX[i%2][j] = false;
            }
    PY[0][10000] = true;
    for(int i = 0 ; i < yy.size() ; i++ )
        for(int j = 0 ; j < 20000 ; j++ )
            if( PY[i%2][j] )
            {
                PY[(i+1)%2][j+yy[i]] = PY[(i+1)%2][j-yy[i]] = true;
                PY[i%2][j] = false;
            }
 
    if( PX[(xx.size())%2][X+10000] and PY[(yy.size())%2][Y+10000] ) cout<<"Yes\n";
    else cout<<"No\n";
    return 0;
}

Measured memory_bytes: 384
#include"bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef vector<int> vi;

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

	vector<int>a(M + 5);
	vector<int>b(M + 5);

	int k = 0, j = 0;

	if (N%2==1) {

		for (int i = 1; i <= M; i++) {
			a[i] = i;
			b[i] = N - i + 1;
			cout << a[i] << ' ' << b[i] << endl;
		}
	}

	else {
		for (int i = 1; i <= (M+1)/2; i++) {
			a[i] = i;
			b[i] = N - i + 1;
			cout << a[i] << ' ' << b[i] << endl;
			k = i;
		}

		for (int i = k+1; i <= M; i++) {
			a[i] = i;
			b[i] = N - i;
			cout << a[i] << ' ' << b[i] << endl;

		}

	}
	return 0;
}

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

int main(){
    //freopen("a.in", "r", stdin);
    int n; cin >> n;
    string s; cin >> s;
    long long tot = 1;
    long long numr = 0, numb = 0, numg = 0;
    for(int i = 0; i<n; i++){
        if(s[i] == 'R') numr++;
        if(s[i] == 'G') numg++;
        if(s[i] == 'B') numb++;
    }
    tot = numr*numb*numg;
    for(int i = 0; i<n; i++){
        for(int j = i+1; j<n; j++){
            if(i%2 != j%2) continue;
            int mid = (i+j)/2;
            if(s[i] != s[mid] && s[mid] != s[j] && s[i] != s[j]) tot--;
        }
    }
    cout << tot << endl;
}

Measured memory_bytes: 3632
#include <iostream>
#include <cmath>
#include <cstdio>
using namespace std;

int main() {
    double theta;
    double x=0, y=0;
    while(1){
        int step, angle;
        scanf("%d,%d",&step, &angle);
        if(step == 0 && angle == 0) break;
        x += cos( ( 90 - theta ) * M_PI / 180 ) * step;
        y += sin( ( 90 - theta ) * M_PI / 180 ) * step;
        theta += angle;
    }
    cout << (int)x << endl << (int)y << endl;
    return 0;
}

Measured memory_bytes: 1212
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define fi first
#define se second
#define mp make_pair
#define itrfor(itr,A) for(auto itr = A.begin(); itr !=A.end();itr++)
template <class T> using reversed_priority_queue = priority_queue<T, vector<T>, greater<T> >;
typedef long long llong;
char moji[26]={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
char moji2[26]={'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
char moji3[10]={'0','1','2','3','4','5','6','7','8','9'};
#define Sort(a) sort(a.begin(),a.end());
#define Reverse(a) reverse(a.begin(),a.end());
#define print(a) cout << a << endl;
#define MOD llong(1e9+7)
#define MAX int(2 * 1e5 +5)
#define debug(x)  cout << #x << " = " << (x) << endl;
#define pi acos(-1.0)
#define int llong
#define INF llong(1e17)
template<class T> bool chmax(T &a,  T b) {if(a<b){a=b; return 1;} return 0;}
template<class T> bool chmin(T &a,  T b) {if(a>b){a=b; return 1;} return 0;}
void myprint(int* A,int A_num){
   REP(i,A_num) cout << A[i] << " ";
   cout << endl;
}

const int n_max = 3005;

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

    int dp[n_max][n_max];
    REP(i,n+1) REP(j,n+1) dp[i][j] = 0;
    REP(i,n) dp[0][i] = 1;
    FOR(i,1,n){
        if(s[i-1] == '<'){
            int summ = 0;
            REPR(j,n-1){
                if(i + 1 + j > n) continue;
                summ += dp[i-1][j + 1];
                summ %= MOD;
                dp[i][j] = summ;
            }
        }
        else{
            int summ = 0;
            REP(j,n){
                if( i + 1 + j > n ) continue;
                summ += dp[i-1][j];
                summ %= MOD;
                dp[i][j] = summ;
            }

        }
    }

    cout << dp[n-1][0] << endl;



}

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

int main()
{
	std::vector<int> nakayosimap;
	int n;
	std::cin >> n;

	nakayosimap.assign(n, 0);

	int count = 0;
	for (int i = 0; i < n; i++) {
		int suki;
		std::cin >> suki;
		suki -= 1;
		if (suki < i && nakayosimap.at(suki) == i) {
			count += 1;
		}
		
		nakayosimap.at(i) = suki;
	}

	std::cout << count << std::endl;
}

Measured memory_bytes: 640
S = input()
n = len(S)
a = b = ''
for i in range(n):
    if i % 2 == 0:
        a += '0'
        b += '1'
    else:
        a += '1'
        b += '0'

diff_a = diff_b = 0
for i in range(n):
    if S[i] != a[i]:
        diff_a += 1
    if S[i] != b[i]:
        diff_b += 1

print(min(diff_a, diff_b))

Measured memory_bytes: 3316
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <iomanip>
#include <limits>
#include <cmath>
#include <numeric>
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
const long long INF = 1LL << 60;

long long gcd(long long a, long long b)
{
	if (a % b == 0)
	{
		return(b);
	}
	else
	{
		return(gcd(b, a % b));
	}
}

long long lcm(long long a, long long b)
{
	return a * b / gcd(a, b);
}

int main() {
	long long N;
	long long X;
	cin >> N >> X;
	vector<long long > A(N);


	for (long i = 0; i < N; i++) cin >> A[i];
	long long res = 0;
	for (long i = 0; i < N - 1; i++) {
		if (A[i] + A[i + 1] > X) {
			long long tmp = abs(A[i] + A[i + 1] - X);
			res = res + tmp;
			if (tmp > A[i + 1]) {
				A[i] = A[i] - abs(tmp - A[i + 1]);
				A[i + 1] = 0;
			} else {
				A[i + 1] = A[i + 1] - tmp;
			}
		}
	}
	cout << res << endl;
}

Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <cstdlib>
#include <cstdio>
#include <algorithm>
using namespace std;
using ll = long long;
using pil = pair<int, ll>;


const ll INF = (ll)1e15;
const int N = 200000;
int n, m;
vector<pil> Graph[N]; // <p1, p2> のp1は関係を持つ頂点,p2は辺の重み
bool used[N];
ll min1, min2;
ll val[N];  // 二部グラフの頂点の重み. 二次元配列にしないように工夫している


void dfs(int v){
  used[v] = 1;
  for(pil e : Graph[v]){
    int u = e.first; // 相手の頂点
    ll w = e.second - val[v]; // 相手の頂点の重み
    if(used[u]){
      if (w != val[u]){
        min2 = -INF;
        return ;
      }
      continue;
    }
    val[u] = w;
    // 二部グラフのどちらの側かを判定する
    if(u < n){
      min1 = min(min1, w);
    }else{
      min2 = min(min2, w);
    }

    dfs(u);
  }
  return ;
}
int main(){
  int k;
  scanf("%d%d%d", &n, &m, &k);
  while(k--){
    int v, u;
    ll x;
    scanf("%d%d%lld", &v, &u, &x);
    // 0インデックスにする
    v--;
    u--;
    // 1次元配列で表現するための工夫
    u += n;
    Graph[v].push_back(make_pair(u, x));
    Graph[u].push_back(make_pair(v, x));
  }

  for(int i = 0; i < n; ++i){
    if (used[i]) continue;
    min1 = 0;
    min2 = INF;
    val[i] = 0;
    dfs(i);
    if(min1 + min2 < 0){
      printf("No\n");
      return 0;
    }
  }
  printf("Yes\n");

  return 0;
}


Measured memory_bytes: 15104
#include<iostream>
#include<cstdio>
#include<vector>
#include<string>
#include<cstring>
#include<functional>
#include<stack>
#include<queue>
#include <iomanip>
#include<map>
#include<limits>
#include<cmath>
#include<algorithm>
#include<bitset>
#include<utility>
#include<complex>
#include<cstdlib>
#include<set>
#include<cctype>

#define DBG cerr << '!' << endl;
#define REP(i,n) for(int (i) = (0);(i) < (n);++i)
#define rep(i,s,g) for(int (i) = (s);(i) < (g);++i)
#define rrep(i,s,g) for(int (i) = (s);i >= (g);--(i))
#define PB push_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {for(int W = 0;W < (n);W++)cerr << v[W] << ' ';cerr << endl << endl;}
#define SHOW2d(v,i,j) {for(int aaa = 0;aaa < i;aaa++){for(int bbb = 0;bbb < j;bbb++)cerr << v[aaa][bbb] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(10)

using namespace std;

typedef long long ll;
typedef vector<int> iv;
typedef vector<iv> iiv;
typedef vector<string> sv;

ll mp[400][400];

int main()
{
	int n;cin >> n;
	
	REP(i,n)REP(j,n)cin >> mp[i][j];
	
	REP(i,n)REP(j,n)
	{
		if(mp[i][j] != mp[j][i] || (i == j && mp[i][j] != 0))
		{
			cout << -1 << endl;
			return 0;
		}
	}
	
	ll ans = 0;
	
	REP(i,n)
	{
		REP(j,n)
		{
			if(i == j)continue;
			bool flag = true;
			REP(k,n)
			{
				if(i == k || j == k)continue;
				if(mp[i][k] + mp[k][j] < mp[i][j])
				{
					cout << -1 << endl;
					return 0;
				}
				if(mp[i][k] + mp[k][j] == mp[i][j])
				{
					flag = false;
				}
			}
			if(flag)ans+=mp[i][j];
		}
	}
	
	cout << ans/2 << endl;

	return 0;
}

Measured memory_bytes: 1152
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        int  n = Integer.parseInt(br.readLine());
        if(n%1000==0)
            System.out.println(0);
        else
            System.out.println(1000 - (n%1000));
    }
}


Measured memory_bytes: 32388
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <random>
#include <chrono>

using namespace std;
using namespace __gnu_pbds;

#define endl '\n'

typedef long long ll;
typedef pair<int, ll> pii;
//typedef tree<int,null_type,less<int>,rb_tree_tag, tree_order_statistics_node_update> indexed_set;

//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const int maxn = 1e5 + 5;

int color[maxn];

vector<pii> g[maxn];

void dfs(int u, int p, ll c){
	
	color[u] = c % 2;
	for(auto &e : g[u]){
		int v = e.first;
		ll cost = e.second;
		
		if(v != p){
			dfs(v, u, c + cost);
		}
	}
	
}

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

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

	int n;
	cin >> n;
	
	for(int i = 1; i < n; i++){
		int a, b;
		ll c;
		cin >> a >> b >> c;
		g[a].push_back({b, c});
		g[b].push_back({a, c});
	}
	
	dfs(1, 0, 0);
	
	for(int i = 1; i <= n; i++)
		cout << color[i] << endl;

	return 0;
}


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

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

    int n1, m1;

    n1 = (n * (n-1)) / 2;
    m1 = (m * (m-1)) / 2;

    cout << n1 + m1 << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<limits>
#define ll long long
#define F first
#define S second
#define pb push_back
#define oo 1e18
#define endl '\n'
#define si size()
#define all(v) v.begin(),v.end()
#define FASTIO ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);

using namespace std;
int dx[] = {0,0,1,-1};
int dy[] = {1,-1,0,0};
const long double Pi=acos(-1),e=2.718;
const int N=1e5+110,mod=3e7;
ll a[N],dp[N],n,k;
ll solve(int i){
    if(i>=n-1){
        if(i==n-1)return 0;
        else return oo;
    }
    ll &ret=dp[i];
    if(ret+1)return ret;
    ret = oo;
    for(int j=0;j<=k;j++){
        ret = min(ret,solve(i+j)+abs(a[i+j]-a[i]));
    }
    return ret;
}
int main()
{
    memset(dp,-1,sizeof dp);
    FASTIO
    cin >> n >> k;
    for(int i=0;i<n;i++){
        cin >> a[i];
    }
    cout << solve(0) << endl;
    return 0;
}
/**

*/


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

#define int long long
#define ct(n) cout << n << endl;
#define cts(n) cout << n << " ";
#define cte cout << endl;
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define repo(i,o,n) for(int i=o;i<n;i++)
#define repm(i,n) for(int i=n-1;i>=0;i--)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define sperase(v,n) (v).erase(remove(all(v), n), (v).end());
#define vdelete(v) (v).erase(unique(all(v)), (v).end());
#define vcopy(v1,v2) copy((v1).begin(), (v1).end(), back_inserter((v2)));
#define pb(n) push_back(n);

int kr(int x);
int In(int a);

int n,ans,a[3]={3,5,7},hoge = 1000000000;
vector<int> v;

main() {
    cin >> n;
    rep(i,3) kr(a[i]);
    sort(all(v));
    v.pb(1000000001)
    rep(i,v.size()) if (v[i] > n) {
        ans = i;
        break;
    }
    ct(ans)

}

int kr(int x) {
    if(x/hoge) return 0;
    if(In(x))v.pb(x);
    rep(i,3) kr(x*10+a[i]);
}

int In(int a) {
    int s=0,f=0,t=0;
    while (a%10) {
        if (a%10 == 3) t++;
        if (a%10 == 5) f++;
        if (a%10 == 7) s++;
        a/=10;
    }
    if (t && f && s) return 1;
    return 0;
}

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

using namespace std;

#define IoFast ios_base::sync_with_stdio(0);cin.tie(0);
#define ll long long int
#define float long double
#define foor(i, a, b) for ( int (i) = (a); (i)<(b); (i)++ )
#define foor2(i, a, b) for( int (i) = (a); (i)>(b); (i)-- )
#define foorl(i, a, b) for ( ll (i) = (a); (i)<(b); (i)++ )
#define foorl2(i, a, b) for( ll (i) = (a); (i)>(b); (i)-- )
#define mp make_pair
#define f1 first
#define f2 second
#define pb push_back
#define pii pair<int,int>
#define vpii vector <pii>
#define vi vector<int>
#define sz(a) (int) a.size( )
#define fillArr(n, a) foor(i, 0, n) cin >> a[i];
#define print(a) cout << #a << endl;
#define umax(a,b) a = max ( a, b )
#define umin(a,b) a = min ( a, b )
#define all(k) k.begin ( ), k.end( )
#define rall(k) k.rbegin ( ), k.rend( )
#define clean(k) memset( k, 0, sizeof(k) )
#define endl '\n'


int main(){
	IoFast;
	ll x,y;
	cin >> x >> y;
	ll ans3 = INT_MAX;
	if (x < y)
		ans3 = abs(y-x);
	ll ans1 = abs((-x) - y) + 1;
	ll ans2 = abs((-x)-(-y)) + 2;
	cout << min({ans1, ans2, ans3}) << endl;
}



Measured memory_bytes: 384
#include <stdio.h>

int main(void) {
  int n, m;
  scanf("%d %d", &n, &m);

  int A[n][m];
  for (int i=0; i<n; i++) {
    for (int j=0; j<m; j++) {
      scanf("%d", &A[i][j]);
    }
  }

  int v[m];
  for (int i=0; i<m; i++) {
    scanf("%d", &v[i]);
  }

  for (int i=0; i<n; i++) {
    int ans=0;
    for (int j=0; j<m; j++) {
      ans+=(A[i][j]*v[j]);
    }
    
    printf("%d\n", ans);
  }
  return 0;
}


Measured memory_bytes: 2104
#include<bits/stdc++.h>
#define rep(i,n) for(int i=1; i<=n; i++)
using namespace std;
int every=0;
void make(){
  int last=0;
  rep(i,999){
    rep(j,10){
      if (i%3==0) last = 20;
      else if(j%2==0) last=19;
      else last = 20;
      rep(k,last){
        every++;
      }
    }
  }
}
int main(){
  int n;
  cin >> n;
  make();
  rep(i,n){
    int y,m,d,count=0,last;
    cin >> y >> m >> d;
    rep(i,y){
      rep(j,10){
        if(i==y && j==m){
          count += d;
          //cout << every << endl;
          cout << every-count+1 << endl;
          break;
        }
        else{
          if(i%3==0) last=20;
          else if(j%2==0) last=19;
          else last = 20;
        }
        rep(i,last) count++;
      }
    }
  }
  return 0;
}



Measured memory_bytes: 3084
#include<iostream>
#include<cstdio>
const int maxn = 2000000;
int A[maxn];
int main()
{
    int n;
    scanf("%d",&n);
    int x = 0;
    for(int i = 1;i <= n;i++){
        scanf("%d",&A[i]);
    }
    for(int i = 1;i <= n;i++){
        x = (x ^ A[i]);
    }
    if(x == 0){
        printf("Yes\n");
    }else {
        printf("No\n");
    }
    return 0;
}

Measured memory_bytes: 640
from itertools import accumulate
import bisect
n,m,k=map(int,input().split())
a=[int(i) for i in input().split()]
b=[int(i) for i in input().split()]

A=list(accumulate(a))
B=list(accumulate(b))
ans=bisect.bisect_right(B,k)
for i in range(len(a)):
    r = (k-A[i])
    if r<0:
        break
    #print(r,bisect.bisect_left(B,r))
    #print(B[bisect.bisect_left(B,r)])
    ans=max(ans,i+1+bisect.bisect_right(B,r))
print(ans)


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

int n, res, d[100001];
vector<int> g[100001];
void dfs(int u) {
	for(int v: g[u]) dfs(v);
	sort(g[u].begin(), g[u].end(), [] (int x, int y) { return d[x] > d[y]; });
	for(int i = 0; i < g[u].size(); i++) d[u] = max(d[g[u][i]]+i+1, d[u]);
}
int main() {
	scanf("%d",&n);
	for(int i = 2,v; i <= n; i++) scanf("%d",&v), g[v].push_back(i);
	dfs(1);
	printf("%d\n", d[1]);
}


Measured memory_bytes: 10752
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int A,B,C;
    cin>>A>>B>>C;
    if(A==B&&C!=A)
    cout<<"Yes"<<endl;
    else if(B==C&&A!=B)
    cout<<"Yes"<<endl;
    else if(A==C&&B!=A)
    cout<<"Yes"<<endl;
    else
    cout<<"No"<<endl;
    return 0;
}


Measured memory_bytes: 3140
from collections import deque
n, k = map(int, input().split())
D = list(map(int, input().split()))

# 1. 初期化
ok_lst = [x for x in range(0, 10) if x not in D]
ok_lst.sort(reverse = True)
stack = deque([x for x in ok_lst if x != 0])
ans_list = []

while len(stack) > 0:
    # 2. 現在の情報の取得
    # 今回は現在の数字
    now_num = stack.pop()
    # 3. 処理
    # もしnow_numが条件の値以上になったらans_listに記録し，数値を足すとまずいのでcontinueで防ぐ
    if now_num >= n:
        ans_list.append(now_num)
        continue
    # 4. 更新
    for x in ok_lst:
        next_num = str(now_num) + str(x)
        next_num = int(next_num)
        stack.append(next_num)

print(min(ans_list))

Measured memory_bytes: 5812
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner scanner  =new Scanner(System.in);
		String ans  ="No";

		int a  =scanner.nextInt();
		int b  =scanner.nextInt();
		int c  =scanner.nextInt();

		if(a==b || a==c || b==c) {
			ans = "Yes";
		}
		if(a==b && b==c) {
			ans = "No";
		}

		System.out.println(ans);

		scanner.close();

	}

}


Measured memory_bytes: 35256
n, k = gets.chomp.split.map(&:to_i)
arr = []
n.times{arr << gets.to_i}
arr.sort!
min = nil
i = 0
while true
    break if i + k - 1 > arr.length - 1
    diff = arr[i + k - 1] - arr[i]
    min = diff if min.nil? || min > diff
    i += 1
end
puts min

Measured memory_bytes: 4016
//#include <stdio.h>
#include <math.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <queue>
#include <map>
#include <utility>
#include <iomanip>

using namespace std;

#define ll long long
#define MODX 1000000007

ll N, M;
vector<bool> a;
vector<ll> dp;
bool isOK = true;

ll res(ll i)
{
    if (dp.at(i) != -1)
    {
        return dp.at(i);
    }

    ll ret;
    if (i == N)
    {
        ret = 0;
    }
    else if (i + 2 <= N && a.at(i + 1) && a.at(i + 2))
    {
        ret = res(i + 1) + res(i + 2) + 1;
    }
    else if (i + 1 <= N && a.at(i + 1))
    {
        ret = res(i + 1);
    }
    else if (i + 2 <= N && a.at(i + 2))
    {
        ret = res(i + 2);
    }
    else
    {
        isOK = false;
        ret = 0;
    }

    return dp.at(i) = ret % MODX;
}

void solve()
{
    cin >> N >> M;
    a = vector<bool>(N + 1, true);
    dp = vector<ll>(N + 1, -1);
    for (ll i = 0; i < M; i++)
    {
        ll aa;
        cin >> aa;
        a.at(aa) = false;
    }

    ll result = res(0);
    if (!isOK)
    {
        cout << 0 << endl;
    }
    else
    {
        cout << result + 1 << endl;
    }

    return;
}

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


Measured memory_bytes: 5760
#include<bits/stdc++.h>
#include<climits>
 
using namespace std;
 
#define debug(x,y) cout<<(#x)<<" " <<(#y)<<" is " << (x) <<" "<< (y) << endl
#define watch(x) cout<<(#x)<<" is " << (x) << endl
#define fast ios_base::sync_with_stdio(false)
typedef long long int lld; 
 
lld n,k,a[100001],dp[100001];
 
//TOP-DOWN
lld frogTwo(lld n){
    lld c=INT_MAX;
    if(n<=0) return dp[n]=0;
    if(dp[n]!=-1) return dp[n];  
    for(lld i=1;i<=k;i++){
        if(n-i>=0){
            c=min(c,frogTwo(n-i)+abs(a[n]-a[n-i]));
        }
    }
    return dp[n]=c;
}
 
 
int main(){
    fast;
    cin.tie(0);
    lld i,j;
    cin>>n>>k;
    for(i=0;i<n;i++){
        cin>>a[i];
    }
    memset(dp,-1,sizeof(dp));
    cout<<frogTwo(n-1)<<endl;
}

Measured memory_bytes: 6528
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define FOR(i,n,m) for(int i=(n);i<(m);i++)
#define REP(i,n) for(int i=0;i<(n);i++)
#define REPR(i,n) for(int i=(n);i>=0;i--)
#define all(vec) vec.begin(),vec.end()
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using P=pair<ll,ll>;
using PP=pair<ll,P>;
using vp=vector<P>;
using vpp=vector<PP>;
using vs=vector<string>;
#define fi first
#define se second
#define pb push_back
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;}
template<class T>bool chmin(T &a,const T &b){if(a>b){a=b;return true;}return false;}
template<typename A,typename B>istream&operator>>(istream&is,pair<A,B> &p){is>>p.fi>>p.se;return is;}
template<typename A,typename B>ostream&operator<<(ostream&os,const pair<A,B> &p){os<<"("<<p.fi<<","<<p.se<<")";return os;}
template<typename T>istream&operator>>(istream&is,vector<T> &t){REP(i,t.size())is>>t[i];return is;}
template<typename T>ostream&operator<<(ostream&os,const vector<T>&t){os<<"{";REP(i,t.size()){if(i)os<<",";os<<t[i];}cout<<"}";return os;}
const ll MOD=1000000007LL;
const int INF=1<<30;
const ll LINF=1LL<<60;
template<class T>
struct Median{
    priority_queue<T> q1;
    priority_queue<T,vector<T>,greater<T>> q2;
    T dist;
    Median():dist(){}
    void insert(T x){
        if(!q1.size()){
            q1.push(x);
        }else if(q1.size()==q2.size()){
            if(x>q2.top()){
                q1.push(q2.top());
                q2.pop();
                q2.push(x);
            }else{
                q1.push(x);
            }
        }else{
            int p=q1.top();
            if(x>q1.top()){
                q2.push(x);
            }else{
                q2.push(q1.top());
                q1.pop();
                q1.push(x);
            }
            dist+=abs(p-q1.top());
        }
        dist+=abs(x-q1.top());
    }
    T median(){
        return q1.top();
    }
    T distance(){
        return dist;
    }
    void debug(){
        auto t1=q1;
        vector<T> l,r;
        while(t1.size()){l.push_back(t1.top());t1.pop();}
        auto t2=q2;
        while(t2.size()){r.push_back(t2.top());t2.pop();}
        cerr<<l<<","<<r<<endl;
    }
};
int main(){
    int Q;
    scanf("%d",&Q);
    ll r=0;
    Median<ll> med;
    REP(i,Q){
        int f;
        scanf("%d",&f);
        if(f==1){
            ll a,b;
            scanf("%lld%lld",&a,&b);
            med.insert(a);
            r+=b;
        }else{
            printf("%lld %lld\n",med.median(),med.distance()+r);
        }
        //med.debug();
    }
    return 0;
}

Measured memory_bytes: 3828
import java.util.Scanner;
class Main{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		int x = scan.nextInt();
		int a = scan.nextInt();
		int b = scan.nextInt();
		int c = x-a;
		int l = c/b;
		int m = l*b;
		int change = c-m;
		System.out.println(change);
	}
}

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

int sumvec(vector<int> vec){
  int ans;
  for(int i=0;i<vec.size();i++){
    ans += vec.at(i);
  }
  return ans;
}

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

  	vector<int> A(N);
  	for(int i=0;i<N;i++){
      cin >> A.at(i);
    }
  
  	int attack = sumvec(A);
  	if(H <= attack) cout << "Yes" << endl;
    else cout << "No" << endl;
}


Measured memory_bytes: 3964
#include <cstdio>
#include <algorithm>
int N, T, E, pl, x[100009]; long long dp[100009];
int main() {
	scanf("%d%d%d", &N, &E, &T);
	for (int i = 0; i < N; i++) scanf("%d", &x[i]);
	long long best = 1LL << 60;
	for (int i = 0; i < N; i++) {
		while (x[pl] + T / 2 < x[i]) best = std::min(best, dp[pl]), pl++;
		dp[i + 1] = std::min(dp[pl] + T + x[pl] * 2, best + x[i] * 2) - x[i + 1] * 2;
	}
	printf("%lld\n", dp[N] + E - x[0] * 2);
	return 0;
}

Measured memory_bytes: 1280
#include <bits/stdc++.h>
#define mp make_pair
#define eb emplace_back
#define fi first
#define se second
using namespace std;
using cd = complex <double>;
 
typedef pair <int, int> pii;
 
const long long INF = 1e15;
const int mod = 998244353;//1000000007;
const double Pi = acos(-1);
 
void Fastio()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
}

int n, k;
long long R[1005];
vector <long long> Temp;

int main()
{
	Temp.eb(0);
	cin >> n >> k;
	for(int i = 1; i <= n; i++)
	{
		int temp;
		cin >> R[i];
		R[i] += R[i - 1];
	}
	for(int i = 0; i <= n; i++)
	{
		for(int j = i + 1; j <= n; j++)
		{
			Temp.eb(R[j] - R[i]);
		}
	}
	long long ans = 0;
	for(int i = 50; i >= 0; i--)
	{
		int c = 0;
		for(auto x : Temp)
		{
			long r = x & ans;
			if(r == ans)
			{
				if(x & (1ll << i))
				{
					c++;
				}
			}
		}
		if(c >= k)
		{
			ans ^= (1ll << i);
		}
	}
	cout << ans;
}

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

int main() {
  int a, b, c;
  cin >> a >> b >> c;
  int s ;
  if (c > a + b){
    s = b + a + b + 1;
  }
  else if (c == a + b){
    s = a + 2 *b;
  }
  else{
    s = c + b;
  }
  cout << s << endl;
}

Measured memory_bytes: 256
#!/usr/bin/env ruby

require 'prime'

n = gets().chomp().to_i()



print "#{n}:"
if Prime.prime?(n) then
  print " #{n}"
else
  Prime.each(n).each do|i|
    loop do
      if n % i == 0 then
        print " #{i}"
        n = n/i
      else
        break
      end
    end
    if i > n then
      break
    end
  end
end
puts ""


Measured memory_bytes: 7124
#pragma GCC optimize("O2")
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<limits.h>
#include<ctime>
#define N 100001
typedef long long ll;
const int inf=0x3fffffff;
const int maxn=2017;
using namespace std;
inline int read()
{
    int f=1,x=0;char ch=getchar();
    while(ch>'9'|ch<'0')
    {
        if(ch=='-')
        f=-1;
        ch=getchar();
    }
    while(ch<='9'&&ch>='0')
    {
        x=(x<<3)+(x<<1)+ch-'0';
        ch=getchar();
    }
    return f*x;
}
bool flag[20000000];
int main()
{
     int n=read(),m=read(),k=read();
     for(int i=1;i<=n;i++)
     {
     	for(int j=1;j<=m;j++)
     	{
     		int tem=i*m+j*n-2*i*j;
	     	flag[tem]=1;
	     	flag[n*m-tem]=1;
	     }
     }
     if(flag[k])cout<<"Yes";
     else cout<<"No";
} 

Measured memory_bytes: 1280
//https://atcoder.jp/contests/abc138/tasks/abc138_a
#include<iostream>
#include<vector>
#include<set>
#include<string>
#include<algorithm>
#define aakriti long long int
using namespace std;
int main()
{
	aakriti a;
	cin >> a;
	string s;
	cin >> s;
	if (a < 3200)
		cout << "red";
	else
		cout << s;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define fi first
#define se second
#define pb push_back
using namespace std;

ll n,a,b;

int main()
{

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

    cin >> n;
    if( n&1 || n<2 ){
        cout << 0;
        return 0;
    }
    for(ll i=2; ; i*=2){
        a+=n/i;
        if( (ll)(n/i) < 2 ) break;
    }
    for(ll i=5; ; i*=5){
        b+=n/(i+i);
        if( (ll)(n/i) < 5 ) break;
    }

    cout << min( a , b );

    return 0;
}


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

using namespace std;

int main() {
	int x, a, b; cin >> x >> a >> b;
	int n; cin >> n;
	while (n--) {
		string s; cin >> s;
		if (s == "nobiro") x += a;
		else if (s == "tidime") x += b;
		else x = 0;
		if (x < 0) x = 0;
	}
	cout << x << endl;

	return 0;
}


Measured memory_bytes: 3180
/************************************
/ AUTHOR : YATHARTH GOSWAMI         /  
/ ALIAS : hacker_yg                 /
/ INSTITUTE : IIT Kanpur            /
************************************/
//          TEMPLATE                //

#include <bits/stdc++.h>

#define ll long long
#define MOD 1000000007
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define PI 3.14159265359

using namespace std;

/*ll powMod(ll a, ll y)
{
    ll ans = 1;
    
    while (y > 0) 
    { 
        if (y & 1) 
            ans = (ans*a) % MOD; 
  
        y = y>>1;
        a = (a*a) % MOD; 
    } 
    return ans;
}*/

/*ll modInv(ll a)
{
    return powMod(a, MOD-2);	
}*/

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    int n;
    cin >> n;
    vector <int> a(n), b(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i] >> b[i];
    }
    int f = 0;
    for (int i = 0; i < n-2; i++) {
        if (a[i] == b[i] && a[i+1] == b[i+1] && a[i+2] == b[i+2]) {
            f = 1;
            break;
        }
    }
    if (f) cout << "Yes" << endl;
    else cout << "No" << endl; 
    return 0;
}




Measured memory_bytes: 3608
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0;i<int(N);++i)
#define rep1(i,N) for(int i=1;i<int(N);++i)
#define all(a) (a).begin(),(a).end()		//sort(all(vi S)) sort(all(string S))

typedef long long ll;
typedef vector<int> vi;
typedef set<int> seti;
typedef vector<string> vs;

const int MOD = 1e9+7;
const int INF = 1e9;

int main() {
	ll A,B,C;
	cin>>A>>B>>C;
	if(A*B*C%2==0){
		cout<<0<<endl;
		return 0;
	}
	else{
		ll ans=min(A*B,B*C);
		ans=min(ans,C*A);
		cout<<ans<<endl;
		return 0;
	}
}

Measured memory_bytes: 256
#include<stdio.h>

int main()
{
	int H;
	int A;
	int X;
	scanf("%d %d",&H,&A);
	X= H / A;
	//printf("%d",X);
	if(H % A == 0 )
	{
		printf("%d",X);
	}
	else
	{
		printf("%d",X+1);
	}
	
	return 0;	
}
	

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

#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)
#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)
#define repr(x,fr,to) for(int (x)=(fr);(x)>=(to);(x)--)
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()

using namespace std;
typedef long long ll; typedef vector<int> VI; typedef pair<int,int> pii;
const int MD = (int)1e9 + 7; typedef vector<ll> VL;
void dbg(){ cerr << "\n"; }  template <class T, class ...T2>
void dbg(const T& fst, const T2&...rst){ cerr << fst << ": "; dbg(rst...); }


int main()
{

	cin.tie(0); ios_base::sync_with_stdio(false);
	int n,  ans =0;
	string s;
	cin >> s;
	//Sunny, Cloudy, Rainy 
	if(s[0]=='S') cout << "Cloudy" <<"\n";
	else if(s[0]=='C') cout << "Rainy" <<"\n";
	else  cout << "Sunny" <<"\n";
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define llint long long int
#define ldouble long double

//setprecision()<<

using namespace std;

int main() {
    int N;
    cin>>N;
    vector<double> v(N);
    for(int i=0;i<N;i++){
        cin>>v.at(i);
    }
    sort(v.begin(),v.end());

    double sum=v.at(0);
    for(int i=1;i<N;i++){
        sum=(sum+v.at(i))/2;
    }
    cout<<setprecision(10)<<sum<<endl;
return 0;
}

Measured memory_bytes: 256
def solve(S):
    l=len(S)
    for i,s in enumerate(S[:-1]):
        if s==S[i+1]:
            return i+1,i+2
    for i,s in enumerate(S[:-2]):
        if s==S[i+2]:
            return i+1,i+3
    return -1,-1

S=input()
print(*solve(S))

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

int main()
{
	string o, e;
	cin >> o >> e;
	for(int s = 0, t = 0; s < o.size(); ++s, ++t){
		cout << o[s];
		if(t < e.size()) cout << e[t];
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<string>

using namespace std;

int main(void) {

	string x, y;

	cin >> x >> y;

	if (x > y)cout << ">\n";
	else if (x == y)cout << "=\n";
	else cout << "<\n";

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#define N 3001

int flag[N][N], dp[N][N];
char s1[N], s2[N];
void LCS() {
	memset(dp, 0, sizeof(dp));
	memset(flag, 0, sizeof(flag));
    int n = strlen(s1), m = strlen(s2);
    for (int i = 1; i <= n; i++)
		for (int j = 1; j <= m; j++) {
			if (s1[i - 1] == s2[j - 1]) dp[i][j] = dp[i - 1][j - 1] + 1, flag[i][j] = 0 ;
			else if (dp[i - 1][j] >= dp[i][j - 1]) dp[i][j] = dp[i - 1][j], flag[i][j] = 1 ;
			else dp[i][j] = dp[i][j - 1], flag[i][j] = -1 ;
    }
}
void PrintLCS(int i, int j) {
    if (i == 0 || j == 0) return ;
    if (flag[i][j] == 0) {
        PrintLCS(i - 1,j - 1) ;
		std::cout << s1[i - 1] ;
    }
    else if (flag[i][j] == 1) PrintLCS(i - 1, j) ;
    else PrintLCS(i, j - 1) ;
}
int main(){
	std::cin >> s1 >> s2 ;
    LCS() ;
    PrintLCS(strlen(s1), strlen(s2)) ;
    return 0 ;
}


Measured memory_bytes: 70656
#include<iostream>
#include<string>
#include<vector>
#include<cmath>
using namespace std;

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

    double x;
    cin >> x;
    for(double i = -100; i <= 500; ++i) {
        for(double j = -100; j <= 500; ++j) {
            if(pow(i, 5) - pow(j, 5) == x) {
                cout << i << ' ' << j << endl;
                return 0;
            }
        }
    }
}

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

int main(){
 string S;
 cin >> S;
 vector<int> n(4);
   for(int i=0;i<4;i++){
    n[i]=S[i]-'0';
   }
 vector<char> h(3);
 int sum;
  for(int i=0;i<8;i++){
    sum=n[0];
    for(int j=0;j<3;j++){
      if(i & (1 << j)){
        h[j]='+';
        sum+=n[j+1];
      }
      else{
        h[j]='-';
        sum-=n[j+1];
      }
    }
    if(sum==7){
      break;
    }
  }

  cout << n[0] <<h[0]<< n[1] <<h[1] <<n[2] <<h[2] << n[3] <<"=7" << endl;
}


Measured memory_bytes: 256
<?php

fscanf(STDIN, "%d", $n);
$A = array_map('intval', explode(' ', trim(fgets(STDIN))));
$B = array_map('intval', explode(' ', trim(fgets(STDIN))));

$sum = 0;
for ($i = 0; $i < $n; ++$i) {
    $left = min($A[$i], $B[$i]);
    $A[$i] -= $left;
    $B[$i] -= $left;
    $sum += $left;

    $right = min($A[$i + 1], $B[$i]);
    $A[$i + 1] -= $right;
    $B[$i] -= $right;
    $sum += $right;
}

echo $sum;


Measured memory_bytes: 20976
class UnionFind:
    def __init__(self, n):
        self.n = n
        self.par = [i for i in range(n+1)]  # �?要�?の親要�?の番号を�?�納するリス�?
        self.rank = [0] * (n+1)
        self.size = [1] * (n+1)  # 根?��ルート）�?�場合、そのグループ�?�要�?数を�?�納するリス�?

    # 要�? x が属するグループ�?�根を返す
    def find(self, x):
        if self.par[x] == x:
            return x
        else:
            self.par[x] = self.find(self.par[x])
            return self.par[x]

    # 要�? x が属するグループと要�? y が属するグループとを併合す�?
    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if x == y:
            return
        if self.rank[x] < self.rank[y]:
            self.par[x] = y
            self.size[y] += self.size[x]
        else:
            self.par[y] = x
            self.size[x] += self.size[y]
            if self.rank[x] == self.rank[y]:
                self.rank[x] += 1

    # 要�? x, y が同じグループに属するかど�?かを返す
    def same_check(self, x, y):
        return self.find(x) == self.find(y)
    
    # 要�? x が属するグループに属する要�?をリストで返す
    def members(self, x):
        root = self.find(x)
        return [i for i in range(1,self.n+1) if self.find(i) == root]

    # 要�? x が属するグループ�?�サイズ?��要�?数?��を返す
    def get_size(self, x):
        return self.size[self.find(x)]

    # すべての根の要�?をリストで返す
    def roots(self):
        return [i for i, x in enumerate(self.par) if x == i and i != 0]
    
    # グループ�?�数を返す
    def group_count(self):
        return len(self.roots())
    
    # {ルート要�?: [そ�?�グループに含まれる要�?のリス�?], ...} の辞書を返す
    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}
    
n,q = map(int,input().split())
uf = UnionFind(n)
for i in range(q):
    p,a,b = map(int,input().split())
    if p:
        print(1 if uf.same_check(a,b) else 0)
        continue
    else:
        uf.union(a,b)

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

def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

GCD=[]
GCD_INV=[]


x=A[0]
for a in A:
    x=gcd(x,a)
    GCD.append(x)

x=A[-1]
for a in A[::-1]:
    x=gcd(x,a)
    GCD_INV.append(x)

GCD_INV=GCD_INV[::-1]
    
ANS=max(GCD[-2],GCD_INV[1])

for i in range(1,N-1):
    ANS=max(ANS,gcd(GCD[i-1],GCD_INV[i+1]))

print(ANS)


Measured memory_bytes: 14428
<?php
fscanf(STDIN, '%d', $n);
$x = array_map('intval', explode(' ', trim(fgets(STDIN))));

$x_max = 0;
for ($i = 0; $i < $n; $i++) {
    $x_max = max($x[$i], $x_max);
}
$hp_min = (100 ** 2) * 100;
for ($p = 1; $p <= $x_max; $p++) {
    $hp = 0;
    for ($i = 0; $i < $n; $i++) {
        $hp += ($x[$i] - $p) ** 2;
    }
    $hp_min = min($hp, $hp_min);
}
echo $hp_min . PHP_EOL;

Measured memory_bytes: 4856
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner stdIn = new Scanner(System.in);

        int x = stdIn.nextInt();
        int a = stdIn.nextInt();

        if(x<a){
            System.out.println(0);
        }else{
            System.out.println(10);
        }
    }
}

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

int main(void) {
  int n, m, k;
  cin >> n >> m >> k;
  vector<ll> aSum(n + 1, 0), bSum(m + 1, 0);
  rep(i, n) {
    ll a;
    cin >> a;
    aSum[i + 1] = aSum[i] + a;
  }
  rep(i, m) {
    ll b;
    cin >> b;
    bSum[i + 1] = bSum[i] + b;
  }
  int ans = 0;
  int bPos = m;
  for (int i = 0; i <= n; i++) {
    if (aSum[i] > k) break;
    for (; bPos > 0; bPos--) {
      if (bSum[bPos] + aSum[i] <= k) {
        break;
      }
    }
    ans = max(ans, i + bPos);
  }

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

Measured memory_bytes: 6364
a=input()

b = int(a[:2])
c = int(a[2:])

if 0< b < 13:
    a_month_flag = 1
    a_year_flag = 1
elif b == 0:
    a_month_flag = 0
    a_year_flag = 0
else:
    a_month_flag = 0
    a_year_flag = 1

if 0< c < 13:
    b_month_flag = 1
    b_year_flag = 1
elif c == 0:
    b_month_flag = 0
    b_year_flag = 0
else:
    b_month_flag = 0
    b_year_flag = 1

if a_month_flag ==1 and b_month_flag==1:
    print("AMBIGUOUS")
elif a_month_flag == 1 and b_month_flag == 0:
    print("MMYY")
elif a_month_flag == 0 and b_month_flag ==1:
    print("YYMM")
else:
    print("NA")

Measured memory_bytes: 9140