akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
const int64_t mod=1e9+7;
std::vector<vector<int64_t>> comb(2010);

int main()
{
  int64_t n,k;
  cin>>n>>k;
  comb[1]={1,1};
  for (int i = 2; i < 2010; ++i)
  {
    comb[i].resize(i+1);
    comb[i][0]=comb[i][i]=1;
    for (int j = 1; j < i; ++j)
    {
      comb[i][j]=comb[i-1][j-1]+comb[i-1][j];
      comb[i][j]%=mod;
    }
  }
  for (int i = 1; i <= k; ++i)
  {
    if(i==1) cout<<n-k+1<<endl; 
    else if(i>n-k+1) cout<<0<<endl;
	else cout<<comb[k-1][i-1]*comb[n-k+1][i]%mod<<endl;
  }
}

Measured memory_bytes: 16128
#include <iostream>
#include <vector>
using namespace std;
int main() {
	int H, W, A, B;
	cin >> H >> W >> A >> B;
	A = A == 0 ? W - A : A;
	B = B == 0 ? H - B : B;
	for (int i = 0; i < H; i++) {
		for (int j = 0; j < W; j++)  cout << ((i < B&& j < A) || (i >= B && j >= A) ? 1 : 0);
		cout << endl;
	}
}


Measured memory_bytes: 1280
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
# input=lambda :sys.stdin.readline().rstrip()
def resolve():
    s=input()
    if s=="Sunny":
        print("Cloudy")
    elif s=="Cloudy":
        print("Rainy")
    else:
        print("Sunny")
resolve()

Measured memory_bytes: 38384
#include <bits/stdc++.h>
using namespace std;
// type alias
typedef long long LL;
typedef pair<int,int> II;
typedef tuple<int,int,int> III;
typedef vector<int> VI;
typedef vector<string> VS;
typedef unordered_map<int,int> MAPII;
typedef unordered_set<int> SETI;
template<class T> using VV=vector<vector<T>>;
// minmax
template<class T> inline T SMIN(T& a, const T b) { return a=(a>b)?b:a; }
template<class T> inline T SMAX(T& a, const T b) { return a=(a<b)?b:a; }
// repetition
#define FORE(i,a,b) for(int i=(a);i<=(b);++i)
#define REPE(i,n)  for(int i=0;i<=(n);++i)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  for(int i=0;i<(n);++i)
#define FORR(x,arr) for(auto& x:arr)
#define SZ(a) int((a).size())
// collection
#define ALL(c) (c).begin(),(c).end()
// DP
#define MINUS(dp) memset(dp, -1, sizeof(dp))
#define ZERO(dp) memset(dp, 0, sizeof(dp))
// stdout
#define println(args...) fprintf(stdout, ##args),putchar('\n');
// debug cerr
template<class Iter> void __kumaerrc(Iter begin, Iter end) { for(; begin!=end; ++begin) { cerr<<*begin<<','; } cerr<<endl; }
void __kumaerr(istream_iterator<string> it) { (void)it; cerr<<endl; }
template<typename T, typename... Args> void __kumaerr(istream_iterator<string> it, T a, Args... args) { cerr<<*it<<"="<<a<<", ",__kumaerr(++it, args...); }
template<typename S, typename T> std::ostream& operator<<(std::ostream& _os, const std::pair<S,T>& _p) { return _os<<"{"<<_p.first<<','<<_p.second<<"}"; }
#define __KUMATRACE__ true
#ifdef __KUMATRACE__
#define dump(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); __kumaerr(_it, args); }
#define dumpc(ar) { cerr<<#ar<<": "; FORR(x,(ar)) { cerr << x << ','; } cerr << endl; }
#define dumpC(beg,end) { cerr<<"~"<<#end<<": "; __kumaerrc(beg,end); }
#else
#define dump(args...)
#define dumpc(ar)
#define dumpC(beg,end)
#endif

// $ cp-batch AC | diff AC.out -
// $ g++ -std=c++14 -Wall -O2 -D_GLIBCXX_DEBUG -fsanitize=address AC.cpp && ./a.out

/*
 
 5/3/2020
 
 5:00-
 
 */

string S;

void solve() {
  cout<<(S=="ABC"?"ARC":"ABC")<<endl;
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout<<setprecision(12)<<fixed;
  
  cin>>S;
  solve();
  
  return 0;
}


Measured memory_bytes: 3640
C = [list(map(int, input().split())) for _ in range(3)]


import sys
min_a1 = min(C[0])
min_a2 = min(C[1])
min_a3 = min(C[2])

for a1 in range(min_a1+1):
    b1_a1 = C[0][0] - a1
    b2_a1 = C[0][1] - a1
    b3_a1 = C[0][2] - a1
    for a2 in range(min_a2+1):
        b1_a2 = C[1][0] - a2
        b2_a2 = C[1][1] - a2
        b3_a2 = C[1][2] - a2
        for a3 in range(min_a3+1):
            b1_a3 = C[2][0] - a3
            b2_a3 = C[2][1] - a3
            b3_a3 = C[2][2] - a3

            if b1_a1 == b1_a2 == b1_a3 and b2_a1 == b2_a2 == b2_a3 and b3_a1 == b3_a2 == b3_a3:
                print('Yes')
                sys.exit()

print('No')




Measured memory_bytes: 39408
using System;
using System.Runtime.Remoting.Metadata.W3cXsd2001;

namespace Program
{
    public class Program
    {
        private static String res = "";
        public static void Main(String[] args)
        {
            foreach (var c in toCharArray())
            {
                if (c == '0')
                {
                    res += '0';
                }
                else if (c == '1')
                {
                    res += '1';
                }
                else if (c == 'B' && !res.Equals(""))
                {
                    res = res.Substring(0, res.Length - 1);
                }
            }

            Console.WriteLine(res);
        }

        static int nextInt()
        {
            return int.Parse(Console.ReadLine());
        }

        static char[] toCharArray()
        {
            return Console.ReadLine().ToCharArray();
        }
    }
}

Measured memory_bytes: 2648
#include <bits/stdc++.h>
using namespace std;
int dp[4][100001] = {-1};
int n;

int f(int ch, int i, int a[], int b[], int c[]) {
	if(i>=n)
	return 0;
	if(ch!=3)
	if(dp[ch][i]!=-1)
	return dp[ch][i];
	
	int ans = 0;
	if(ch!=0)
	ans = max(ans, a[i] + f(0, i+1, a, b, c));
	if(ch!=1)
	ans = max(ans, b[i] + f(1, i+1, a, b, c));
	if(ch!=2)
	ans = max(ans, c[i] + f(2, i+1, a, b, c));
	
	dp[ch][i] = ans;
	return ans;
}

