akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
int main(){
	char a[]="Sunny";
	char b[]="Cloudy";
	char c[]="Rainy";
	char m[7];
	scanf("%s",m);
	char *p=a,*q=b,*r=c,*s=m;

	if(*s==*p)
	printf("Cloudy");
	else if(*s==*q)
	printf("Rainy");
	else if(*s==*r)
	printf("Sunny");
	return 0;
}

Measured memory_bytes: 128
#define _USE_MATH_DEFINES
#include<iostream>
#include<string>
#include<vector>
#include<list>
#include<algorithm>
#include<math.h>
#include<map>
#include<iomanip>
#include<functional>
#include<limits>
#include <unordered_map>
#include <numeric>
#include <array>
#include <queue>
#include <chrono>
#include <random>
#include <fstream>


using namespace std;
using  ull = unsigned long long int;

#define rep(i,n,m) for(long long int i=n;i<(long long int)(m);i++)
#define INF (1<<29)
#define MD 1000000007




int main() {

	
	string str;
		
	cin >> str;
	long n = atoi(str.c_str());
	
	vector<int>num(str.length());
	
	rep(i, 0, str.length()) {
		num[i] =str[i] - '0';
	}

	long sum = 0;
	rep(i, 0, str.length())sum += num[i];

	if (n % sum == 0)cout << "Yes" << endl;
	else cout << "No" << endl;

	return 0;
}

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

using namespace std;

bool isPalind(string s) {
	string rs = s;
	reverse(rs.begin(), rs.end());
	return rs == s;
}

int main() {
	string s;
	cin >> s;	
	int n = s.length();
	s = "#" + s + "#";
	string aa = "";
	for(int i = 1; i <= (n-1)/2; i++)
		aa.push_back(s[i]);
	string bb = "";
	for(int i = (n+3)/2; i <= n; i++)
		bb.push_back(s[i]);
	if(isPalind(s) && isPalind(aa) && isPalind(bb))
		cout << "Yes\n";
	else
		cout << "No\n";
	return 0;
}

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

typedef long long lint;

lint txp(int k) { return k ? txp(k-1) * 10 : 1; }

set<lint> s;

int main() {
	for (int i=1; i<=9; i++) s.insert(i);
	for (int k=1; k<=10; k++) {
		for (int i=1; i<=100 and i<=10*k; i++) s.insert(i*txp(k)-1);
	}
	for (int k=11; k<15; k++) {
		for (int i=1; i<=10*k-10; i++) s.insert(i*txp(k)- 1);
	}


	lint n, cnt = 0;
	cin >> n;
	for (lint i : s) if (cnt < n) cout << i << '\n', cnt++;
}


Measured memory_bytes: 256
fun main(args: Array<String>){
    val (N, K) = readLine()!!.split(" ").map { it.toLong() }
    if(K == 0L){
        println(N * N)
        return
    }
    var ans = 0L
    for(b in 1..N){
        val div = N / b
        val rem = N % b
        ans += div * (Math.max(0, b - K))
        ans += Math.max(0, rem - K + 1)
    }
    println(ans)
}

Measured memory_bytes: 37900
s=input()
f=int(s[:2])
e=int(s[2:])
if 0 < f < 13 and 0 < e < 13: print('AMBIGUOUS')
elif 0 < f < 13: print('MMYY')
elif 0 < e < 13: print('YYMM')
else: print('NA')