int main() {
	cin>>n;
	int a[n],  b[n], c[n];
	for(int i=0; i<n; ++i) {
		cin>>a[i]>>b[i]>>c[i];
		dp[0][i]=-1;
		dp[1][i]=-1;
		dp[2][i]=-1;
	}
	cout<<f(3, 0, a, b, c);
	return 0;
}

Measured memory_bytes: 13772
#include <bits/stdc++.h>
using namespace std;
int n, m;
int A[1010];


int main() {
	while(cin >> n >> m, n) {
		for (int i = 0; i < n; i++) {
			cin >> A[i];
		}
		int ans = 0;
		for (int i = 0; i < n; i++) {
			for(int j = 0; j < n; j++) {
				if (i == j) continue;
				if (A[i] + A[j] <= m){
					ans = max(ans, A[i] + A[j]);
				}
			}
		}
		if (ans == 0) {
			cout << "NONE" << endl;
		} else {
			cout << ans << endl;
		}
	}
}


Measured memory_bytes: 3028
n = int(input())

def divisor(n):
    fac = []
    for i in range(1,int(n**0.5)+1):
        if n%i == 0: 
            fac.append(i)
            if i*i != n: fac.append(n//i)
    return sorted(fac)

ans = len(divisor(n-1))-1
lst2 = divisor(n)
for i in lst2:
    tmp = n
    if i == 1: continue
    while tmp%i == 0: tmp //= i
    if tmp%i == 1: ans += 1

print(ans)

Measured memory_bytes: 3316
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<algorithm>
#include<cmath>
#include<queue>
#include<vector>
#include<ctime>
#include<map>
#include<bitset>
#include<set>
#include<assert.h>
#include<chrono>
#include<random>
#define LL long long
#define mp(x,y) make_pair(x,y)
#define pll pair<long long,long long>
#define pii pair<int,int>
#define SZ(x) ((int)x.size())
using namespace std;
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
inline LL read()
{
	LL f=1,x=0;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	return x*f;
}
int stack[20];
template<typename T>inline void write(T x)
{
	if(x<0){putchar('-');x=-x;}
    if(!x){putchar('0');return;}
    int top=0;
    while(x)stack[++top]=x%10,x/=10;
    while(top)putchar(stack[top--]+'0');
}
template<typename T>inline void pr1(T x){write(x);putchar(' ');}
template<typename T>inline void pr2(T x){write(x);putchar('\n');}
template<typename T>inline void chkmin(T &x,T y){x=x<y?x:y;}
template<typename T>inline void chkmax(T &x,T y){x=x>y?x:y;}
const int MAXN=500005;
int n,D,d[MAXN],f[MAXN],p[MAXN];
int main()
{
	n=read();D=read();
	for(int i=1;i<=n;i++)d[i]=read();f[n+1]=1;
	for(int i=n;i>=1;i--)
	{
		if(abs(f[i+1]-d[i])>=f[i+1])f[i]=f[i+1];
		else f[i]=f[i+1]+d[i];
	}p[0]=D;
	for(int i=1;i<=n;i++)
	{
		if(abs(p[i-1]-d[i])<=p[i-1])p[i]=abs(p[i-1]-d[i]);
		else p[i]=p[i-1];
	}
	int Q=read();while(Q--)
	{
		int x=read();
		puts(p[x-1]>=f[x+1]?"YES":"NO");
	}
	return 0;
}



Measured memory_bytes: 7808
package main

import (
	"fmt"
)

func main() {
	var s string
	fmt.Scan(&s)

	for len(s) > 0 {
		if s[len(s)-5:] == "erase" || s[len(s)-5:] == "dream" {
			s = s[:len(s)-5]
			continue
		}
		if s[len(s)-6:] == "eraser" {
			s = s[:len(s)-6]
			continue
		}
		if s[len(s)-7:] == "dreamer" {
			s = s[:len(s)-7]
			continue
		}
		fmt.Println("NO")
		return
	}
	fmt.Println("YES")

}


Measured memory_bytes: 1280
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
//#define ll long long
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
#define rep(i, n) REP(i, 0, n)
#define rep_rev(i, n) for (int (i) = (int)(n) - 1 ; (i) >= 0 ; --(i))
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
#define all(x) (x).begin(),(x).end()
ll t1,t2,t3;
const ll mod = 1000000007;
const int INF = 1e9;
const ll INFLONG = 1e18;



int main(){
  ll n,m;
  cin >> n >> m;
  vector<ll> cou(n,1);
  vector<ll> h(n,0);
  rep(i,n){
    cin >> h[i];
  }

  rep(i,m){
    cin >> t1 >> t2;
    t1--;
    t2--;
    if(h[t1] < h[t2]){
      cou[t1] = 0;
    }else if(h[t1] == h[t2]){
      cou[t1] = 0;
      cou[t2] = 0;
    }else{
      cou[t2] = 0;
    }
  }
  ll ans = 0;
  rep(i,n){
    ans += cou[i];
  }
  cout << ans << endl;
}

Measured memory_bytes: 4848
using System;
using System.Linq;
class Program
{
    public static void Main()
    {
        char[] alp = "abcdefghijklmnopqrstuvwxyz".ToCharArray();
        char[] s = Console.ReadLine().ToCharArray();
        bool f = false;
        for (int i = 0; i < alp.Length; i++)
        {
            if (!(s.Any(a => a == alp[i])))
            {
                Console.WriteLine(alp[i]);
                f = true;
                break;
            }
        }
        if (!f)
            Console.WriteLine("None");
    }
}

Measured memory_bytes: 11488
/// In the name of ALLAH
/// I'm THEOVE46
#include<bits/stdc++.h>
using namespace std;

#define gap             " "
#define nn              "\n"
#define pi              2*acos(0.0)
#define db              double
#define ft              float
#define ll              long long
#define ull             unsigned long long
#define pf              printf
#define sf              scanf
#define ff              first
#define ss              second
#define sc(n)           sf("%d",&n)
#define sc2(n, m)       sf("%d%d",&n,&m);
#define scl(n)          sf("%lld",&n)
#define scl2(n, m)      sf("%lld%lld",&n,&m);
#define pc(n)           pf("%d",n)
#define scf(f)          sf("%f",&f)
#define pcf(f)          pf("%f",f)
#define bfs             cin.get()
#define bfc             getchar()
#define gl(s)           getline(cin, s);
#define loop(a,n)       for(ll i=a; i<n; i++)
#define rloop(a,n)      for(ll i=a; i>n; i--)
#define tloop(test)     for(ll tl=1; tl<=test; tl++)
#define case1(z)        cout<<"Case "<<z<<": "
#define case2(z)        printf("Case %d: ",z)
#define vi              vector<int>
#define vl              vector<ll>
#define vld(vc,rw)      vector<vector<ll> >vc(rw)
#define pii             pair<int,int>
#define pll             pair<ll,ll>
#define pis             pair<int,string>
#define psi             pair<string,int>
#define mls             map <ll,string>
#define msl             map <string,ll>
#define mll             map <ll,ll>
#define mp              make_pair
#define pb              push_back
#define itr             vector<int> :: iterator
#define sz(s)           s.size()
#define sl(s)           s.length()
#define Sort(s)         sort(s.begin(), s.end());
#define SortR(s)        sort(s.rbegin(), s.rend());
#define all(x)          x.begin(),x.end()
#define rall(x)         x.end(), x.begin()
#define MEM(ar,val)     memset(ar, (val), sizeof(ar))
#define IN(A,B,C)       assert(B<=A && A<=C)
#define EPS             1e-9
#define bug1            "**1**"
#define bug2            "****2****"
#define artri(b,h)      0.5*b*h
#define artrap(b1,b2,h) (b1+b2)/2*h
#define arcrl(r)        pi*r*r
#define vlsyl(r,h)      pi*r*r*h
#define vlcone(r,h)     pi*r*r*(h/3)
#define vlsph(r)        (4/3)*pi*r*r*r
#define flush           fflush(stdout);
#define pcn(dg,val)     fixed << setprecision(dg) << val
#define fap(x)          cout << __LINE__ << " says: " << #x << " = " << x << "\n"
#define FastIO          ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define showsort(n, a)  for(int i=0; i<n; i++) cout << a[i] << gap; cout << endl;

///THEOVE46

int main()
{
    FastIO;
    string a;
    cin >> a;
    if(a[0]>='a' && a[0]<='z') cout << "a" << endl;
    else cout << "A" << endl;
    return 0;
}

///   check for integer overflow, array bounds
///   check for n=1
///   - - - The Ove 46



Measured memory_bytes: 3648
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <cmath>
#include <tuple>
#include <cstdio>
#include <bitset>
#include <sstream>
#include <iterator>
#include <numeric>
#include <map>
#include <cstring>

using namespace std;

#define DEBUG_ //!!提出時にコメントアウト!!
#ifdef DEBUG_
	#define dump(x)  cerr << #x << " = " << (x) << endl;
#else
	#define dump(x)  ; //何もしない文
#endif

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define SZ(x) ((int)(x).size()) //unsignedのサイズをint型に変換
#define pb push_back

typedef long long LL; 
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;

template <typename T>
std::string printVector(const std::vector<T> &data)
{
    std::stringstream ss;
    std::ostream_iterator<T> out_it(ss, ", ");
    ss << "[";
    std::copy(data.begin(), data.end() - 1, out_it);
    ss << data.back() << "]";
    return ss.str();
}

const int MOD = 1e9+7;
const LL LINF = 1001002003004005006ll;
const int INF = 1001001001;

int main(int argc, char const *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);	
    int S; cin >> S;
    int A,B,C,D;
    A = S/1000; S -= A * 1000;
    B = S/100; S -= B * 100;
    C = S/10; S -= C * 10;
    D = S;

    if(A + B + C + D == 7)
    {
        cout<<A<<"+"<<B<<"+"<<C<<"+"<<D<<"=7"<<endl;
        return 0;
    }
    if(A + B + C - D == 7)
    {
        cout<<A<<"+"<<B<<"+"<<C<<"-"<<D<<"=7"<<endl;
        return 0;
    }
    if(A + B - C + D == 7)
    {
        cout<<A<<"+"<<B<<"-"<<C<<"+"<<D<<"=7"<<endl;
        return 0;
    }
    if(A + B - C - D == 7)
    {
        cout<<A<<"+"<<B<<"-"<<C<<"-"<<D<<"=7"<<endl;
        return 0;
    }
    if(A - B + C + D == 7)
    {
        cout<<A<<"-"<<B<<"+"<<C<<"+"<<D<<"=7"<<endl;
        return 0;
    }
    if(A - B + C - D == 7)
    {
        cout<<A<<"-"<<B<<"+"<<C<<"-"<<D<<"=7"<<endl;
        return 0;
    }
    if(A - B - C + D == 7)
    {
        cout<<A<<"-"<<B<<"-"<<C<<"+"<<D<<"=7"<<endl;
        return 0;
    }
    if(A - B - C - D == 7)
    {
        cout<<A<<"-"<<B<<"-"<<C<<"-"<<D<<"=7"<<endl;
        return 0;
    }

    




}


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

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

    if(a + b > c + d) cout << "Left" << endl;
    else if(a + b < c + d) cout << "Right" << endl;
    else cout << "Balanced" << endl;

}

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

int main(){

	int n;
	int i;
	int max=0;
	int sum=0;
	int a[10];

	cin >> n;
	
	for(i=0;i<n;i++){
		cin >> a[i];
		
		if(a[i]>max)
			max=a[i];
		
		sum+=a[i];
	}
		
	if(max>=(sum-max))
		cout << "No" << endl;
	
	else
		cout << "Yes" << endl;
	
	return 0;
}


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

int main(){
  long int N, n;
  cin >> N;
  n = N;
  long int A, B, A_, B_, mini, minj;
  A_, B_ = N;
  
  for(int i=1;i <= int(std::sqrt(N)+2);i++){
    if(N%i == 0){
      A = i;
      B = N/i;
      if(A+B < A_+B_){
        mini = A;
        minj = B;
      }
      A_ = A;
      B_ = B;
    }
  }
  
  cout << (mini + minj - 2) << endl;
  
  return 0;
}

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

int main()
{
    ll n; cin>>n;
    vector <string> a(n);
    for(int i=0;i<n;i++)
    {
        string s; cin>>s;
        sort(s.begin(),s.end());
        a[i]=s;
    }
    sort(a.begin(),a.end());

    ll cnt=1,ans=0;

    for(int i=1;i<n;i++)
    {
        if(a[i]==a[i-1]) cnt++;
        else
        {
            ans+=(cnt*(cnt-1))/2;
            cnt=1;
        }
    }
    ans+=(cnt*(cnt-1))/2;
    cout<<ans;
}


Measured memory_bytes: 5760
import java.util.Scanner;

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

        int count = 0;
        switch(s){
            case "RSS":
            case "SRS":
            case "SSR":
            case "RSR":
                count = 1;
                break;
            case "RRS":
            case "SRR":
                count = 2;
                break;
            case "RRR":
                count = 3;
                break;
        }
        System.out.println(count);
    }
}

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

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef vector<ld> vd;
typedef vector<ll> vll;
typedef vector<string> vstr;
typedef vector<vector<ll>> vvll;
typedef vector<pair<ll, ll>> vpll;
typedef priority_queue<ll, vector<ll>, greater<ll>> spqll;  // 小さい順に取り出し
typedef priority_queue<ll, vector<ll>, less<ll>> bpqll;     // 大きい順に取り出し