Measured memory_bytes: 2940
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
signed main() { 
  ios::sync_with_stdio(false); cin.tie(0);
  //b
  int n;
  cin >> n;
  vector<int> w(n);
  for (int i = 0; i < n; i++) {
    cin >> w[i];
  }
  int ans = 1 << 30;
  for (int i = 0; i + 1 < n; i++) {
    int s1 = 0;
    for (int j = 0; j <= i; j++) {
      s1 += w[j];
    }
    int s2 = 0;
    for (int j = i + 1; j < n; j++) {
      s2 += w[j];
    }
    ans = min(ans, abs(s1 - s2));
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
package main

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

var scanner = bufio.NewScanner(os.Stdin)

func nextString() string {
	scanner.Scan()
	return scanner.Text()
}

func nextInt() int {
	n, err := strconv.Atoi(nextString())
	if err != nil {
		fmt.Printf("strconv.Atoi failed: %v\n", err)
	}
	return n
}

var infty int = 2 * 1000000000

type DirectedGraphNodeID int

type DirectedGraphNode struct {
	key         DirectedGraphNodeID
	adjacents   []*DirectedGraphNode
	costs       []int
	distance    int
	predecessor *DirectedGraphNode
}

func newDirectedGraph(nNodes int) *DirectedGraph {
	graph := DirectedGraph{}
	graph.nodes = make([]*DirectedGraphNode, nNodes)
	for i := 0; i < nNodes; i++ {
		node := DirectedGraphNode{}
		node.key = DirectedGraphNodeID(i)
		node.distance = infty
		graph.nodes[i] = &node
	}
	return &graph
}

type DirectedGraph struct {
	nodes []*DirectedGraphNode
}

func (g *DirectedGraph) setAdjacency(i, j DirectedGraphNodeID, cost int) {
	g.nodes[i].adjacents = append(g.nodes[i].adjacents, g.nodes[j])
	g.nodes[i].costs = append(g.nodes[i].costs, cost)
}

func (g *DirectedGraph) print() {
	for i := 0; i < len(g.nodes); i++ {
		node := g.nodes[i]
		key := node.key
		strings := []string{strconv.Itoa(int(key)), strconv.Itoa(node.distance)}
		for j := 0; j < len(node.adjacents); j++ {
			nodeJ := fmt.Sprintf("(%v, %v)", node.adjacents[j].key, node.costs[j])
			strings = append(strings, nodeJ)
		}
		fmt.Printf("%v\n", strings)
	}
}

func (g *DirectedGraph) relaxEdge(l, r *DirectedGraphNode, w int) {
	if r.distance < l.distance+w {
		panic("original distance is shorter than new distance")
	}
	r.distance = l.distance + w
	r.predecessor = l
}

func main() {
	scanner.Split(bufio.ScanWords)

	nNodes := nextInt()
	nEdges := nextInt()
	startNode := DirectedGraphNodeID(nextInt())

	graph := newDirectedGraph(nNodes)

	for i := 0; i < nEdges; i++ {
		iNode := DirectedGraphNodeID(nextInt())
		jNode := DirectedGraphNodeID(nextInt())
		cost := nextInt()
		graph.setAdjacency(iNode, jNode, cost)
	}
	graph.nodes[startNode].distance = 0

	// Bellman-Ford algorithm
	for l := 0; l <= len(graph.nodes)-2; l++ {
		for _, left := range graph.nodes {
			for j, right := range left.adjacents {
				w := left.costs[j]
				newCost := left.distance + w
				// fmt.Println(left.key, right.key, right.distance, newCost)
				if left.distance != infty && newCost < right.distance {
					graph.relaxEdge(left, right, w)
				}
			}
		}
	}

	negativeLoopFound := false
NEGATIVE_LOOP_DETECTION:
	for _, left := range graph.nodes {
		for j, right := range left.adjacents {
			if left.distance != infty && right.distance > left.distance+left.costs[j] {
				negativeLoopFound = true
				break NEGATIVE_LOOP_DETECTION
			}
		}
	}

	// graph.print()

	if negativeLoopFound {
		fmt.Println("NEGATIVE CYCLE")
	} else {
		for _, node := range graph.nodes {
			if node.distance == infty {
				fmt.Println("INF")
			} else {
				fmt.Println(node.distance)
			}
		}
	}
}



Measured memory_bytes: 1252
#include <stdio.h>
int main(void){
    int n;
    int x;
    int i;
    long long sum;
    int min,max;
    scanf("%d",&n);
    sum=0;
    min=1000000;
    max=-1000000;
    for(i=0;i<n;i++){
        scanf("%d",&x);
        sum+=x;
        if(x<min){
            min=x;
        }
        if(x>max){
            max=x;
        }
    }
    printf("%d %d %lld\n",min,max,sum);
    return 0;
}

Measured memory_bytes: 600
#include<bits/stdc++.h>
using namespace std;
//#pragma GCC target ("avx")
#pragma GCC optimization ("Ofast")
#pragma GCC optimization ("unroll-loops")
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define all(v) v.begin(),v.end()
#define P pair<int,int>
#define siz(s) (int)s.size()

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;
}
template<class T> inline int getidx(vector<T> &v, T a) {
	return lower_bound(all(v), a) - v.begin();
}

constexpr int mod=998244353;
constexpr int inf=3e18;

int gcd(int x, int y) {
	if (y == 0)
		return x;
	return gcd(y, x % y);
}
signed main(){
	cin.tie(0);ios::sync_with_stdio(false);
	int K;
	cin>>K;
	int ans=0;
	REP(i,K+1)REP(j,K+1)REP(k,K+1){
		ans+=gcd(i,gcd(j,k));
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 3652
#include <stdio.h>
int main(void)
{
    int a, b, c, ans=1;

    scanf("%d%d%d", &a, &b, &c);

    if(b!=a) ans++;
    if(c!=a && c!=b) ans++;
    

    printf("%d\n", ans);
    
    return 0;
}


Measured memory_bytes: 128
n = int(input())
a = list(map(int,input().split()))
for i in range(n):
         if a[i] % 2 == 0:
                  if  a[i] % 3 != 0 and a[i] % 5 != 0:
                           print("DENIED")
                           exit()
                  
print("APPROVED")


Measured memory_bytes: 2940
/*

*/
#include <bits/stdc++.h>
using namespace std;
#define pi acos(-1.0)
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define rep(i,a,n) for (ll i=a;i<n;i++)
#define per(i,a,n) for (ll i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((ll)(x).size())
#define cin1(x) cin >> x
#define cin2(x, y) cin >> x >> y
#define cin3(x, y, z) cin >> x >> y >> z
#define cou(x) cout << x
#define cous(x) cout << x << " "
#define coul(x) cout << x << "\n"
#define ret(x) return x
#define MAX 5000001
#define start int main() {   fastio
#define finish ret(0); }
#define Test ll _t; cin1(_t); while( _t-- )
typedef long long ll;
typedef vector<ll> VI;
typedef pair<ll,ll> PII;
typedef double db;
//mt19937 mrand(random_device{}());
const ll mod=1000000007;
//ll rnd(ll x) { return mrand() % x;}
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}ret(res);}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
ll fact[13];
void factorial() {   fact[0]=1;  rep(i, 1, 12) fact[i]=(fact[i-1]*i);  }
vector <ll> sie; //for sieve function
ll spf[MAX+7];  //for sieve function
void sieve() {    rep(i, 2, MAX)  {  if (spf[i] == 0) {  spf[i] = i;   sie.pb(i);  }    for (ll j=0; j<SZ(sie) && i*sie[j] <= MAX && sie[j] <= spf[i]; j++)   spf[i * sie[j]] = sie[j]; }   }
// head collected

string str;
ll n, m, ans, an;

start;

    cin1(str);
    an = SZ(str);
    m = an/2;
    rep(i, 0, an/2){
        if( str[ i ] != str[an-1-i]){
            ans = 1;
            break;
        }
    }
    if(ans == 1) {coul("No");ret(0);}
    rep(i, 0, m/2){
        if( str[ i ] != str[m-1-i]){
            ans = 1;
            break;
        }
    }
    if(ans == 1) {coul("No");ret(0);}
    reverse(all(str));
    rep(i, 0, m/2){
        if( str[ i ] != str[m-1-i]){
            ans = 1;
            break;
        }
    }
    if(ans == 1) coul("No");
    else coul("Yes");
finish





Measured memory_bytes: 256
#include <stdio.h>
#include <stdint.h>
#define SIZE 200001
#define LIM 1000000001
typedef int64_t i64;

int med(int x, int y, int z){
  if(x < y){
    if(y < z)return y;
    else if(z < x)return x;
    else return z;
  }
  else{ // y <= x
    if(x < z)return x;
    else if(z < y)return y;
    else return z;
  }
}

void quick_sort(int a[], int left, int right){
  if(left < right){
    int i = left, j = right, tmp, pivot = med(a[i], a[i+(j-i)/2], a[j]);
    while(1){
      while(a[i] < pivot)i++;
      while(a[j] > pivot)j--;
      if(i >= j)break;
      tmp = a[i]; a[i] = a[j]; a[j] = tmp;
      i++; j--;
    }
    quick_sort(a, left, i-1);
    quick_sort(a, j+1, right);
  }
}

int main(void){
  int n, a[SIZE], i;
  i64 ans = 0;
  scanf("%d", &n);
  for(i = 0; i < n; i++)
    scanf("%d", &a[i]);
  quick_sort(a, 0, n-1);
  
  for(i = 1; i < n; i++)
    ans += a[n-1 - i/2];
  printf("%lld", ans);
  
  return 0;
}

Measured memory_bytes: 2492
#include <iostream>
#include <stdio.h>
using namespace std;

int main(){
  char in[20];
  int min;
  cin >> in;
  min = 999;
  int j =0;
  int hoge;
  while(in[j + 2] != '\0'){
    hoge = 753 - ((in[j] - '0')*100+(in[j+1] - '0')*10+(in[j+2] - '0'));
    if(hoge < 0)hoge = hoge*(-1);
    if(hoge < min)min = hoge;
    j++;
  }
  cout << min<< endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
#include <string>

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) for (int i = 0; i < (n); i++)
#define ALL(a) (a).begin(), (a).end()

int main() {
    int C[3][3];
    REP(i, 3) REP(j, 3) cin >> C[i][j];

    int A[3] = {
        *min_element(C[0], C[0] + 3),
        *min_element(C[1], C[1] + 3),
        *min_element(C[2], C[2] + 3)
    };

    bool ok = true;
    REP(i, 3) {
        int B[3];
        REP(j, 3) B[j] = C[j][i] - A[j];
        if (B[0] == B[1] && B[1] == B[2]) {}
        else {
            ok = false;
            break;
        }
    }

    if (ok) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
long long n,a[100010],kq[100010];
int x,k;
main()
{
    cin>>n>>k;
    for(int i=1;i<=n;i++) cin>>a[i];
    for (int i=2;i<=n;i++) kq[i]=1000000000;
    for(int i=1;i<=n;++i)
    {
        x=max(i-k,1);
        for(int j=i;j>=x;--j) kq[i]=min(kq[i],kq[j]+abs(a[i]-a[j]));
    }
    cout<<kq[n];
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n, m, x, y;
  cin  >> n >> m >> x >> y;
  int x_max = -500;
  for(int i = 0; i < n; i++){
    int x_i; cin >> x_i;
    x_max = max( x_max, x_i);
  }
  int y_min = 500;
  for(int i = 0; i < m; i++){
    int y_i; cin >> y_i;
    y_min = min( y_min, y_i);
  }
 // cout << "x_max "<<x_max<<endl;
 // cout << "y_min "<<y_min<<endl;
  if(x_max + 1 <= y_min && x_max + 1 <= y && x <= y_min - 1) cout << "No War" << endl;
  else cout <<"War"<<endl;
}

Measured memory_bytes: 256
#!/usr/bin/env python
 #!/usr/bin/env python
def main():
    N = int(input())
    for i in range(1, 10):
        for j in range(1, 10):
            if i * j == N:
                print("Yes")
                exit()
    print("No")
            
if __name__ == '__main__':
    main()



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

using namespace std;

#ifndef aa
#define trace(...)
#define endl '\n'
#endif
#define pb push_back
#define ub upper_bound
#define lb lower_bound
#define fi first
#define se second
#define int long long
typedef long long ll;
typedef long double ld;
#define double long double
#define pii pair<int,int>
#define pdd pair<double,double>
#define pll pair<ll,ll>
#define sz(x) ((long long)x.size())
#define fr(a,b,c) for(int a=b; a<=c; a++)
#define frev(a,b,c) for(int a=c; a>=b; a--)
#define rep(a,b,c) for(int a=b; a<c; a++)
#define trav(a,x) for(auto &a:x)
#define all(con) con.begin(),con.end()
#define deb(x) cout << x << endl
#define done(x) {cout << x << endl;return;}
const ll infl = 0x3f3f3f3f3f3f3f3fLL;
const int infi = 0x3f3f3f3f;
mt19937_64 mt(chrono::steady_clock::now().time_since_epoch().count());
//const int mod = 998244353;
const int mod = 1e9 + 7;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<pair<int, int>> vpii;
typedef map<int, int> mii;
typedef set<int> si;
typedef set<pair<int,int>> spii;
typedef queue<int> qi;


const int N = 2e5 + 5;


void solve() {

  int n,ans=0;
  cin>>n;
  vi a(n);
  rep(i,0,n)
    cin>>a[i];
  sort(all(a),greater<>());
  ans=a[0];
  rep(i,0,n-2)
    ans+=a[1+i/2];
  cout<<ans;
   
          
}


signed main() {
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    //srand(chrono::high_resolution_clock::now().time_since_epoch().count());
    cout << fixed << setprecision(15);
    int t = 1;
    //cin >> t;

    while (t--)
        solve();
#ifdef aa
    cout << endl << endl << endl << endl << "Time elapsed: " << (double)(clock() - clk) / CLOCKS_PER_SEC << endl;
#endif
    return 0;
}




int powm(int a, int b) {
    int res = 1;
    while (b) {
        if (b & 1)
            res = (res*a) % mod;
        a = (a * a) % mod;
        b >>= 1;
    }
    return res;
}


int divide(int a, int b) {
    return (a % mod) * powm(b, mod - 2) % mod;
}

int norm(int a) {
    while (a >= mod) a -= mod;
    while (a < 0) a += mod;
    return a;
}


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


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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef unsigned char ubyte;

const ld EPS = 1e-9;
const ld PI = acos(-1.0);
const int INF = (int)1e9 + 5;
const ll LINF = (ll)1e18 + 5;

bool eq(double a, double b) {
	return fabs(a - b) < EPS;
}

template<class T>
T sqr(const T & x) { return x * x; }

template<class T> 
ll abs(const T & x) { return x < 0 ? -x : x; }

template<class T>
ll myround(const T & x) { return x < 0 ? x - 0.5 : x + 0.5; }

template<class T> 
bool chmin(T & x, const T & y) {
	if (y < x) {
		x = y;
		return true;
	}
	return false;
}

template<class T>
ostream & operator <<(ostream & os, const vector<T> & v) {
	os << "{";
	for (typename vector<T>::const_iterator it = v.begin(); it != v.end(); ++it) {
		os << *it;
		if ((it + 1) != v.end()) os << ", ";
	}
	os << "}";
	return os;
}

template<class P, class Q>
ostream & operator <<(ostream & os, const pair<P, Q> & p) {
	return os << "(" << p.first << ", " << p.second << ")";
}

template<class T> 
bool chmax(T & x, const T & y) {
	if (x < y) {
		x = y;
		return true;
	}
	return false;
}

#define all(a) (a).begin(), (a).end()

int main() {
	//srand(time(0));
#ifdef LOCAL 
	freopen("input.txt", "r", stdin);
#else
#endif

	int n;
	scanf("%d", &n);

	vector<int> a(n), k;

	for (int & x : a) {
		scanf("%d", &x);
		k.push_back(x);
	}

	sort(all(k));

	for (int & x : a) {
		x = lower_bound(all(k), x) - k.begin();
	}

	ll res = 0;
	for (int i = 0; i < n; i++) {
		res += abs(a[i] - i) % 2;
	}

	cout << res/2 << endl;

}

Measured memory_bytes: 1276
#include<bits/stdc++.h>
using namespace std;
//#pragma GCC target("popcnt")  //https://godbolt.org/z/yQv94Y 

typedef long long int ll;
typedef unsigned long long int  ull;
typedef long double ld;

#define INF 1e9
#define pi 3.141592653589
#define e 2.718281828459
#define phi 1.618033988749
#define MOD 1000000007
#define printarr(arr,n){for(int i=0;i<(n);i++){cout<<arr[i]<<" ";}cout<<endl;}
#define foreach(it , l) for(auto it = l.begin(); it != l.end(); ++it)
#define xlr8 ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define pll pair<ll,ll>
#define vpll vector<pair<ll,ll> >
#define rev_sort(a) sort(a.rbegin(),a.rend());

struct Timer
{
    chrono::time_point<chrono::high_resolution_clock> start , end;
    chrono:: duration<float> dur;
    Timer()
    {
        start = chrono::high_resolution_clock::now();
    }
    ~Timer()
    {
        end = chrono::high_resolution_clock::now();
        dur = end - start;
        cout<<"\nTime Elapsed : " <<dur.count() << " s\n";
    }
};

ll sum() {return 0;}
template<typename T, typename... Args>
T sum(T a , Args... args)   {return a + sum(args...); }

//76149
template<int D, typename T> 
struct Vec : public vector<Vec<D - 1, T>> {
  static_assert(D >= 1, "Vector dimension must be greater than zero!");
  template<typename... Args>
  Vec(int n = 0, Args... args) : vector<Vec<D - 1, T>>(n, Vec<D - 1, T>(args...)) {
  }
};
template<typename T>
struct Vec<1, T> : public vector<T> {
  Vec(int n = 0, T val = T()) : vector<T>(n, val) {
  }
};



int main()
{
    xlr8;
    int testCases  = 1;
    //cin>>testCases;
    while (testCases--)
    {
        int k;
        cin>>k;
        string s; cin>>s;
        if(s.length() <= k) 
            cout<<s<<"\n";
        else 
            cout<<s.substr(0, k)<<"...\n";
    }
    
    

    

}


Measured memory_bytes: 3664
import sys
import collections

x = [1, 0, -1, 0]
y = [0, 1, 0, -1]
while True:
    W, H = map(int, sys.stdin.readline().split())
    if W == 0:
        break
    
    tile = [[0 for i in xrange(W + 2)] for j in xrange(H + 2)]
    
    visited = set()
    next = set()
    
    for i in xrange(H):
        line = raw_input().strip()
        for j in xrange(W):
            if line[j] == '.':
                tile[i + 1][j + 1] = 1
            if line[j] == '@':
                tile[i + 1][j + 1] = 1
                next.add((i + 1, j + 1))
#    for line in tile:
#        print line
    while len(next) > 0:
        temp_next = set()
        for n in next:
            visited.add(n)
            for i in xrange(4):
                temp = (n[0] + x[i], n[1] + y[i])
                if temp not in visited and tile[temp[0]][temp[1]] == 1:
                    temp_next.add(temp)
        next = temp_next
    print len(visited)

Measured memory_bytes: 4668
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
using namespace std;
#ifndef FAST_IO
 #define IOS ios_base::sync_with_stdio(false);cin.tie(nullptr);
#endif

#define int long long
#define FILE_IO freopen("input.txt","r",stdin)/#define int long long
#define f first
#define s second
#define endl '\n'
#define all(c) c.begin(),c.end()
#define bp __builtin_popcount
#define debug(x) cerr << #x << " = " << x << endl;

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

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
template <typename T>void print(T t){for(auto &it : t)cout<<it<<" ";}
inline int powerexp(int a, int b, int m = MOD){ int res = 1;while(b){if(b&1)res = res * a % m;a = a * a % m,b >>= 1;}return res % m;}
inline int modinv(int a){ return powerexp(a,MOD-2,MOD);}
inline int lcm(int a, int b){ int g = __gcd(a,b);return a/g*b;}
inline int add(int x, int y){ x += y; if (x >= MOD) x -=  MOD; return x;}
inline int mul(int x, int y){ return (x * 1ll * y) % MOD;}
inline int sub(int x, int y){ x -= y; if (x<0) x += MOD; return x ;}

//-------------------< start here >-------------------------// 

void solve(){
   int n;
   cin >> n;
   
   vector<int> h(n);
   for(int i = 0; i < n; i++) cin >> h[i];
   
   h[0]--;
   for(int i = 1; i < n; i++){
	    if (h[i] > h[i - 1]) h[i]--; 
	  }	
  
  bool ok = true;
  for(int i = 1; i < n; i++){
	   if (h[i] < h[i - 1]) ok = false;
	 }
  if (ok) cout << "Yes" << endl;
  else cout << "No" << endl;
}

//-----------------------------
//comment from here for TOPCODER 
int32_t main(){
   IOS;
   solve();
   //find();
   #ifdef LOCAL_DEFINE
   cerr << "time elapsed " << (double)clock()/CLOCKS_PER_SEC << endl;
   #endif
}


Measured memory_bytes: 1024
fn b() {
    input!{
        n: u32,
        a: [u64; n]
    }
    if a.iter().any(|&ai| ai == 0) {
        println!("{}", 0);
        return ;
    }
    let mut ans: u64 = 1;
    let mut max = 10u64.pow(18u32);
    for ai in a {
        if ai > max {
            println!("{}", -1);
            return;
        }
        ans = ans * ai;
        max /= ai;
    }
    
    println!("{}", ans);
}

use proconio::{input};

fn main() {
    b();
}


Measured memory_bytes: 4484
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;

const int mod = 1000000007;
//const int mod = 998244353;

struct mint {
  ll x;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}


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;}

int main()
{
    int n;
    cin >> n;
    vector<string> s(n);
    rep(i, 0, n) cin >> s[i];
    int m;
    cin >> m;
    vector<string> t(m);
    rep(i, 0, m) cin >> t[i];
    map<string, int> mp;
    rep(i, 0, n) mp[s[i]]++;
    rep(i, 0, m) mp[t[i]]--;
    int ans = 0;
    for(auto i : mp) ans = max(ans, i.second);
    cout << ans << endl;
    return 0;
    
}


Measured memory_bytes: 3584
#include <bits/stdc++.h>
using namespace std;
using lint = long long int;
using lond = long double;
#define rep(i,n) for (int i = 0; i < (n); ++i)
//ans
int main (){
	string s;
	cin >> s;
	if (s == "RRR") cout << 3 << endl;
	else if ((s[0] == 'R' && s[1] == 'R') || (s[1] == 'R' && s[2] == 'R')) cout << 2 << endl;
	else if (s.find('R') != -1) cout << 1 << endl;
	else cout << 0 << endl;
	return 0;
}


Measured memory_bytes: 3576
#include <algorithm>
#include <bitset>
#include <cmath>
#include <iostream>
#include <iterator>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <utility>
#include <unordered_map>
#include <unordered_set>
using namespace std;

#define ABS(a) (((a) >= 0) ? (a) : -(a))
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) > (b) ? (b) : (a))
#define FOR(i, a, b) for (int i = (a); i <= (b); ++i)
#define RFOR(i, a, b) for (int i = (a); i >= (b); --i)
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define NINTH_POWER_OF_TEN 1000000000
#define LL_INF (numeric_limits<long long>::max()/2)
#define int long long