#define REP(i, n) for (ll i = 0; i < (ll)(n); i++)
#define FOR(i, a, b) for (ll i = (ll)a; i < (ll)b; i++)
#define IREP(i, v) for (auto i = (v).begin(); i != (v).end(); i++)
#define FI first
#define SE second
#define MP make_pair
#define MT make_tuple
#define PB push_back
#define TS to_string
#define NP next_permutation
#define ALL(v) (v).begin(), (v).end()
#define SZ(x) (ll) x.size()
#define SP(x) setprecision((ll)x)


ll INF = 1e9;
ll MOD = 1000000007;
ll LINF = 1e18;
ld EPS = 1e-9;
ld PI = M_PI;
vll dx = {1, 0, -1, 0, 1, -1, -1, 1};
vll dy = {0, 1, 0, -1, 1, 1, -1, -1};
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a;} //最大公約数
ll lcm(ll a, ll b) { return a / gcd(a, b) * b;}     //最小公倍数

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

//-----------------------------------------
int n;
ld p1(vd &x, vd &y){
  ld res = 0;
  REP(i,n) res += abs(x[i]-y[i]);
  return res;
}

ld p2(vd &x, vd &y){
  ld res = 0;
  REP(i,n) res += (x[i]-y[i]) * (x[i]-y[i]);
  return sqrt(res);
}

ld p3(vd &x, vd &y){
  ld res = 0;
  REP(i,n) res += abs( (x[i]-y[i]) * (x[i]-y[i]) * (x[i]-y[i]) );
  return pow(res,1.0/3.0);
}

ld pi(vd &x, vd &y){
  ld res = 0;
  REP(i,n) res = max(res,abs(x[i]-y[i]));
  return res;
}
//-----------------------------------------

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);

  cin >> n;
  vd x(n);
  vd y(n);
  REP(i,n) cin >> x[i];
  REP(i,n) cin >> y[i];
  cout << p1(x,y) <<endl;
  cout << p2(x,y) <<endl;
  cout << p3(x,y) <<endl;
  cout << pi(x,y) <<endl;


  return 0;
}



Measured memory_bytes: 3416
#include<bits/stdc++.h>
#define ll long long
#define here cout<<"here\n"
#define pb push_back
#define mp make_pair
#define si(x) scanf("%d",&x)
#define sl(x) scanf("%lld",&x)
#define pf printf
#define pfi(x) printf("%d\n",x)
#define pfl(x) printf("%lld\n",x)
using namespace std;

const ll mod = 1e9+7;

const int MAX = 100005;

ll modexp(ll x, ll n)
{
    if(n==0)
        return 1LL;
    if(n%2==0)
    {
        ll y = modexp(x,n/2)%mod;
        return (y*y)%mod;
    }
    return (x*modexp(x,n-1)%mod)%mod;
}

ll powr(ll x, ll n)
{
    ll ans = 1;
    for(int i=1;i<=n;i++)
        ans=ans*x;
    return ans;
}