typedef long long ll;
typedef pair<int, int> Pair;

const int kMaxN = 300;

int N;
string S[kMaxN];
int ans = 0;

void P2(int a, int b) {
  cout << a << " " << b << endl;
  return;
}

signed main() {
  cin >> N;
  REP(i, N) { cin >> S[i]; }

  REP(x, N) {
    FOR(i, 0, N-1) {
      FOR(j, i, N-1) {
        if (S[(i+x)%N][j] != S[(j+x)%N][i]) { goto label; }
      }
    }
    ans += N;
label:
  ;
  }

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


Measured memory_bytes: 384
n = int(input())
s = input()


count_list = []
for index in range(1, len(s)):
    a = s[:index]
    b = s[index:]

    kind_a = set(a)
    kind_b = set(b)

    count = 0
    for c in kind_a:
        if c in kind_b:
            count+=1
    count_list.append(count)

print(max(count_list))


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

void EraseWord(string& str,string word){
    for(int c = str.find(word.c_str()); c != string::npos; c = str.find(word.c_str())){
        str.erase(c,word.size());
    }
}

int main(){

    string words[] = {"eraser","erase", "dreamer", "dream"};    
    string str;
    cin >> str;

    for(int i = 0; i < sizeof(words)/sizeof(words[0]); i++){
        EraseWord(str, words[i]);
    }

    if(str.size() == 0){
        printf("YES\n");
    }else{
        printf("NO\n");
    }

    return 0;
}

Measured memory_bytes: 512
<?php
        $input = trim(fgets(STDIN));
        $input_upper = str_split(strtoupper($input));
        $input_lower = str_split(strtolower($input));
        $input = str_split($input);
        $output = "";

        for($loop_cnt = 0; $loop_cnt < count($input); $loop_cnt++)
        {
                if($input[$loop_cnt] != $input_upper[$loop_cnt])
                {
                        $output[$loop_cnt] = $input_upper[$loop_cnt];
                }
                else if($input[$loop_cnt] != $input_lower[$loop_cnt])
                {
                        $output[$loop_cnt] = $input_lower[$loop_cnt];
                }
                else
                {
                        $output[$loop_cnt] = $input[$loop_cnt];
                }
        }
        echo implode($output) . "\n";


Measured memory_bytes: 9896
n, blue, red = map(int, input().split())

b_r = blue + red

round = int(n/b_r)

if n - (b_r * round) == 0:
  print(blue * round)
else:
  empty = n - (b_r * round)
  if empty < blue:
    print((blue * round) + empty)
  else:
    print((blue * round) + blue)

Measured memory_bytes: 3068
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <map>
#include <string>
#include <vector>
#include <cmath>
#include <random>
#include <climits>
#include <set>
#include <deque>
#include <queue>
#include <bitset>
#include <stack>
#include <regex>

#define mod 1000000007
#define INF2 9999999999
#define INF (1<<30)
#define rep(i,n) for(int (i)=0; (i)<(n); (i)++)
#define P pair<int, int>

using namespace std;
using ll = int64_t;

int dx[] = {1, 0, -1, 0};
int dy[] = {0, 1, 0, -1};
int DX[] = {1, 1, 0, -1, -1, -1, 0, 1};
int DY[] = {0, -1, -1, -1, 0, 1, 1, 1};

void solve(){
    int n;
    ll a, b, ans = 0;
    cin >> n >> a >> b;
    ll x[n];
    rep(i, n) cin >> x[i];

    for(int i = 1; i < n; i++){
        ans = min(ans+(x[i]-x[i-1])*a, ans+b);
    }
    cout << ans << endl;
}

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

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define repr(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define reprrev(i,a,b) for(int i=b-1;i>=a;i--) // [a, b)
#define reprev(i,n) reprrev(i,0,n)
#define _GLIBCXX_DEBUG

using ll = long long;
using ull = unsigned long long;
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 ll mod = 1e9+7;
void chmod(ll &M){
  if(M >= mod) M %= mod;
  else if(M < 0){
     M += (abs(M)/mod + 1)*mod;
    M %= mod;
}
}
ll modpow(ll x, ll n){
   if(n==0) return 1;
  ll res=modpow(x, n/2);
 if(n%2==0) return res*res%mod;
else return res*res%mod*x%mod;
}
int getl(int i, int N) { return i==0? N-1:i-1; };
int getr(int i, int N) { return i==N-1? 0:i+1; };
long long GCD(long long a, long long b) {
  if (b == 0) return a;
  else return GCD(b, a % b);
}

using namespace std;
/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */
int main()
{
    int A, B, C, D;
    cin >> A >> B >> C >> D;
//C-B と A-Dを繰り返す
    bool check = true;
    while(1) {
    C -= B;
    cerr << C << "\n";
    if(C <= 0) break; 
    A -= D;
    cerr << A << "\n";
    if(A <= 0) {check = false; break;}
    }
cerr << "value of 'check' is " << check << "\n";
if(check) cout << "Yes" <<"\n";
else cout << "No" << "\n";

}


Measured memory_bytes: 3652
#include <bits/stdc++.h>
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <math.h>
#define fi first
#define se second
#define rep(i,n) for(ll i=0;i<(n);i++)
#define rrep(i,n) for(ll i = 1; i <= (n); ++i)
#define drep(i,n) for(ll i = (n)-1; i >= 0; --i)
#define all(v) v.begin(),v.end()
#define len(x) (ll)(x).length()
#define maxs(x,y) x = max(x,y)
#define mins(x,y) x = min(x,y)
#define pb push_back
#define sz(x) (ll)(x).size()
#define v(T) vector<T>
#define vv(T) vector<vector<T>>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
ll gcd(ll a,ll b){if(a%b==0){return b;}else{return(gcd(b,a%b));}}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}
const int INF=1e9;
const ll MX = 1e18;
const int MOD=INF+7;
const int di[] = {-1,0,1,0};
const int dj[] = {0,-1,0,1};
const double PI=acos(-1);
 
int main() {
  int a,b;
  cin>>a>>b;
  cout<<a*b<<endl;
}

Measured memory_bytes: 3604
#include <bits/stdc++.h>
#define int long long
#define double long double
#define x first
#define y second
#define yy cout<<"YES\n"
#define nn cout<<"NO\n"
#define rt return
#define ct continue
#define br break
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define mmod 1000000007
#define pmod 998244353
using namespace std;
int gcd(int a,int b){
    while (b) b^=a^=b^=a%=b;
    return a;
}
int lcm(int a,int b){
    return a*b/gcd(a,b);
}
int bigmod(int b,int p,int m){
    int ans=1;
    b%=m;
    if (!b) return 0;
    while (p){
        if (p&1) ans=(ans*b)%m;
        p>>=1;
        b=(b*b)%m;
    }
    return ans;
}
void recur(){
	
	
	
}
void solve(){
	int n;
	cin>>n;
	pair <int,int> a[n];
	for (int i=0; i<n; i++){
		cin>>a[i].first>>a[i].second;
	}
	for (int i=2; i<n; i++){
		if (a[i-2].first==a[i-2].second&&a[i-1].first==a[i-1].second&&a[i].first==a[i].second){
			cout<<"Yes";
			rt;
		}
	}
	cout<<"No";
	
}
signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int t=1;
    //cin>>t;
    while (t--) solve();
}

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

using namespace std;
typedef long long ll;

//マクロ
//forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i,n) for(ll i=0;i<ll(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=ll(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=ll(b);i--)
//xにはvectorなどのコンテナ
#define ALL(x) x.begin(),x.end() //sortなどの引数を省略したい
#define SIZE(x) ll(x.size()) //sizeをsize_tからllに直しておく
#define LEN(x) ll(x.length()) //lengthをsize_tからllに直しておく
//定数
#define INF 1000000000000 //10^12:極めて大きい値,∞
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange(素数列挙などで使用)
//略記
#define PB emplace_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素
#define Umap unordered_map
#define Uset unordered_set

int main(){
    ll n;
    cin >> n;
    REP(i, n) cout << "ACL";
    return 0;
}

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

int a[10][10], b[10][10], c[10][10];
int dx[]{ 1,-1,0,0 }, dy[]{ 0,0,1,-1 };
int main() {
	int n; scanf("%d", &n);
	rep(i, n) {
		rep(i, 10)rep(j, 10)scanf("%d", &a[i][j]);
		rep(i, 1 << 10) {
			rep(j, 10)rep(k, 10)b[j][k] = a[j][k];
			memset(c, 0, sizeof(c));
			rep(j, 10)rep(k, 10) {
				if (!j) {
					if (i >> k & 1)continue;
				}
				else if (!b[j - 1][k])continue;
				c[j][k] = 1; b[j][k] = !b[j][k];
				rep(t, 4) {
					int nx = j + dx[t], ny = k + dy[t];
					if (0 <= nx&&nx < 10 && 0 <= ny&&ny < 10)b[nx][ny] = !b[nx][ny];
				}
			}
			rep(j, 10)rep(k, 10) {
				if (b[j][k])goto g;
			}
			rep(j, 10) {
				rep(k, 10) {
					if (k)printf(" ");
					printf("%d", c[j][k]);
				}
				printf("\n");
			}g:;
		}
	}
}

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