int main()
{
    map<string,string> m;
    m["Sunny"] = "Cloudy";
    m["Cloudy"] = "Rainy";
    m["Rainy"] = "Sunny";
    string s;
    cin>>s;
    cout<<m[s]<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main() {
	int x,a,b,c,t=0;
	scanf("%d%d%d%d",&a,&b,&c,&x);
	for(int i=0; i<=a; i++)
		for(int j=0; j<=b; j++)
			for(int k=0; k<=c; k++) {
				if(i*500+j*100+k*50==x) t++;
			}
	printf("%d\n",t);
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
using namespace std;
typedef long long ll;

ll n, r, g, b, rg, rb, gb, ans=1, M=998244353;
string s;
int main() {
	cin >> n >> s;
	for(char x:s) {
		if(x=='R') {
			if(gb) ans *= gb--;
			else if(g) ans *= g--, rg++;
			else if(b) ans *= b--, rb++;
			else r++;
		}
		if(x=='G') {
			if(rb) ans *= rb--;
			else if(r) ans *= r--, rg++;
			else if(b) ans *= b--, gb++;
			else g++;
		}
		if(x=='B') {
			if(rg) ans *= rg--;
			else if(r) ans *= r--, rb++;
			else if(g) ans *= g--, gb++;
			else b++;
		}
		ans %= M;
	}
	for(ll i=1; i<=n; i++) (ans *= i) %= M;
	cout << ans;
	return 0;
}

Measured memory_bytes: 900
/*
#include<rabbit>;
using blueHulkStress;
using AceOfSpades;
*/
#include<bits/stdc++.h>
#include<stdio.h>
using namespace std;
const double PI = acos(-1.0);
const double EPS = (1e-9);
typedef long long ll;
typedef unsigned long long ull;
#define flush fflush(stdout), cout.flush()
#define all(v) ((v).begin()),((v).end())
#define rall(v) ((v).rbegin()),((v).rend())
#define clr(v,line) memset(v,line,sizeof(v))
#define rep(i,n) for(int(i)=0;(i)<(int)(n);(i)++)
#define vi vector<int>
#define vll vector<ll>
#define pii pair<int,int>
#define pll pair<ll,ll>
#define lcm(a,b) (a*(b/__gcd(a,b)))
#define P 1000000007
#define endl '\n'
const int dx[] = {1,-1,0,0,1,-1,1,-1};
const int dy[] = {0,0,1,-1,1,-1,-1,1};
const int dxhorse[] = {-2,-2,-1,-1,1,1,2,2};
const int dyhorse[] = {1,-1,2,-2,2,-2,1,-1};

int n, k;

vi v[20];

double cacl(int r, int c)
{
	ll sum = 0;
	for(int i=0; i<k;i++)
		sum+=(v[r][i] - v[c][i]) * (v[r][i] - v[c][i]);
	return sqrt(sum);
}
int main(int argc, char const *argv[])
{
	
	
	cin>>n>>k;

	for (int i = 0; i < n; ++i)
	{
		v[i].resize(k);
		rep(j,k)cin>>v[i][j];
	}
	ll ans = 0;

	for (int i = 0; i < n - 1; ++i)
	{
		for(int j = i+1; j<n; j++)
		{
			double ret = cacl(i,j);
			ans+=ret == int(ret);
		}
	}
	cout<<ans;
}	

Measured memory_bytes: 256
main=do
    line1<-getLine
    let forecast=line1
    line2<-getLine
    let realWeather=line2
    print $ score $ zip forecast realWeather
score :: [(Char,Char)]->Int
score [] = 0
score (x:xs) 
    | fst x == snd x = 1 + score xs
    | otherwise = score xs


Measured memory_bytes: 380
#include<bits/stdc++.h>
	using namespace std;
	int  m[1000000];
	vector<int>h;
	int n;
	int fun(int i)
	{
	  if(i==n-1)
	   return 0;
	   
	   if(m[i]!=-1)
	      return m[i];
	      
	      int ans=fun(i+1)+abs(h[i]-h[i+1]);
	      if(i+2<n)
	      ans=min( ans , fun(i+2)+abs(h[i]-h[i+2]) );
	
	
         return m[i]=ans;	
	
	}
	
	
	
	int main()
	{
		ios_base::sync_with_stdio(false);
		cin.tie(NULL);
		cout.tie(NULL);
		
	    memset(m, -1, sizeof(m));	
	
		cin>>n;
		h.resize(n);
		for(int i=0;i<n;i++)
		 cin>>h[i];
		 
		 int ans=fun(0);
		 cout<<ans<<endl;
	
	return 0;
	}


Measured memory_bytes: 9216
inp = input().split(" ")
h = int(inp[0])
w = int(inp[1])

grid = []

for i in range(h):
	grid.append(list(input()))

for i in range(h):
	for j in range(w):
		c = grid[i][j]
		if c == ".":
			total = 0
			adj = []
			if i > 0:
				adj.append(grid[i-1][j])
			if j > 0:
				adj.append(grid[i][j-1])
			if i < h-1:
				adj.append(grid[i+1][j])
			if j < w-1:
				adj.append(grid[i][j+1])
			if i > 0 and j > 0:
				adj.append(grid[i-1][j-1])
			if i > 0 and j < w-1:
				adj.append(grid[i-1][j+1])
			if i < h-1 and j > 0:
				adj.append(grid[i+1][j-1])
			if i < h-1 and j < w-1:
				adj.append(grid[i+1][j+1])
			for k in adj:
				if k == "#":
					total += 1
			grid[i][j] = str(total)

for i in grid:
	print("".join(i))

Measured memory_bytes: 3188
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  int A;
  int B;
  int C;
  int D;
  
  cin >> N;
  
  A = N / 1000;
  B = N / 100 - A * 10;
  C = N / 10 - A * 100 - B * 10;
  D = N - A * 1000 - B * 100 - C * 10;
  
  if (A != B) {
    if(B != C){
      cout << "No" << endl;
    }else if(C != D){
      cout << "No" << endl;
    }else{
      cout << "Yes" << endl;
    }
  }else if(B != C){
    cout << "No" << endl;
  }else{
    cout << "Yes" << endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
struct BIT {
  vector<int> seg;
  vector<pair<int, int> > seq;
  BIT(int n) { seg.resize(n + 1); }
  void modify(int pos, int x)
  {
    for (; pos < seg.size(); pos += pos & -pos) {
      seq.emplace_back(pos, seg[pos]);
      seg[pos] = max(seg[pos], x);
    }
  }
  int query(int pos)
  {
    int res = INT_MIN;
    pos = min(pos, (int)seg.size() - 1);
    for (; pos; pos -= pos & -pos) {
      res = max(res, seg[pos]);
    }
    return res;
  }
  void pop(int x)
  {
    while (seq.size() > x) {
      seg[seq.back().first] = seq.back().second;
      seq.pop_back();
    }
  }
};
int main()
{
  do {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
  } while (false);
  int n, mn = INT_MAX;
  cin >> n;
  vector<int> arr(n), val(n);
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
    arr[i] = n - arr[i] + 1;
    val[i] = arr[i] < mn;
    mn = min(mn, arr[i]);
  }
  vector<int> sum(n + 1);
  vector<array<int, 2> > en(n);
  vector<BIT> seg(2, BIT(n));
  for (int i = n - 1; i >= 0; i--) {
    sum[i] = sum[i + 1] + val[i];
    array<int, 2> tmp;
    for (int j = 0; j < 2; j++) {
      tmp[j] = max(0, seg[j].query(arr[i]));
      en[i][j] = seg[j].seq.size();
    }
    for (int j = 0; j < 2; j++) {
      int x = tmp[j] + val[i] + 1;
      seg[x & 1].modify(arr[i], x);
    }
  }
  array<int, 2> lis = {n + 1, n + 1}, len = {0, 0};
  string ans;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < 2; j++) {
      seg[j].pop(en[i][j]);
    }
    for (int j = 0; j < 2; j++) {
      auto nxt_lis = lis, nxt_len = len;
      if (arr[i] < lis[j]) {
        nxt_lis[j] = arr[i];
        nxt_len[j]++;
      }
      bool ok = false;
      if (i == n - 1) {
        ok = nxt_len[0] == nxt_len[1];
      } else {
        for (int x = 0; x < 2; x++) {
          int goal = nxt_len[x] - nxt_len[x ^ 1] + sum[i + 1];
          if (goal >= 0 && seg[goal & 1].query(nxt_lis[x ^ 1]) >= goal) {
            ok = true;
          }
        }
      }
      if (ok) {
        ans += (char)(j + '0');
        lis = nxt_lis;
        len = nxt_len;
        break;
      }
    }
    if (ans.size() != i + 1) {
      cout << -1 << endl;
      return 0;
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 56148
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <numeric>

using namespace std;

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

    t.erase(s.size());

    if(s==t){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }

    return 0;
}

Measured memory_bytes: 3632
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <cassert>
#include <string>
#include <set>
#include <map>
#include <random>
#include <bitset>
#include <string>
#include <unordered_set>
#include <unordered_map>
#include <deque>
#include <queue>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define all(x) (x).begin(), (x).end()

using namespace std;
using ll = long long;
using ld = long double;

int main() {
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
	ios_base::sync_with_stdio(0); cin.tie(0);
	ll n, a, b;
	cin >> n >> a >> b;
	cout << min(a, b) << ' ' << max(a + b - n, 0ll);
}


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

int main(){
  string s;
  cin>>s;
  for(int i=0;i<s.size();i++){
    if(i%2==0){
      if(s[i]=='R'||s[i]=='U'||s[i]=='D') continue;
      else{
        cout<<"No"<<endl;
        return 0;
      }
    }else{
      if(s[i]=='L'||s[i]=='U'||s[i]=='D') continue;
      else{
        cout<<"No"<<endl;
        return 0;
      }
    }
  }
  cout<<"Yes"<<endl;
}

Measured memory_bytes: 384
#include<iostream>


using namespace std;

int main(){
  string s;

  cin >> s ;

  int flag = 1;
  for( int i = 1; i < 4; i++ ){
    if( s[0] != s[i] )flag = 0; 
  }
  if(flag) cout << "No "<< endl;
  else {
    if( (s[0] == s[1]) && ( s[2] == s[3] )) cout << "Yes" << endl;
    else if(( s[0] == s [2]) &&( s[1] == s[3] )) cout <<" Yes" << endl;
    else if( (s[0] == s[3] ) && ( s[1] == s[2] )) cout <<" Yes" << endl;
    else cout << "No"  << endl;
  }
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <queue>
#include <stack>
using namespace std;

int N, M;

int main() {
    cin >> N >> M;
    vector<int> match = {0, 2, 5, 5, 4, 5, 6, 3, 7, 6 };
    map<int, int> mp;
    
    vector<int> num;
    for (int i = 0; i < M; i++) {
        int n;
        cin >> n;
        if(mp[match[n]] < n) mp[match[n]] = n;
    }
    vector<int> dp(N + 1, -1e9);
    dp[0] = 0;
    for (int i = 2; i <= N; i++) {
        for (auto itr = mp.begin(); itr != mp.end(); ++itr) {
            int m = (*itr).first;
            if (i < m) continue;
            dp[i] = max(dp[i - m] + 1, dp[i]);
        }
    }
    //    cout << dp[N] << endl;
    for (int length = dp[N]; length > 0; --length) {
        int k = 0;
        for (auto itr = mp.begin(); itr != mp.end(); ++itr) {
            int m = (*itr).first;
            if (N < m) continue;
            if (dp[N - m] == length - 1 && mp[m] > k) {
                k = mp[m];
            }
        }
        N -= match[k];
        cout << k;
    }
    cout << endl;
}





Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <functional>
#include <sstream>
#include <string>
#include <utility>
#include <map>
#include <memory>
#include <set>
#include <vector>
#include <deque>
#include <list>
#include <stack>
#include <queue>

using namespace std;

class Edge
{
public:
  int w;
  int u;
  int v;
  Edge(){}
  Edge( int w, int u, int v ) : w(w), u(u), v(v) {}
  bool operator<( const Edge& rhs ) const { return w < rhs.w; }
};

class UnionFind
{
public:
  vector<int> par;
  vector<int> dep;
  UnionFind(){}
  UnionFind( int n ) : par(n), dep(n, 1)
  {
    for ( auto i = 0; i < n; ++i )
      par[i] = i;
  }
  int findSet( int x );
  void unite( int x, int y );
  bool same( int x, int y );
};

int UnionFind::findSet( int x )
{
  if ( par[x] != x )
    par[x] = findSet( par[x] );
  
  return par[x];
}

void UnionFind::unite( int x, int y )
{
  x = findSet( x );
  y = findSet( y );

  if ( x == y ) return;

  if ( dep[x] < dep[y] )
    {
      par[x] = y;
      dep[y] += dep[x];
    }
  else
    {
      par[y] = x;
      dep[x] += dep[y];
    }
}

bool UnionFind::same( int x, int y )
{
  return findSet( x ) == findSet( y );
}

int main()
{
  int nv, ne;
  cin >> nv >> ne;

  vector<Edge> edg( ne );
  
  for ( auto i = 0; i < ne; ++i )
    {
      int u, v, w;
      cin >> u >> v >> w;
      edg[i].u = u;
      edg[i].v = v;
      edg[i].w = w;
    }
  
  sort( edg.begin(), edg.end());

  UnionFind uf( nv );
  
  int mintw = 0;
  
  for ( auto i = 0; i < ne; ++i )
    {
      Edge e = edg[i];
      
      if ( ! uf.same( e.u, e.v ) )
        {
          mintw += e.w;
          uf.unite( e.u, e.v );
        }
    }

  cout << mintw << endl;
  
  return 0;
}

Measured memory_bytes: 2444
<?php

$input = explode(' ', trim(fgets(STDIN)));
$n = (int)$input[0];
$m = (int)$input[1];

$ans = 1;
for ($i = 1; $i ** 2 <= $m; $i++) {
    if ($m % $i === 0) {
        if (intdiv($m, $i) >= $n) {
            $ans = max($ans, $i);
        }
        if ($i >= $n) {
            $ans = max($ans, intdiv($m, $i));
        }
    }
}

echo $ans;

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

#define MAX 1000005

int main() {
    int N;
    cin >> N;
    vector<int> A(N);
    for (int i = 0; i < N; i++)
        cin >> A[i];
    vector<int> dp(MAX);
    for (int x : A) {
        if (dp[x] > 2)
            continue;
        for (int j = x; j < MAX; j += x)
            dp[j]++;
    }
    int ans = 0;
    for (int x : A)
        if (dp[x] == 1)
            ans++;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 7980
#include<iostream>
#include<cstdio>
using namespace std;
int main(void)
{
    int n,k;
    double d=0;
    cin >> n >> k;
    for(int i=1;i<=n;i++)
    {
        int j=i,l=1;
        while(j<k){
            l*=2;
            j*=2;
        }
        d+=1.0/l;
    }
    d/=1.0*n;
    printf("%.12f" ,d);
    return 0;
}


Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
	"strconv"
)

var (
	readString func() string
	stdout     *bufio.Writer
)

func init() {
	readString = newReadString(os.Stdin)
	stdout = bufio.NewWriter(os.Stdout)
}

func newReadString(ior io.Reader) func() string {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)

	return func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
}

func readInt() int {
	return int(readInt64())
}

func readInt64() int64 {
	i, err := strconv.ParseInt(readString(), 0, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

func readIntSlice(n int) []int {
	b := make([]int, n)
	for i := 0; i < n; i++ {
		b[i] = readInt()
	}
	return b
}

func readLengthAndSlice() (int, []int) {
	n := readInt()
	return n, readIntSlice(n)
}

func printf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(stdout, f, args...)
}

func println(args ...interface{}) (int, error) {
	return fmt.Fprintln(stdout, args...)
}

func eprintln(args ...interface{}) (int, error) {
	return fmt.Fprintln(os.Stderr, args...)
}

// readString() string
// readInt() int
// readIntSlice(n int) []int
// readLengthAndSlice() []int

// -----------------------------------------------------------------------------

func main() {
	defer stdout.Flush()
	x := readInt()
	y := readInt()
	uf := NewUnionFind(13)
	uf.Union(1, 3)
	uf.Union(5, 7)
	uf.Union(8, 10)
	uf.Union(1, 12)
	uf.Union(1, 5)
	uf.Union(1, 8)

	uf.Union(4, 6)
	uf.Union(9, 11)
	uf.Union(4, 9)
	if uf.Find(x) == uf.Find(y) {
		println("Yes")
	} else {
		println("No")
	}

}

// -----------------------------------------------------------------------------

type UnionFind struct {
	parent []int
	rank   []int
	size   []int
}

// Initialize UnionFind for [0 - n) elements.
// Use n+1 if you need [1 - n] elements
func NewUnionFind(n int) *UnionFind {
	u := &UnionFind{
		parent: make([]int, n),
		rank:   make([]int, n),
		size:   make([]int, n),
	}

	for i := range u.parent {
		u.parent[i] = i
		u.rank[i] = 0
		u.size[i] = 1
	}

	return u
}

func (u *UnionFind) Find(i int) int {
	if u.parent[i] == i {
		return i
	}
	p := u.Find(u.parent[i])
	u.parent[i] = p
	return p
}

func (u *UnionFind) Union(i, j int) {
	p := u.Find(i)
	q := u.Find(j)

	if p == q {
		return
	}

	if u.rank[p] < u.rank[q] {
		p, q = q, p
	}
	u.parent[p] = q
	if u.rank[p] == u.rank[q] {
		u.rank[q]++
	}
	u.size[q] += u.size[p]
}

func (u *UnionFind) Size(i int) int {
	p := u.Find(i)
	return u.size[p]
}


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

int main()
{
	int H, W, cut_h, cut_w, c=0;
	
	cin>> H >> W >> cut_h >> cut_w;
	c = (H - cut_h) * (W - cut_w);
	
	cout << c;
	
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;++i)

int main(void){
    int n, res = 0;
    cin>>n;
    rep(i,n){
        int a;
        cin>>a;
        res += a-1;
    }
    cout<<res<<endl;
    return 0;
}


Measured memory_bytes: 256
import sys
from copy import copy
input = sys.stdin.readline
'''
n, m = map(int, input().split())
n = int(input())
A = list(map(int, input().split()))
S = input().strip()
for test in range(int(input())):
'''
inf = 100000000000000000  # 1e17
mod = 998244353

S = input().strip()
for i in range(1,len(S)):
    if S[i]!=S[i-1]:
        print("Yes")
        sys.exit()
print("No")


Measured memory_bytes: 38384
#include <iostream>
#include <cmath>
#include <algorithm>

using namespace std;

int n, aa[3][100001];
long long ans = 0;

int main() {
    ios::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
    cin >> n;
    for (int i = 0; i < 3; i++) {
        for (int j = 0; j < n; j++) cin >> aa[i][j];
        sort(aa[i], aa[i] + n);
    }

    for (int i = 0; i < n; i++) {
        unsigned long j = lower_bound(aa[0], aa[0] + n, aa[1][i]) - aa[0];
        unsigned long k = upper_bound(aa[2], aa[2] + n, aa[1][i]) - aa[2];
        ans += (long long) (n - k) * j;
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 1408
#include <stdio.h>
int main(void){
int x=1,y=1;
while(true){
scanf("%d %d",&x,&y);
if(x==0&&y==0) break;
if(x>y){printf("%d %d\n",y,x);}
else{printf("%d %d\n",x,y);}

}
return 0;
}

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

using namespace std;

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

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

    sort(l.begin(), l.end());

    int ans = 0;

    for (int i=0; i<n; i++) {
        for (int j=i+1; j<n; j++) {
            for (int q=j+1; q<n && l[q] < l[i] + l[j]; q++) {
                ans++;
            }
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
n, k = map(int, input().split())
p = list(map(int, input().split()))
c = list(map(int, input().split()))

# mv_array = [set() for _ in range(n)]
# score_mv_array = [[] for _ in range(n)]
score_array = [0]*n

def get_sum(array):
    score_array = [0]
    for i, a in enumerate(array):
        score_array.append(score_array[i]+a)
    return max(score_array)

def get_max(array, q, mod):
    if q == 0:
        m_score = get_sum(array[:mod])
    else:
        m_score = get_sum(array+array[:mod])
        m_score = sum(array)*(q-1) + m_score
    return m_score

for i in range(n):
    score = 0
    max_score = c[i]
    score_mv_array = []
    pos = i
    start_pos = p[pos]-1
    for j in range(k):
        pos = p[pos]-1
        if j!=0 and pos == start_pos:
            len_mv = len(score_mv_array)
            # len_mv = j+1
            q, mod = divmod(k-j, len_mv)
            score += get_max(score_mv_array, q, mod)
            max_score = max(score, max_score)
            break
        score += c[pos]
        score_mv_array.append(c[pos])
        max_score = max(score, max_score)
    score_array[i] = max_score

print(max(score_array))

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

int main (){
  	int a,b,c;
  	cin >> a >>b >>c;
    int t = b*10+c;
  	if(t%4==0){
    	cout << "YES" << endl;
    }
  	else {
    	cout << "NO"  << endl; 
    }
	return 0;
}

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

// region template
#define rep(i, a, b) for (int i = (a); i < (b); ++i)
#define trav(a, x) for (auto &a : x)
#define all(x) begin(x), end(x)
#define sz(x) (ll)(x).size()
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef vector<int> vi;

ll gcd(ll a, ll b) { return __gcd(a, b); }

ll euclid(ll a, ll b, ll &x, ll &y) {
    if (b) {
        ll d = euclid(b, a % b, y, x);
        return y -= a / b * x, d;
    }
    return x = 1, y = 0, a;
}

typedef unsigned long long ull;
typedef long double ld;
ull mod_mul(ull a, ull b, ull M) {
    ll ret = a * b - M * ull(ld(a) * ld(b) / ld(M));
    return ret + M * (ret < 0) - M * (ret >= (ll)M);
}
ull mod_pow(ull b, ull e, ull mod) {
    ull ans = 1;
    for (; e; b = mod_mul(b, b, mod), e /= 2)
        if (e & 1)
            ans = mod_mul(ans, b, mod);
    return ans;
}

const ll mod = 1000000007;
struct Mod {
    ll x;
    Mod(ll xx) : x(xx) {}
    Mod operator+(Mod b) { return Mod((x + b.x) % mod); }
    Mod operator-(Mod b) { return Mod((x - b.x) % mod); }
    Mod operator*(Mod b) { return Mod((x * b.x) % mod); }
    Mod operator/(Mod b) { return *this * invert(b); }
    Mod invert(Mod a) {
        ll x, y, g = euclid(a.x, mod, x, y);
        assert(g == 1);
        return Mod((x + mod) % mod);
    }
    Mod operator^(ll e) {
        if (!e)
            return Mod(1);
        Mod r = *this ^ (e / 2);
        r = r * r;
        return e & 1 ? *this * r : r;
    }
};
// endregion

int main() {
    cin.sync_with_stdio(0);
    cin.tie(0);
    cin.exceptions(cin.failbit);

    int n, h, w; cin >> n >> h >> w;
    vector<int> isopen(n * w);
    rep(i, 0, n * w) isopen[i] = true;

    rep(i, 1, n + 1) {
        int pos = (i - 1) * w;
        int d; cin >> d;

        if (i & 1) {
            pos += d;
        } else {
            pos -= d;
        }
        for (int i = pos; i < pos + w && i < n * w; i++)
            isopen[i] = 0;
    }

    int ans = 0;
    // rep(i, 0, n * w) cout << isopen[i]; cout << endl;
    rep(i, 0, n * w) ans += isopen[i];
    cout << ans * h << endl;
}



Measured memory_bytes: 3272
//is there any case of -1 or any special corner cases ?
#include<bits/stdc++.h>
using namespace std;
#define int long long int 
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define vi vector<int>
#define pi pair<int,int>
#define all(v) v.begin(),v.end()
#define zeros(arr) memset(arr,0,sizeof(arr));
#define precise(num)  cout<<fixed; cout << std::setprecision(num)
#define nl cout<<"\n";
#define test int t;cin>>t;while(t--) 
const int maxx  = 3*1e5 , limit = 1e17 , MOD=1e9+7;
#define boost  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
int32_t main(){
    boost;
    
    int n,k;
    cin>>n>>k;
    
    vector<int>v[n+1];
    for(int i=1;i<=n;i++){
        int x;
        cin>>x;
        v[i].pb(x);
    }
    
    int res = 1;
    int p = 0;
    int itr =  0 ;
    vector<int>v1;
    for(int i =0 ; i < k ; i++ )
    {
        itr++;
        v1.pb(res);
        res = v[res][0];
        if( itr == n){
            break;
        }
        
    }
    if(v1.size() == k ){
        cout<<v[ v1[v1.size()-1] ][0]<<endl;
        return 0;
    }
    
    
    int ind = 0;
    for(int i = 0 ; i < v1.size() ; i ++ ){
        if(v1[i] == v1[v1.size()-1]){
            ind = i+1;
            break;
        }
    }
    
     k   -=ind;
     
     
     
    
  int len = v1.size() - ind ;
   
   //cout<<k <<" "<<len<<endl;
   
   
     k = k % len;
  // cout<<k<<endl;
    cout<<v1[ind + k]<<endl;
    
    
    // cout<<res<<endl;
    
}

Measured memory_bytes: 16268
#include <stdio.h>
int main(void){
    // Your code here!
int n,x,m,i,min = 1000;
scanf("%d%d",&n,&x);

for (i = 0; i< n; i++){
    scanf("%d",&m);
    x -= m;
    min = (min < m) ? min : m;
}
printf ( "%d", n + x/min);
}


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

int main() {
    int H, W;
    cin >> H >> W;
    int mass[H][W] = {0};
    for (int i = 0; i < H; ++i) {
        for (int j = 0; j < W; ++j) {
            cin >> mass[i][j];
        }
    }
    vector<pair<int, int>> answer;
    for (int i = 0; i < H; ++i) {
        for (int j = 0; j < W - 1; ++j) {
            if (mass[i][j] % 2 == 1) {
                --mass[i][j];
                ++mass[i][j + 1];
                answer.emplace_back(make_pair(i + 1, j + 1));
                answer.emplace_back(make_pair(i + 1, j + 2));
            }
        }
    }
    for (int i = 0; i < H - 1; ++i) {
        if (mass[i][W - 1] % 2 == 1) {
            --mass[i][W - 1];
            ++mass[i + 1][W - 1];
            answer.emplace_back(make_pair(i + 1, W));
            answer.emplace_back(make_pair(i + 2, W));
        }
    }
    cout << answer.size() / 2 << endl;
    for (int i = 0; i < answer.size(); i += 2) {
        cout << answer[i].first << " " << answer[i].second << " " << answer[i + 1].first << " " << answer[i + 1].second << endl;
    }
}

Measured memory_bytes: 5232
#include<bits/stdc++.h>
#include<algorithm>
#include<math.h>
#include<string>
#include<iostream>
#include<vector>
#include<cstdlib>
using namespace std;
 
template <class T> using V = vector<T>;
 
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
 
const long long INF = 1LL << 60;
 
using ll = long long;
using db = double;
using st = string;
using ch = char;
using bl = bool;
using vll = V<ll>;
using vpll =V<pair<ll,ll>>;
using vst = V<st>;
using vdb = V<db>;
using vch = V<ch>;
using vbl = V<bl>;
 
 
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define rFOR(i,a,b) for(ll i=(a);i>(b);i--)
#define oFOR(i,a,b) for(ll i=(a);i<(b);i+=2)
#define bgn begin()
#define en end()
#define SORT(a) sort((a).bgn,(a).en)
#define REV(a) reverse((a).bgn,(a).en)
#define M(a,b) max(a,b)
#define rM(a,b) min(a,b)
#define fi first
#define se second
#define sz size()
#define gcd(a,b) __gcd(a,b)
#define co(a) cout<<a<<endl;
#define ci(a) cin>>a;
 

vll dp(100100);

ll sum(ll n) {
  ll m=0;
  FOR(i,0,20){
    m+=n%10;
    n/=10;
    if(n==0){
      break;
    }
  }
  return m;
}
 
 
const int MAX = 510000;
const int MOD = 1000000007;
 
long long fac[MAX], finv[MAX], inv[MAX];
 
void Comuse() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
 
 
#define comuse Comuse()
 
ll combi(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
 
 
 
 
ll lcm(ll a,ll b){
  ll n;
  n=a/gcd(a,b)*b;
  return n;
}
 
 
/****************************************\
| Thank you for viewing my code:)        |
| Written by RedSpica a.k.a. RanseMirage |
| Twitter:@asakaakasaka                  | 
\****************************************/
 
 
signed main() {
  ll n;
  	ci(n);
  ll count=0;
  ll ans=0;
  ll a;
  	ci(a);
  
  FOR(i,1,n){
    ll b;
    	ci(b);
    if(a>=b){
      count++;
    }
    else{
      chmax(ans,count);
      count=0;
    }
    a=b;
  }
  chmax(ans,count);
  co(ans)
}


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

int main() {
  int N, K;
  cin >> N >> K;
  auto h = vector<int>(N);
  for(auto i=0; i<N; ++i) {
    cin >> h[i];
  }
  auto v = vector<int>(N);
  fill(v.begin(), v.end(), 0);
  for(auto to=1; to<N; ++to) {
    int minv = 1<<30;
    for(auto from=max(to-K, 0); from<to; ++from) {
      auto vv = v[from] + abs(h[to] - h[from]);
      minv = min(minv, vv);
    }
    v[to] = minv;
  }
  cout << v[N-1] << endl;
  return 0;
}


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

int gcd (int x, int y){
    int r;
    int a;
    
    if(y > x){
        a = y;
        y = x;
        x = a;
    }
    while(y > 0){
        r = x % y;
        x = y;
        y = r;
    }
    return x;
}
int main(){
    int x,y;
    int ans=0;
    cin >> x >> y;
    ans=gcd(x,y);
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3112
s=require("fs").readFileSync("/dev/stdin","utf8").split('\n');
[n,k]=[...s[0].split(' ')].map(n=>n|0)
s.shift()
s=s.map(n=>n|0).sort((a,b)=>b-a);
console.log(Math.min(...Array(n-k+1).fill().map((_,i)=>s[i]-s[i+k-1])))

Measured memory_bytes: 30924