typedef long long ll;
typedef pair<ll,ll> pi;
typedef vector <ll> vi;
typedef vector <pi> vpi;
#define f first
#define s second
#define FOR(i,s,e) for(ll i=s;i<=ll(e);++i)
#define DEC(i,s,e) for(ll i=s;i>=ll(e);--i)
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define lbd(x, y) lower_bound(all(x), y)
#define ubd(x, y) upper_bound(all(x), y)
#define aFOR(i,x) for (auto i: x)
#define mem(x,i) memset(x,i,sizeof x)
#define fast ios_base::sync_with_stdio(false),cin.tie(0)

int K,A,B;
int main(){
	fast;
	
	cin>>K>>A>>B;
	
	FOR(i,A,B){
		if (i % K == 0){
			cout<<"OK";
			return 0;
		}
	}
	
	cout<<"NG";
}


Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i,s,n) for(int i = s; i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(n) (n).begin(), (n).end()
#define RALL(n) (n).rbegin(), (n).rend()
using ll = long long;
using ull = unsigned long long;

int main(void)
{
    IOS
    int n; cin >> n;
    vector<int> v(n+1,0);
    vector<int> ans(n+1,0);
    FOR(i,1,n+1) cin >> v[i];

    int count = 0;
    for(auto i = n;i > 0; i--) {
        int c = 0;
        for(auto j = i;j < n+1;j += i) {
            c += ans[j];
        }
        if (c % 2 != v[i]) {
            ans[i] = 1;
            count++;
        }
    }

    cout << count << endl;
    FOR(i,1,n+1) {
        //cerr << cnt[i] << endl;
        if(ans[i] == 1) cout << i << " ";
    }


    return 0;
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
#define ld long double
#define ll long long
#define pb push_back
#define F first
#define S second
const int A = 3e2 + 2;
const int mod = 1e9 + 7;
int n;
bool vis[A][A][A];
ld mem[A][A][A];
ld solve (int c1, int c2, int c3) {
    if (c1 + c2 + c3 == 0) return 0;
    if (vis[c1][c2][c3])
        return mem[c1][c2][c3];
    vis[c1][c2][c3] = 1;
    int c0 = n - (c1 + c2 + c3);
    ld ret = 1;
    if (c1)
        ret += solve(c1 - 1, c2, c3) * (c1 / (n * 1.0));
    if (c2)
        ret += solve(c1 + 1, c2 - 1, c3) * (c2 / (n * 1.0));
    if (c3)
        ret += solve(c1, c2 + 1, c3 - 1) * (c3 / (n * 1.0));
    ret /= (1 - (c0 / (n * 1.0)));
    return mem[c1][c2][c3] = ret;
}
int main() {
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    cin >> n;
    int freq[4] = {};
    for (int i = 0, x; i < n; i++) {
        cin >> x;
        freq[x]++;
    }
    cout << setprecision(9) << fixed << solve(freq[1], freq[2], freq[3]);
    return 0;
}

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

using namespace std;
typedef long long ll;

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

int main()
{
  int N, X;
  cin >> N >> X;
  
  vector<int> L(N);
  for(int i=0; i<N; i++)
    cin >> L[i];

  vector<ll> D(N);
  D[0]=0;
  ll count=1;
  for(int i=1; i<N+1; i++)
    {
      D[i]=D[i-1]+L[i-1];
      if(D[i]>X)
	break;
      count++;
    }
  cout << count << endl;


  return 0;
}


//cout << setprecision(13);
//next_permutation();
//__gcd();
//reverse();
//set ,tuple ,pair;
//bitset
//vector.find
//vector.count



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,c) for(int i=0;i<c;++i)
int  main(){
 int a,b,c,d;
 int count = 0;
 int yon = 0;
 cin >> a>> b>> c>> d;
 while(c>0||a>0){ 
   c = c-b;
   count++;
   if(c<=0){
     break;
   }
    a = a-d;
   yon ++;
   if(a<=0){
     break;
   }
 }
 if(count==yon){
   cout << "No" << endl;
 }else{
   cout << "Yes" << endl;
 }
 
return 0;
}

Measured memory_bytes: 3592
#[allow(unused_imports)]
use std::cmp;
use std::io::Write;

// Input macro from https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
  (source = $s:expr, $($r:tt)*) => {
    let mut iter = $s.split_whitespace();
    input_inner!{iter, $($r)*}
  };
  ($($r:tt)*) => {
    let s = {
      use std::io::Read;
      let mut s = String::new();
      std::io::stdin().read_to_string(&mut s).unwrap();
      s
    };
    let mut iter = s.split_whitespace();
    input_inner!{iter, $($r)*}
  };
}

macro_rules! input_inner {
  ($iter:expr) => {};
  ($iter:expr, ) => {};

  ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
    let $var = read_value!($iter, $t);
    input_inner!{$iter $($r)*}
  };
}

macro_rules! read_value {
  ($iter:expr, ( $($t:tt),* )) => {
    ( $(read_value!($iter, $t)),* )
  };

  ($iter:expr, [ $t:tt ; $len:expr ]) => {
    (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
  };

  ($iter:expr, chars) => {
    read_value!($iter, String).chars().collect::<Vec<char>>()
  };

  ($iter:expr, usize1) => {
    read_value!($iter, usize) - 1
  };

  ($iter:expr, [ $t:tt ]) => {{
    let len = read_value!($iter, usize);
    (0..len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
  }};

  ($iter:expr, $t:ty) => {
    $iter.next().unwrap().parse::<$t>().expect("Parse error")
  };
}

fn main() {
  let out = std::io::stdout();
  let mut out = std::io::BufWriter::new(out.lock());
  macro_rules! puts {
    ($($format:tt)*) => (write!(out,$($format)*).unwrap());
  }
  input! {
    a: [i32; 3],
  }
  let mut a = a;
  a.sort();
  a.dedup();

  puts!("{}\n", if a.len() == 2 { "Yes" } else { "No" });
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
#define endl "\n"
using namespace std;
typedef long long int ll;
typedef vector<ll> vl;
typedef pair<ll, ll> PP;
#define rep(i, n) for(ll i = 0; i < ll(n); i++)
#define all(v) v.begin(), v.end()
#define ITR(v, i) for(auto ite = v.begin(); ite != v.end(); ite++)
const ll INF = 999999999999999;
const ll MOD = 1000000007;
const ll MAX_N = 500010;
ll a, b, c, d, e, f, p, t, x, y, z, q, m, n, r, h, k, w, l, ans;
vl g[MAX_N];
vl visited(MAX_N, 0);
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> n >> m;
    vl A;
    rep(i, n) {
        cin >> x;
        A.push_back(x);
    }

    rep(i, m) {
        cin >> a >> b;
        a--;
        b--;
        g[a].push_back(b);
        g[b].push_back(a);
    }

    rep(i, n) {
        t = 1;
        for(ll j : g[i]) {
            if(A[j] >= A[i])
                t = 0;
        }
        ans += t;
    }

    cout << ans << endl;
}

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

using namespace std;

int main(int argc, char const *argv[])
{
    string s1, s2, s3;
    string c1_last, c2_first, c2_last, c3_first;

    cin >> s1 >> s2 >> s3;

    c1_last = s1.back();
    c2_first = s2[0];
    c2_last = s2.back();
    c3_first = s3[0];

    /*
    cout << c1_last << endl;
    cout << c2_first << endl;
    cout << c2_last << endl;
    cout << c3_first << endl;
    */

    if ((c1_last == c2_first) && (c2_last == c3_first))
    {
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }


    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fast() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long int
using namespace std;
 
int main() {
    fast();
   /* ll t;
    cin>>t;
    while(t--)
    {
       
    }*/
    ll h,n;
    cin>>h>>n;
    ll a[n],b[n];
    for(ll i=0;i<n;i++)
    cin>>a[i]>>b[i];
    ll dp[n][h+1];
    memset(dp,0,sizeof(dp));
    for(ll i=1;i<=h;i++)
    {
        if(i<=a[0])
        dp[0][i]=b[0];
        else
        dp[0][i]=dp[0][i-a[0]]+b[0];
    }
    for(ll i=1;i<n;i++)
    {
        for(ll j=1;j<=h;j++)
        {
            if(j<=a[i])
            dp[i][j]=min(dp[i-1][j],b[i]);
            else
            dp[i][j]=min(dp[i-1][j],dp[i][j-a[i]]+b[i]);
        }
    }
    cout<<dp[n-1][h]<<endl;
}


Measured memory_bytes: 78464
#include<iostream>
using namespace std;
int main()
{
    int n, x;
    cin>>n;
    for(int i=1; i<=n; i++)
    {
        x = i;
        if(x%3 == 0) 
        {
            cout<<" "<<i;
            continue;
        }
        while(x)
        {
            if(x%10 == 3)
                {
                    cout<<" "<<i;
                    break;
                }
                x /= 10;
            }
    }
    cout<<endl;
}


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

#define int            long long 
#define vi             vector<int>
#define mod            1000000007
#define MAX            INT_MIN
#define MIN            INT_MAX
#define ff             first
#define ss             second
#define pb             push_back
#define mp             make_pair
#define pii            pair<int,int>
#define pqb            priority_queue<int>
#define setbits(x)     __builtin_popcountll(x)
#define zrobits(x)     __builtin_ctzll(x)
#define ps(x,y)        fixed<<setprecision(y)<<x         
#define FIO            ios_base::sync_with_stdio(false); cin.tie(NULL);
                  
void c_p_c()
{
	#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
	#endif
}

int32_t main()
{
	c_p_c();

	int n;
	cin>>n;

	int temp = n%10;

	if(temp==2 or temp==4 or temp==5 or temp==7 or temp==9)
		{
			cout<<"hon";
		}
	else if(temp==0 or temp==1 or temp==6 or temp==8)	
	{
		cout<<"pon";
	}
	else
		cout<<"bon";
	
	return 0;
}


Measured memory_bytes: 3636
#include"bits/stdc++.h"
using namespace std;

int main() {
	int N;
	cin >> N;
	vector<int> a(N);
	for (int i = 0;i < N;++i) {
		cin >> a[i];
	}
	sort(a.begin(), a.end());
	int A = 0, B = 0;
	for (int i = 0;i < a.size();i += 2) {
		A += a[a.size() - 1 - i];
		if (i + 1 < a.size()) {
			B += a[a.size() - 2 - i];
		}
	}
	cout << A - B << endl;
	return 0;
}


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

cost = 0
for i in range(n+2):
    cost += (abs(a[i] - a[i-1]))

for i in range(1, n+1):
    print(cost + abs(a[i-1]-a[i+1]) - (abs(a[i-1]-a[i]) + abs(a[i]-a[i+1])))

Measured memory_bytes: 14040
using System;

namespace abc141
{
    class Program
    {
        static void Main(string[] args)
        {
            string S = Console.ReadLine();
            string ans;
            if(S=="Sunny"){
                ans = "Cloudy";
            }else if(S=="Cloudy"){
                ans = "Rainy";
            }else{
                ans = "Sunny";
            }
            Console.WriteLine(ans);
        }
    }
}


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

dp = [[0]*3 for i in range(n+1)]

for i in range(n):
    a,b,c = map(int, input().split())
    dp[i+1][0] = max(dp[i][1], dp[i][2]) + a
    dp[i+1][1] = max(dp[i][2], dp[i][0]) + b
    dp[i+1][2] = max(dp[i][0], dp[i][1]) + c
print(max(dp[-1]))

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

bool find(const int n, const int *A, const int m)
{
//    printf("n %d m %d :", n, m);
//    for (int i = 0; i < n; i++) printf("%d ", A[i]);
//    printf("\n");
    if ( n == 0 ) {
//        printf("  n == 0 false\n");
        return false;
    }

    for (int i = 0; i < n; i++) {
        if ( A[i] == m ) {
//            printf("  A[%d] true\n", i);
            return true;
        }
        if ( A[i] > m ) continue;
        if (find(n-i-1, A+i+1, m - A[i])) return true;
    }

//    printf("  false\n");
    return false;
}


int main (void) {

    int n,q;
    int A[20];
    int m;

    scanf("%d", &n);
    for (int i = 0; i < n; i++) {
        scanf("%d", &A[i]);
    }
    scanf("%d", &q);
    for (int i = 0; i < q; i++) {
        scanf("%d", &m);
        if (find(n, A, m)) {
            printf("yes\n");
        }
        else {
            printf("no\n");
        }
    }
}



Measured memory_bytes: 2680
#include <bits/stdc++.h>
#include <stdio.h>
#include<iostream>
#include<cstdio>
#include<bitset>
#include<algorithm>
#include<vector>
#include<list>
#include<queue>
#include<stack>
#include<string>
#include<string.h>
#include<cmath>
#include<utility>
#include<functional>
#include<map>
#include<set>
#include<cctype>
#include<fstream>
#include <numeric>
#include <iomanip>
#include <cstring> 
using namespace std;
using ll=long long;

#define FOR(i, a, b) for( int i=(a);i<=(b);i++)
#define RFOR(i, a, b) for( int i=(a);i>=(b);i--)
#define LFOR(i, a, b) for( long long int i=(a);i<=(b);i++)
#define LRFOR(i, a, b) for(long long int i=(a);i>=(b);i--)
#define MOD 1000000007
#define LLONG_MAXs 9223372036854775800

#include <iostream>
#include <cmath>
using namespace std;
 

 
bool isPrimeNum( ll x ){ // 素数である場合 true を返す
  if( x <= 1 ){ // 1以下である場合は素数でないことがすぐにわかる
    return false;
  }
  // sqrt( double型 ) は引数の平方根を double型で返すので、int型でキャスト
  int n = (int)sqrt( (double)x );
  for( int i = 2; i <= n; i++ ){
    if( x % i == 0 ){ // 割り切る整数がある場合、即判定終了
      return false;
    }
  }
  return true; // 割り切る整数がない場合、素数である
}

constexpr ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
constexpr ll lcm(ll a,ll b){return a*b/gcd(a,b);}
constexpr ll abs(ll a,ll b){
if(a>=b)return a-b;
if(a<b)return b-a;
}
constexpr ll min(ll a,ll b){
if(a>=b)return b;
if(a<b)return a;
}

constexpr ll max(ll a,ll b){
if(a>=b)return a;
if(a<b)return b;
}

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

struct UnionFind {
    vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

    UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
        for(int i = 0; i < N; i++) par[i] = i;
    }

    int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) { // xとyの木を併合
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
    }

    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};

int main() {
  ll a,b,c,k,ans;
  cin>>a>>b>>c>>k;

  if(k%2!=0){
    ans=b-a;
  }else{
    ans=a-b;
  }

  if(abs(ans,0)>10e18){
    cout<<"Unfair"<<endl;
    return 0;
  }


cout<<ans<<endl;
return 0;

}
 


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <algorithm>
#include <math.h>
#include <map>
#include <functional>
#include <queue>
#include <stack>
#include <string.h>
#include <list>
using namespace std;
typedef long long ll;
#define all(a)  (a).begin(), (a).end()
#define rall(a) (a).rbegin(),(a).rend()
#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 PB push_back
#define MP make_pair
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))


int main() {
    int a, b;
    cin >> a >> b;
    cout << max(a+b,max(a-b,a*b)) << endl;
    return 0;
}


Measured memory_bytes: 256