akhauriyash/Code-Regression huggingface dataset:
n,m=map(int,input().split())
H=list(map(int,input().split()))
H.insert(0,0)
check=[1 for _ in range(n+1)]
check[0]=0
for _ in range(m):
    a,b=map(int,input().split())
    if H[a]>H[b]:
        check[b]=0
    elif H[a]<H[b]:
        check[a]=0
    else:
        check[a]=0
        check[b]=0

print(sum(check))

Measured memory_bytes: 19988
import java.util.*;
import java.io.*;
 
public class Main {
    public static void main(String[] args) throws Exception {
        FastScanner sc = new FastScanner(System.in);
        char[] s = sc.next().toCharArray();
        for(int i = 0; i < s.length; i++){
            if(i % 2 == 1 && s[i] == 'R' || i % 2 == 0 && s[i] == 'L'){
                System.out.println("No");
                return;
            }
        }
        System.out.println("Yes");
    }
}

class FastScanner {
    private BufferedReader reader = null;
    private StringTokenizer tokenizer = null;
    public FastScanner(InputStream in) {
        reader = new BufferedReader(new InputStreamReader(in));
        tokenizer = null;
    }

    public String next() {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                tokenizer = new StringTokenizer(reader.readLine());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken();
    }

    public String nextLine() {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                return reader.readLine();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken("\n");
    }

    public long nextLong() {
        return Long.parseLong(next());
    }

    public int nextInt() {
        return Integer.parseInt(next());
    }

    public double nextDouble() {
         return Double.parseDouble(next());
    }

    public int[] nextIntArray(int n) {
        int[] a = new int[n];
        for (int i = 0; i < n; i++)
            a[i] = nextInt();
        return a;
    }

    public long[] nextLongArray(int n) {
        long[] a = new long[n];
        for (int i = 0; i < n; i++)
            a[i] = nextLong();
        return a;
    }
    
    public double[] nextDoubleArray(int n) {
        double[] a = new double[n];
        for (int i = 0; i < n; i++)
            a[i] = nextDouble();
        return a;
    } 
}


Measured memory_bytes: 23124
/*
 * author :Sadik Hassan
 *
*/
#include "bits/stdc++.h"
using namespace std;
#define ll            long long
#define nl            "\n"
#define pb            push_back
#define fi            first
#define se            second
#define PI            (acos(-1.0))
#define _SAD()        ios::sync_with_stdio(0),cin.tie(0), cout.tie(0);
#define rep(i,a,n)    for(int i=a;i<n;i++)
#define SZ(s)         s.size()
#define SRT(x,y)      sort(x,x+y)
#define REV(a,b)      reverse(a,a+b)
#define VSRT(x)       sort(x.begin(),x.end())
#define VREV(x)       reverse(x.begin(),x.end())
#define TSFL(s)       transform(s.begin(),s.end(),s.begin(),::toupper);
#define TSFH(s)       transform(s.begin(),s.end(),s.begin(),::tolower);
typedef vector<int> vi;
typedef vector<ll> vii;
typedef set<int> si;
typedef set<ll> sii;
/*---------------------------------------------------------------------*/

const int N = 2e5+10;
const int INF = (int)1e9+5;

int main()
{
    _SAD()
    int n;
    cin>>n;
    ll ans=0;
    rep(i,0,n+1)
    {
        if(i%3!=0&&i%5!=0)
        {
            ans+=i;
        }
    }
    cout<<ans<<nl;
    return 0;
}


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

void solve() {
  int n;
  cin >> n;
  unordered_map<string, int> m;
  rep(i, n) {
    string s;
    cin >> s;
    sort(s.begin(), s.end());
    m[s]++;
  }
  ll ans = 0;
  for(auto& itr: m) {
    ll t = itr.second;
    ans += (t * (t - 1)) / 2;
  }
  cout << ans << endl;

}

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


Measured memory_bytes: 10660
import sys
input = lambda: sys.stdin.readline().rstrip()
N = int(input())
X = []
mih, mah, mil, mal = 10 ** 9, 0, 10 ** 9, 0
for _ in range(N):
    x, y = map(int, input().split())
    x, y = min(x, y), max(x, y)
    X.append((x, y))
    mih = min(mih, y)
    mah = max(mah, y)
    mil = min(mil, x)
    mal = max(mal, x)

ans = (mal - mil) * (mah - mih)

Y = []
for x, y in X:
    if mih <= x <= mal or mih <= y <= mal:
        continue
    Y.append((x, y))

Y = sorted(Y, key = lambda a: a[0])
Z = [(0, mal)]
may = 0
for x, y in Y:
    if y > may:
        Z.append((x, y))
        may = y

Z.append((mih, 10 ** 9))
for i in range(len(Z) - 1):
    ans = min(ans, (Z[i][1] - Z[i+1][0]) * (mah - mil))
print(ans)

Measured memory_bytes: 59992
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double lf;
typedef pair<ll,ll> ii;
#define REP(i,n) for(int i=0;i<n;i++)
#define REP1(i,n) for(ll i=1;i<=n;i++)
#define RST(i,n) memset(i,n,sizeof i)
#define SZ(a) (int)a.size()
#define ALL(a) a.begin(),a.end()
#define X first
#define Y second
#define mkp make_pair
#define pb push_back
#define eb emplace_back
#define pob pop_back
#ifdef cold66
#define debug(...) do{\
    fprintf(stderr,"%s - %d (%s) = ",__PRETTY_FUNCTION__,__LINE__,#__VA_ARGS__);\
    _do(__VA_ARGS__);\
}while(0)
template<typename T>void _do(T &&_x){cerr<<_x<<endl;}
template<typename T,typename ...S> void _do(T &&_x,S &&..._t){cerr<<_x<<", ";_do(_t...);}
template<typename _a,typename _b> ostream& operator << (ostream &_s,const pair<_a,_b> &_p){return _s<<"("<<_p.X<<","<<_p.Y<<")";}
template<typename It> ostream& _OUTC(ostream &_s,It _ita,It _itb)
{
    _s<<"{";
    for(It _it=_ita;_it!=_itb;_it++)
    {
        _s<<(_it==_ita?"":",")<<*_it;
    }
    _s<<"}";
    return _s;
}
template<typename _a> ostream &operator << (ostream &_s,vector<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a> ostream &operator << (ostream &_s,set<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a,typename _b> ostream &operator << (ostream &_s,map<_a,_b> &_c){return _OUTC(_s,ALL(_c));}
template<typename _t> void pary(_t _a,_t _b){_OUTC(cerr,_a,_b);cerr<<endl;}
#define IOS()
#else
#define debug(...)
#define pary(...)
#define endl '\n'
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0);
#endif // cold66
//}
template<class T> inline bool chkmax(T &a, const T &b) { return b > a ? a = b, true : false; }
template<class T> inline bool chkmin(T &a, const T &b) { return b < a ? a = b, true : false; }
template<class T> using MaxHeap = priority_queue<T>;
template<class T> using MinHeap = priority_queue<T, vector<T>, greater<T>>;

const ll MAXn=2e3+5,MAXlg=__lg(MAXn)+2;
const ll MOD=1000000007;
const ll INF=0x3f3f3f3f3f3f3f3f;

ll n,k,q;
ll d[MAXn];
ll chk(ll x){
  debug(x);
  vector<vector<ll> > tmp;
  REP (i,n) {
    vector<ll> tt;
    while (i < n && d[i] >= x) tt.eb(d[i++]);
    if (SZ(tt)) tmp.eb(tt);
  }
  debug(tmp);

  vector<ll> ret;
  REP (i,SZ(tmp)) {
    vector<ll> tt = tmp[i];
    if (SZ(tt) < k) continue;
    sort(ALL(tt));
    REP (j,SZ(tt)-k+1) ret.eb(tt[j]);
  }
  sort(ALL(ret));
  debug(ret);
  if (SZ(ret) < q) return INF;
  return ret[q-1] - ret[0];
}
int main(){
  IOS();
  cin >> n >> k >> q;
  REP (i,n) {
    cin >> d[i];
  }

  ll ans = INF;
  REP (i,n) {
    ans = min(ans,chk(d[i]));
  }
  cout << ans << endl;
}


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

int main() {
  int A, B, K; cin >> A >> B >> K;
  vector<int> cd;
  for (int i = 1; i <= min(A, B); i++) {
    if (A % i == 0 && B % i == 0) {
      cd.push_back(i);
    }
  }
  cout << cd.at(cd.size() - K) << endl;
  return 0;
} 

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

using namespace std;

#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define INF (1LL << 55)
#define MOD (1000 * 1000 * 1000 + 7)
#define maxn 200111

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;

vector<int> v;

int main(){
	int n, a, b;
	scanf("%d%d%d", &n, &a, &b);


	v.pb(0);
	for(int i = 1; i <= n; i++)
		v.pb(i);

	reverse(v.end() - b, v.end());

	int left = n - b;
	if(a == 1 && left != 0){
		printf("-1\n");
		return 0;
	}

	if(a > 1){
		int maxsz = left / (a - 1) + (left % (a - 1) != 0);
		int minsz = left / (a - 1);

		if(maxsz > b || minsz == 0){
			printf("-1\n");
			return 0;
		}

		int ind = 1;
		int x = a - 1;
		left = n - b;
		while(x > 0 && left > 0){
			int sz = left / x;
			reverse(v.begin() + ind, v.begin() + ind + sz);
			left -= sz;
			ind += sz;
			x--;
		} 
	}

	for(int i = 1; i <= n; i++)
		printf("%d ", v[i]);
	
	return 0;
}

Measured memory_bytes: 3440
#include <stdio.h>

int main()
{
  int i, n, q, t, cnt=0;
  int beg, end, ctr;
  char *p=NULL;
  size_t linecap = 0;
  getline(&p, &linecap, stdin);
  for (n=0; *p!='\n'; n=n*10+*(p++)-'0');
  int s[n];
  p = NULL;
  getline(&p, &linecap, stdin);
  for (s[0]=0,i=0; *p!='\n'; p++) {
    if (*p==' ') s[++i] = *(++p)-'0';
    else         s[i] = s[i] * 10 + *p - '0';
  }
  p = NULL;
  getline(&p, &linecap, stdin);
  for (q=0; *p!='\n'; q=q*10+*(p++)-'0');
  p = NULL;
  getline(&p, &linecap, stdin);
  for (i=0; i<q; i++) {
    for (t=0; *p>='0'; t=t*10+*(p++)-'0');
    p++;
    beg = 0;
    end = n-1;
    while (beg<=end) {
      ctr = (beg+end)/2;
      if (t==s[ctr]) {
	cnt++;
	break;
      } else if (t<s[ctr]) {
	end=ctr-1;
      } else { // t>s[ctr]
	beg=ctr+1;
      }
    }
  }
  printf("%d\n", cnt);
  return 0;
}



Measured memory_bytes: 3616
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<tuple>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = (ll)1000000007 * 1000000007;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define Per(i,sta,n) for(int i=n-1;i>=sta;i--)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef long double ld;
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ll, ll> LP;

string s;

void solve(){
    cin >> s;
    if (s.substr(0,s.length())=="Sunny") cout << "Cloudy" << endl;
    if (s.substr(0,s.length())=="Cloudy") cout << "Rainy" << endl;
    if (s.substr(0,s.length())=="Rainy") cout << "Sunny" << endl;
}

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
typedef long long int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define MOD (1000000007)
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1}; // 移動方向
const int MAX_N = 100010;

int n;
int a[MAX_N],b[MAX_N],c[MAX_N];
int dp[MAX_N][3];

void input(){
    cin >> n;
    for(int i=0;i<n;i++) cin >> a[i] >> b[i] >> c[i];
}

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    input();
    for(int i=0;i<MAX_N;i++) for(int j=0;j<3;j++) dp[i][j] = -INF;
    dp[0][0] = a[0];
    dp[0][1] = b[0];
    dp[0][2] = c[0];
    for(int i=0;i<n;i++){
        chmax(dp[i+1][0], max(dp[i][1]+a[i+1], dp[i][2]+a[i+1]));
        chmax(dp[i+1][1], max(dp[i][0]+b[i+1], dp[i][2]+b[i+1]));
        chmax(dp[i+1][2], max(dp[i][0]+c[i+1], dp[i][1]+c[i+1]));
    }
    int ans = -INF;
    for(int i=0;i<3;i++) ans = max(ans, dp[n-1][i]);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define int long long int
#define pb push_back
#define mk make_pair
#define flp(i, k, n) for(int i=k; i<n; i++)
#define rev(i, k) for(int i=k; i>=0; i--)
#define F first
#define S second

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

int32_t main(void)
{
    int n, k, c;
    string s;
    cin>>n>>k>>c;
    cin>>s;
    vector<int> v1(k, 0), v2(k, 0);
    int j=0;
    flp(i, 0, k)
    {
        while(s[j]=='x') j++;
        v1[i]=j;
        j+=(c+1);
    }
    j=n-1;
    rev(i, k-1)
    {
        while(s[j]=='x') j--;
        v2[i]=j;
        j-=(c+1);
    }

    flp(i, 0, k)
    {
        if(v1[i]==v2[i]) cout<<v1[i]+1<<"\n";
    }


    return 0;

}

Measured memory_bytes: 4996
#include "bits/stdc++.h"
using namespace std;
#define F first
#define S second
#define show(x) cout<<#x<<" "<<x<<" ";
#define f(i,j,k) for(int i = j;i<=k;i++)
#define fr(i,j,k) for(int i = j;i>=k;i--)
#define ll long long
#define all(A)  A.begin(),A.end()  
#define FIO ios_base::sync_with_stdio(false);cin.tie(NULL);  
const int MSIZE = 1e3+5;
const int MOD = 1e9+7;

int dp[MSIZE][MSIZE];

int main(){
    FIO
    int n, m ; cin>>n>>m;
    f(i,0,n-1) f(j,0,m-1) {
        char c; cin>>c;
        dp[i][j]= -1*(c=='#');
        
        if(dp[i][j]==-1)    continue;
        if(i==0 && j==0)  { dp[i][j]=1; continue; }
        dp[i][j]=max(0,i==0?0:dp[i-1][j])+max(0,j==0?0:dp[i][j-1]);
        dp[i][j]%=MOD;
    }   

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

}
    


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

int main() {
  int h, w;
  cin >> h >> w;

  vector<string> vec(h+1);
  vec[0] = "";
  vec[h] = "";
  for(int i=1; i<=h; i++){
    string v;
    cin >> v;
    v = ' '+v+' ';
    vec[i] = v;
  }

  for(int i=1; i<=h; i++){
    string v = vec[i];
    for(int j=1; j<=w; j++){
      if(vec[i][j]=='#'){
        cout << "#";
        continue;
      }
      int t = 0;
      if(i!=1){
        if(vec[i-1][j-1]=='#') t++;
        if(vec[i-1][j]=='#') t++;
        if(vec[i-1][j+1]=='#') t++;
      }
      if(vec[i][j-1]=='#') t++;
      if(vec[i][j+1]=='#') t++;
      if(i!=h){
        if(vec[i+1][j-1]=='#') t++;
        if(vec[i+1][j]=='#') t++;
        if(vec[i+1][j+1]=='#') t++;
      }
      cout << t;
    }
    cout << endl;
  }
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] b = new int[n-1];

        for(int i = 0; i < n-1; i++) {
        	b[i] = sc.nextInt();
        }

        long sum = b[0];

        for(int i = 1; i < n-1; i++) {
        	sum += (b[i-1] < b[i]) ? b[i-1] : b[i];
        }

        sum += b[n-2];

        System.out.println(sum);
    }
}

Measured memory_bytes: 25044
#include<iostream>
using namespace std;
int main(){
  int x,y;
  cin >> x >> y;
  if(y%2!=0){
    cout << "No" << endl;
  }
  else if(x*2>y || x*4<y){
    cout << "No" << endl;
  }
  else{
    cout << "Yes" << endl;
  }
  return 0;
}


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

using namespace std;

typedef long long  ll;

const int MAX_N = 26 * 12 * 14 * 10;
vector<string> memo[MAX_N];

int Key(string x) {
    int sum = 0;
    for (int i = 0, size = x.size(); i < size; ++i)
        sum = (sum + (i + size) * (int)(x[i] - 'A')) % MAX_N;
    return sum % MAX_N;
}

void Insert(string x)
{
    int idx = Key(x);
    memo[idx].emplace_back(x);
}

bool Find(string x)
{
    int idx = Key(x);
    for (auto y : memo[idx])
        if (y == x)
            return true;
    return false;
}

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

    int n;
    string s, x;

    cin >> n;
    for (int i = 0; i < n; ++i) {
        cin >> s >> x;
        if (s == "insert")
            Insert(x);
        else if (s == "find")
            cout << (Find(x) ? "yes\n" : "no\n" );
    }

    return 0;
}

Measured memory_bytes: 36388
#include <iostream>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <cstdio>
#include <fstream>
#include <map>
#include <vector>
//#include <unordered_map>
//#include <unordered_set>
#include <stack>
#include <set>
#include <queue>
#include <list>

using namespace std;
long long mod=1e9+7;
long long k[100005];
int f[100005];
int main()
{
    int n,z;
    scanf("%d",&n);
    for(int i=1;i<=n;++i)
        scanf("%d",&f[i]);
    f[1]=1;
    if(f[2]>2) f[2]=3;
    k[1]=1;
    k[2]=2;
    for(int i=3;i<=n;++i)
    {
        if(f[i]>f[i-1]+1) f[i]=f[i-1]+2;
        k[i]=(k[i-1]*(i-(2*(i-1)-f[i-1])/2))%mod;
    }
    cout<<k[n]<<endl;
    return 0;
}


Measured memory_bytes: 1536
package main

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

var reader = bufio.NewReaderSize(os.Stdin, 1000000)
var writer = bufio.NewWriter(os.Stdout)
func NextLine() string {
  buffer := make([]byte, 0)
  for true {
    line, isPrefix, err := reader.ReadLine()
    if err != nil { panic(err) }
    buffer = append(buffer, line...)
    if !isPrefix { break }
  }
  return string(buffer)
}
func NextInt(A ...*int) {
  L := strings.Split(NextLine(), " ")
  for i, a := range A {
    *a, _ = strconv.Atoi(L[i])
  }
}
func NextIntVec(A *[]int) {
  L := strings.Split(NextLine(), " ")
  (*A) = make([]int, len(L))
  for i, l := range L {
    (*A)[i], _ = strconv.Atoi(l)
  }
}
func Write(s interface{}) {
  fmt.Fprintln(writer, s)
}
func WriteIntVec(A []int) {
  S := make([]string, len(A))
  for i, a := range A {
    S[i] = strconv.Itoa(a)
  }
  Write(strings.Join(S, " "))
}
func Output() {
  _ = writer.Flush()
}

func MaxInt(A ...int) int {
  max := A[0]
  for _, a := range A {
    if max < a { max = a }
  }
  return max
}
func MinInt(A ...int) int {
  min := A[0]
  for _, a := range A {
    if a < min { min = a }
  }
  return min
}
func SumInt(A ...int) int {
  sum := 0
  for _, a := range A {
    sum += a
  }
  return sum
}

func Solve() {
  var k, q int
  NextInt(&k, &q)
  var D []int
  NextIntVec(&D)
  var n, x, m int
  Dm := make([]int, k + 1)
  Z := make([]int, k + 1)
  for i := 0; i < q; i++ {
    NextInt(&n, &x, &m)
    a0 := x % m
    for i, d := range D {
      Dm[i + 1] = Dm[i] + d % m
      Z[i + 1] = Z[i]
      if d % m == 0 { Z[i + 1]++ }
    }
    an := a0 + Dm[k] * ((n - 1) / k) + Dm[(n - 1) % k]
    z := Z[k] * ((n - 1) / k) + Z[(n - 1) % k]
    Write(n - 1 - (an / m) - z)
  }
  return
}

func main() {
  Solve()
  Output()
}

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

int main() {
    int N;
    cin >> N;
    queue<int64_t> Q;
    for (int i = 1; i <= 9; i++) Q.push(i);
    for (int i = 1; i < N; i++) {
        int64_t x = Q.front();
        int d = x % 10;
        Q.pop();
        if (d) Q.push(x * 10 + d - 1);
        Q.push(x * 10 + d);
        if (d < 9) Q.push(x * 10 + d + 1);
    }
    cout << Q.front() << endl;
}

Measured memory_bytes: 1792
import java.util.Scanner;
    
    class Main {
     
        public static void main(String[] args) {
            Scanner sc = new Scanner(System.in);
            int N = sc.nextInt();
            sc.close();
            long power = 1;
            long c = (long) (Math.pow(10, 9) + 7);
            long div = 0;
            
            for (int i = 1; i <= N; i++) {
            	power *= i;
            	power %= c;
            }
            System.out.println(power);
        }
    }

Measured memory_bytes: 21588
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repi(i, s, n) for (int i = (s); i < (n); i++)
#ifdef LOCAL
#define INPUT_FILE                   \
  ifstream in("abc174/abc174_a.txt"); \
  cin.rdbuf(in.rdbuf());
#define print_vec(v) \
rep(l, v.size()) { cout << v[l] << " "; } \
cout << endl;
#else
#define INPUT_FILE
#define print_vec(v)
#endif
#define CIN_OPTIMIZE \
  cin.tie(0);        \
  ios::sync_with_stdio(false);
typedef pair<int, int> P;
typedef long long ll;
typedef pair<ll, ll> pl;
const int INF = 100100100;
const ll LINF = 1e18+100;
const int MOD = 1e9 + 7;

int main() {
  INPUT_FILE CIN_OPTIMIZE;

  int N;
  cin >> N;
  
  cout << (N >= 30 ? "Yes" : "No") << endl;
}

Measured memory_bytes: 3620
#include<bits/stdc++.h>
using namespace std;
#define M 1<<25
long long a[M],b[M],c[M],x[M],n,p,q,sum,maxn;
int main() {
    cin>>n>>p>>q;c[0]=p*q;
    for(int i=0;i<n;i++){cin>>b[i];a[i]=b[i]-(q-i)*p;sum+=b[i];}
    sort(a,a+n);maxn=sum;
    for(int i=0;i<n;i++){
        sum-=a[i];
        sum+=2*i*p;
        maxn=max(sum,maxn);
    }
    cout<<maxn<<endl;
}

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

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

long long MOD = 10000000000 + 7;

int main(){
  cout << setprecision(10);
  ll N,D; cin >> N >> D;
  int ans = 0;
  for(int i =0 ; i< N; i++){
    ll x,y; cin >> x >> y;
    if(x*x + y*y <= D*D){
      ans++;
    }
  }
  cout << ans << endl;
}


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


#define FOR(i, start, end) for(uint64_t i=start; i<end; i++)
#define REP(i, n) FOR(i, 0, n)

// 最大公約数gcd
// 最小公倍数lcm=m*n/gcd
uint64_t gcd(uint64_t m, uint64_t n) {
  uint64_t temp;
  while (m % n != 0){
    temp = n;
    n = m % n;
    m = temp;
  }
  return n;
}

uint64_t lcm(uint64_t m, uint64_t n) {
  return (m*n)/gcd(m,n);
}

// vector<vector<uint64_t> > v(n+1, vector<uint64_t>(n+1, 0))
// v[n][k]に組み合わせ数が入る。
void comb(vector<vector <uint64_t> > &v){
  for(uint64_t i = 0;i <v.size(); i++){
    v[i][0]=1;
    v[i][i]=1;
  }
  for(uint64_t k = 1;k <v.size();k++){
    for(uint64_t j = 1;j<k;j++){
      v[k][j]=(v[k-1][j-1]+v[k-1][j]);
    }
  }
}

// 掛け算オーバーフロー判定
bool is_product_overflow(uint64_t a, uint64_t b) {

	uint64_t prod = a * b;
	
	return (prod / b != a);
}

//素因数分解
void primeFactorization(uint64_t a, list<uint64_t> &factors){ //素因数分解を出力するプログラム
  long i,sq;
  if(a%2==0){ //偶数の場合
    factors.push_back(2);
    primeFactorization(a/2,factors); //2で割った値で再帰
    return;
  }
  sq = sqrt(a);
  for(i=3;i<=sq;i+=2){ //3以上√a以下の奇数の場合
	if(a%i==0){
	  factors.push_back(i);
      primeFactorization(a/i,factors); //割れた値で再帰
      return;
	}
  }
  //偶数でも3以上√a以下の奇数の場合でも割り切れない場合
  if(a!=1){ //aが1でないなら、a自身は素数
    factors.push_back(a);
  }
}

// フェルマーの小定理
// mod. m での a の逆元 a^{-1} を計算する
// (a/b)%m = a*movinv(b,m)%m  
int64_t modinv(int64_t a, int64_t m) {
    int64_t b = m, u = 1, v = 0;
    while (b) {
        int64_t t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}

// 円周率
// M_PI

// #include <iomanip> // setprecisionを使用するのに必要
// cout << std::fixed << std::setprecision(15) << y << endl;

// 昇順
// priority_queue<int, vector<int>, greater<int> > queue;

signed main() {
  string s;
  cin >> s;
  int len = s.length();
  int halfLen = s.length()/2;
  int count = 0;
  for(int i=0;i<halfLen;i++){
    if(s[i]!=s[len-1-i])count++;
  }
  cout << count << endl;
  return 0;
}




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

string S;

int main() {
	cin >> S;

	int ans = 0;
	char c = S[0];
	for( int i = 1; i < S.size(); i++ ) {
		if( S[i] == c ) {
			ans++;
		}
		if( c == '0' ) {
			c = '1';
		}
		else {
			c = '0';
		}
	}

	cout << ans << endl;

	return 0;
}


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

int main() {
    std::string s;
    std::cin >> s;

    int count = 0;
    for(int i = 1; i < 4; i++) {
        for(int j = 0; j < i; j++) {
            if(s[i] == s[j]) {
                count++;
            }
        }
    }

    if(count == 2) {
        std::cout << "Yes" << std::endl;
    } else {
        std::cout << "No" << std::endl;
    }
}


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

int main (void) {
    int k;
    string s;
    cin >> k >> s;
    string ans = "";

    if (s.length() <= k) {
        ans = s;
    } else {
        for (int i = 0; i < k; ++i) {
            ans += s[i];
        }
        ans += "...";
    }

    cout << ans << endl;


}

Measured memory_bytes: 3624
def resolve():
	N = int(input())
	H = list(map(int, input().split()))
	DP = [float('inf')]*N
	DP[0] = 0
	for i in range(0, N-1):
		DP[i+1] = min(DP[i+1], DP[i]+abs(H[i+1]-H[i]))
		if i + 2 < N:
			DP[i + 2] = min(DP[i + 2], DP[i] + abs(H[i + 2] - H[i]))
	print(DP[-1])
resolve()

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


int N;
int l[1000];
int r[1000];


int main() {
    cin >> N;
    for(int i = 0; i < N; i++)
        cin >> l[i] >> r[i];

    int sum = 0;
    for(int i = 0; i < N; i++)
        sum += r[i] - l[i] + 1;
    cout << sum << endl;

    return 0;
}


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

#define int long long
#define rep(i,l,r) for(int i=(int)(l);i<(int)(r);i++)
#define all(x) (x).begin(),(x).end()
#define pb push_back
template<class T>bool chmax(T &a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T &a,T b){if(a>b){a=b;return 1;}return 0;}

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;

const int inf = 1LL<<60;
const int mod = 1e9 + 7;
const double eps = 1e-9;

/*{
  }*/

int n;
vi g[200010];

pii dfs(int v, int p)
{
	pii res = {0, v};	
	for(auto e : g[v]) if(e != p){
		pii p = dfs(e, v);
		p.first++;
		if(res.first < p.first) res = p;
	}
	return res;
}

signed main()
{
	cin >> n;
	rep(i, 0, n-1){
		int a, b;
		cin >> a >> b;
		a--; b--;
		g[a].pb(b);
		g[b].pb(a);
	}

	pii x = dfs(0, -1);
	pii y = dfs(x.second, -1);

	if(y.first%3 == 1){
		cout << "Second" << endl;
	}else{
		cout << "First" << endl;
	}

	return 0;
}


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

int main(){
    ll a,b,c;
    cin >> a >> b >> c;
    ll res;
    res = (c-a-b)*(c-a-b)-4*a*b;
    if((c-a-b)<0) cout << "No" << endl;
    else if(res>0) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cmath>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<n;i++)

int main(){
    int n; cin >> n;
    int t,a, h; cin >> t >> a;
    int ans=0;
    int mindif=1e9;
    rep(i,n){
        cin >> h;
        int dif = abs((a*1000)-((t*1000)-(h*6)));
        if(mindif > dif) {
            mindif=dif;
            ans = i;
        }
    }
    cout << ans+1 << endl;
}

Measured memory_bytes: 256
use proconio::{fastout, input};
// use proconio::marker::*;

#[fastout]
fn main() {
   input! {
      n: usize,
      a: [usize; n]
   }

   for &i in a.iter() {
      if i==0 {
         println!("0");
         return;
      }
   }
   let mut ans = 1;
   let mx = 1e18 as usize;
   for &i in a.iter() {
      if i>mx/ans+1 {
         println!("-1");
         return;
      }
      ans *=i;
      if ans > mx {
         println!("-1");
         return;
      }
   }
   println!("{}", ans);
}


Measured memory_bytes: 4576
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*b)/gcd(a,b)
#define ff first
#define ss second
#define p pair<ll,ll>
#define pb push_back
#define endl '\n'
#define w(t) ll test;cin>>test;while(test--)
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(0);
#define pi acos(-1)
const int mxn=1e9+5;
int main()
{
    fast;
    int k;
    cin>>k;
    int tot=0;
    for(int i=1;i<=1e7;i++)
    {
        tot=(tot*10+7)%k;
        if(!tot)
        {
            cout<<i<<endl;
            return 0;
        }
    }
    cout<<-1<<endl;
}



Measured memory_bytes: 3624
#include <iostream>
#include <fstream>
#include <set>
#include <map>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <functional>
#include <algorithm>
#include <climits>
#include <cmath>
#include <iomanip>
#include <numeric>
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000


int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, X;
    cin >> N >> X;
    int x[100010];
    rep(i, N) cin >> x[i];
    int G = 0;
    rep(i, N) G = gcd(G, abs(X - x[i]));
    cout << G << endl;

    return 0;
}


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

int main(){
  int s = 0;
  rep(i, 3){
    int x;
    cin >> x;
  	s *= 10;
    s += x;
  }
  if(s % 4 == 0){
    cout << "YES" << endl;
  } else {
  	cout << "NO" << endl;
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
#include <math.h>
#include <string.h>
#include <map>
#include <numeric>
using namespace std;

double a,b;
int main()
{
  cin>>a>>b;
  if(a==b){
    cout<<"EQUAL"<<endl;
    return 0;
  }
  cout<<(a>b?"GREATER":"LESS")<<endl;
}

Measured memory_bytes: 256
def main():
  import sys
  from scipy.sparse.csgraph import floyd_warshall as f
  n,m,l,*t=map(int,sys.stdin.buffer.read().split())
  d=[[0]*(n+1)for _ in range(n+1)]
  for a,b,c in zip(*[iter(t[:m*3])]*3):d[a][b]=c
  d=f(f(d,0)<=l)-1
  d[d>n]=-1
  print('\n'.join(map(str,[int(d[i])for i in zip(*[iter(t[m*3+1:])]*2)])))
main()

Measured memory_bytes: 36208
import java.io.*;
import java.util.*;

public class Main {
    static PrintWriter out = new PrintWriter(System.out);
    static Scanner sc = new Scanner(System.in);
    static BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
    int k;
    long[] d;
    public static void main(String[] args) throws IOException {
        Main main = new Main();
//        main.solve();
        System.out.println(main.solve());
    }
    int solve() throws IOException{
        int a = sc.nextInt(), b = sc.nextInt();
        for(int i=1;i<1000000;i++){
            if(valid(i,a,b)) return i;
        }
        return -1;
    }
    boolean valid(int x, int a, int b){
        int y1 = 8*x/100, y2 = x/10;
        return y1==a&&y2==b;
    }
}



Measured memory_bytes: 21844
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <limits>
#include <numeric>
using namespace std;

// 最大公約数
long long int gcd(long long n,long long m){
    if( m == 0 ) return n;
    return gcd( m, n % m );
}

// 最小公倍数
long long int lcm(long long n,long long m){
    return n*m/gcd(n,m);
}

int  main(int argc, char const *argv[]) {
  long long int A,B,C,D,ans,tmp,lcmnum;
  ans=0;
  cin>>A>>B>>C>>D;
  A--;
  lcmnum=lcm(C,D);
  ans = B/C + B/D - A/C -A/D;
  tmp = B/lcmnum - A/lcmnum;

  cout<<(B-A)-(ans-tmp)<<endl;

  return 0;
}

Measured memory_bytes: 256
# coding: utf-8
def make_divisors(n):
    divisors = []
    ans = 10**12
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            x, y = i, n//i
            if ans > x-1 + y-1:
                ans = x - 1 + y - 1
    return ans

N = int(input())
print(make_divisors(N))

Measured memory_bytes: 3188
from sys import stdin, stdout
def IL():return list(map(int, stdin.readline().split()))

def main():
    N,Z,W = IL()
    a = IL()
    if len(a)>1:
        p=abs(a[-2] - a[-1])
        q=abs(a[-1] - W)
        print(max(p,q))
    else:
        print(abs(a[0]-W))
        
if __name__ == "__main__": main()

Measured memory_bytes: 3188
N,K = list(map(int,input().split()))
A = list(map(int,input().split()))
 
NG=0
OK=max(A)+1
 
while OK-NG>1:
    mid = (OK+NG)//2
    cur=0
    for x in A:
        cur += (x-1)//mid
    if cur > K:
        NG=mid
    else:
        OK=mid
print(OK)

Measured memory_bytes: 30892
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (int) n; i++)
using ll = long long;
template <class T>
using vt = vector<T>;
using vvi = vector<vector<int>>;

int main() {
  int a,b;
  cin >> a >> b;
  if(a>9||b>9)
    cout << -1;

  else
    cout << a*b;
  return 0;
}


Measured memory_bytes: 256
/* package codechef; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
public class Main
{
	public static void main (String[] args) throws java.lang.Exception
	{
		// your code goes here
		FastScanner sc=new FastScanner();
		int n=sc.nextInt();
		int count=0;
		for(int i=1;i<=n;i++){
		    int x=sc.nextInt();
		    if(x%2!=0&&i%2!=0) count++;
		}
	
	System.out.println(count);
		
		
	}
		static class FastScanner {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st=new StringTokenizer("");
		String next() {
			while (!st.hasMoreTokens())
				try {
					st=new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			return st.nextToken();
		}
		
		int nextInt() {
			return Integer.parseInt(next());
		}
		int[] readArray(int n) {
			int[] a=new int[n];
			for (int i=0; i<n; i++) a[i]=nextInt();
			return a;
		}
		long nextLong() {
			return Long.parseLong(next());
		}
}
}


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

using namespace std;
typedef long long ll;

#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, a, b) for (int i = (a); i < (b); ++i)
#define all(a) (a).begin(), (a).end()

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

    int ans;

    for (int i = 1; i * i <= n; i++)
    {
        ans = i * i;
    }

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


Measured memory_bytes: 3620
#include<stdio.h>
int main()
{
    int k;
    char S[105];
    scanf("%d",&k);
    scanf("%s",S);
    int i=0,nm;
    while(S[i]!='\0'){
        i++;
    }
    nm=i;
    if(nm<=k){
        printf("%s",S);
    }
    else {for(int j=0;j<k;j++){
        putchar(S[j]); }
        printf("...");
    }
    return 0;
}


Measured memory_bytes: 1712
// In The Name Of God

#include <bits/stdc++.h>
#define IOS ios::sync_with_stdio(false), cin.tie(0), cout.tie(0)
#define ll long long

using namespace std;

int n;
const int maxn = 1e2 + 100;
int a[maxn], b[maxn], ans, maxx;

int main()
{
    IOS;
    cin >> n;
    for(int i = 0; i < n; i ++) cin >> a[i] >> b[i];
    for(int i = 0; i < n; i ++)
    {
        int ind = i;
        maxx = 0;
        while(a[ind] == b[ind] and ind < n)
        {
            maxx ++;
            ind ++;
        }
        ans = max(maxx, ans);
    }

    (ans >= 3) ? cout << "Yes" << endl : cout << "No" << endl;

}


Measured memory_bytes: 3612
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#include <iomanip>
#include <numeric>
#include <unordered_map>
#include <sstream>   
#include<limits.h>
#include<float.h>
#include<list>
#include <array>
#include <complex>
#include<stdio.h>
#include<string.h>
#include <bitset>

using namespace std;
#define int  long long
 
#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807LL
#define I64_MAX2 1223372036854775807LL
#define INF I64_MAX2
#define MOD 1000000007
#define MEM_SIZE 10000
#define DEBUG_OUT true
#define ALL(x) (x).begin(),(x).end()

// int DP[MEM_SIZE][MEM_SIZE] = {0};
// int GMEM[MEM_SIZE][MEM_SIZE] = {0};
template<typename T> void DEBUG(T e){if(DEBUG_OUT == false)return; std::cout << e <<" ";}
template<typename T> void DEBUG(const std::vector<T>& v){if(DEBUG_OUT == false)return;for(const auto& e : v){std::cout<< e << " "; } std::cout << std::endl;}
template<typename T> void DEBUG(const std::vector<std::vector<T> >& vv){if(DEBUG_OUT == false)return;for(const auto& v : vv){ DEBUG(v); } }
template<class T,class... Ts> void DEBUG(T d, Ts... e){if(DEBUG_OUT == false)return;DEBUG(d);DEBUG(e...);}
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; exit(0);}}
template< typename T1, typename T2 > inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template< typename T1, typename T2 > inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }


//SOLVE
void solve(void)
{
  int N;
  cin>>N;
  vector<vector<int> > DP (N,vector<int>(3,0));
  cin>>DP[0][0]>>DP[0][1]>>DP[0][2];
  for (int i = 1; i < N; i++)
  {
    vector<int>IN (3);
    for (int j = 0; j < 3; j++)
    {
      cin>>IN[j];
    }
    for (int r = 0; r < 3; r++)
    {
      for (int p = 0; p < 3; p++)
      {
        if(r == p)continue;
        DP[i][r] = max(DP[i][r],DP[i-1][p] + IN[r]);
      }
    }
    
    
  }

  cout<<max(DP[N-1][0],max(DP[N-1][1],DP[N-1][2]))<<endl;
  return;
}


int32_t main(int32_t argc, const char *argv[])
{
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);

  std::cout << std::fixed;
  std::cout << std::setprecision(9);
  solve();

  return 0;
}


Measured memory_bytes: 5760
A, B, K = map(int, input().split())
c = 0
ans = []
for i in reversed(range(min(A, B))):
    if A % (i + 1) == 0 and B % (i + 1) == 0:
        ans = i + 1
        c += 1
        if c == K:
            print(ans)
            exit()
        else:
            pass


Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for (int i = a; i < b; i++)
#define REP(i,b) FOR(i,0,b)
#define RFOR(i,a,b) for (int i = a-1; i >= b; i--)
#define RREP(i,a) RFOR(i,a,0)
#define REPALL(i,v) for (int i = 0; i < v.size(); i++)
#define RREPALL(i,v) for (int i = v.size()-1; i >= 0; i--)
#define ALL(v) v.begin(), v.end()
#define SORT(v) sort(v.begin(), v.end())
#define MIN_ELEMENT(v) min_element(v.begin(), v.end())
#define MAX_ELEMENT(v) max_element(v.begin(), v.end())
#define COUNT(v,n) count(v.begin(), v.end(), n);
void YES(bool flag) {cout<<(flag ? "YES" : "NO")<<endl;}
void Yes(bool flag) {cout<<(flag ? "Yes" : "No")<<endl;}
void yes(bool flag) {cout<<(flag ? "yes" : "no")<<endl;}
typedef long long ll;
typedef unsigned long long ull;
const int INF = 1e7;
const ll MOD = 1e9 + 7;

vector<int> a(222);

int main()
{
    int n, l;
    cin>>n>>l;
    REP(i,n) a[i] = l + i;
    int sum = (l - 1) * n + n * (n + 1) / 2;
    if (a[0] > 0)
        cout<<sum - a[0]<<endl;
    else if (a[n-1] < 0)
        cout<<sum - a[n-1]<<endl;
    else
        cout<<sum<<endl;

    return 0;
}


Measured memory_bytes: 256
use std::io::Read;
use std::collections::VecDeque;

fn main() {
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();

    let answer = solve(&buf);

    println!("{}", answer);
}

fn solve(input: &str) -> String {
    let mut iterator = input.split_whitespace();

    let n: usize = iterator.next().unwrap().parse().unwrap();

    let nums: Vec<usize> = vec![3, 5, 7];

    let mut ans: usize = 0;
    let mut q: VecDeque<usize> = VecDeque::from(nums.clone());
    while !q.is_empty() {
        let current = q.pop_front().unwrap();
        if current > n {
            break;
        }
        let cs = current.to_string();
        if cs.contains('3') && cs.contains('5') && cs.contains('7') {
            ans += 1;
        }
        for num in &nums {
            let next = current * 10 + *num;
            q.push_back(next);
        }
    }
    ans.to_string()
}


Measured memory_bytes: 2468
#include<bits/stdc++.h>
using namespace std;
int main(){

    int x,y;
    cin>>x>>y;
    int res1=x*2;
    int res2=x*4;
    if(y>=res1 && y<=res2){

        if(y%2==0 || y%4==0){
            cout<<"Yes"<<endl;
        }
        else{
            cout<<"No"<<endl;
        }

    }
    else{
        cout<<"No"<<endl;
    }





}

Measured memory_bytes: 3636
#include "bits/stdc++.h"
using namespace std;
typedef long long LL;
vector<int> G[100000];
bool in[100000];
deque<int> Q;
int main() {
	int N, M;
	cin >> N >> M;
	int s, t;
	for (int i = 0; i < M; i++) {
		int a, b;
		cin >> a >> b; a--; b--;
		G[a].push_back(b);
		G[b].push_back(a);
		s = a;
		t = b;
	}
	Q.push_back(s);
	Q.push_back(t);
	in[s] = in[t] = 1;
	int now = s;
	while (1) {
		bool ok = 1;
		for (int to : G[now]) {
			if (in[to]) continue;
			in[to] = 1;
			Q.push_front(to);
			now = to;
			ok = 0;
			break;
		}
		if (ok) break;
	}
	now = t;
	while (1) {
		bool ok = 1;
		for (int to : G[now]) {
			if (in[to]) continue;
			in[to] = 1;
			Q.push_back(to);
			now = to;
			ok = 0;
			break;
		}
		if (ok) break;
	}
	cout << Q.size() << endl;
	cout << Q.front() + 1; Q.pop_front();
	while (!Q.empty()) {
		cout << " " << Q.front() + 1;
		Q.pop_front();
	}
	cout << endl;
}

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

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long int x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

#define fastio ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long
#define fl long double
#define pb push_back
#define mk make_pair
#define endl "\n"
#define ff first
#define ss second
#define mt make_tuple
#define np next_permutation
#define mod 998244353
#define pi 3.141592653589793238
ll power(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b){if(a<b) return gcd(b,a);if(b==0) return a;return gcd(b,a%b);}

int main()
{
    fastio;
    ll i,j,k,n,m,t;
    cin>>j>>k;
    ll ans=0;
    ans=j*k;
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 3616
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int n;
  	cin>>n;
    int a[n];
    int x=0;
    for(int i=0;i<n;i++)
    {
       cin>>a[i];
       x=x^a[i];
    }
    for(int i=0;i<n;i++)
    {
      int ans=0;
      ans=a[i]^x;
      cout<<ans<<" ";
    }
  	return 0;
}

Measured memory_bytes: 4284
import sys
read = sys.stdin.readline


def read_ints():
    return list(map(int, read().split()))


def read_a_int():
    return int(read())


def read_matrix(H):
    '''
    H is number of rows
    '''
    return [list(map(int, read().split())) for _ in range(H)]


def read_map(H):
    '''
    H is number of rows
    文字列で与えられた盤面を読み取る用
    '''
    return [read()[:-1] for _ in range(H)]


def read_col(H, n_cols):
    '''
    H is number of rows
    n_cols is number of cols

    A列、B列が与えられるようなとき
    '''
    ret = [[] for _ in range(n_cols)]
    for _ in range(H):
        tmp = list(map(int, read().split()))
        for col in range(n_cols):
            ret[col].append(tmp[col])

    return ret


S = input()
n_half = len(S) // 2 - 1
ans = 0
for i, (a, b) in enumerate(zip(S, S[::-1])):
    if i > n_half:
        break
    if a != b:
        # print(a, b)
        ans += 1
print(ans)


Measured memory_bytes: 3064
#include <stdio.h>

int main() 
{
    int x, a, b;
    scanf("%d %d %d", &x, &a, &b);
    int total1 = 0, total2 = 0;
    if(x > a)
	{
		total1 = x-a;
	}
	else
	{
		total1 = a-x;
	} 
	if(x > b)
	{
		total2 = x-b;
	}
	else
	{
		total2 = b-x;
	} 
	if(total1 < total2)
	{
		printf("A\n");
	}
	else 
	{
		printf("B\n");
	}
	
    return 0;
}

Measured memory_bytes: 1656
n = gets.to_i
a = gets.chomp.split
n.times do |i|
    a[i] = a[i].to_i
end

money = 1000
stock = 0
(n - 1).times do |i|
    if a[i] < a[i + 1]
        tmp = money
        money %= a[i]
        stock += tmp / a[i]
        # while money >= a[i]
        #     money -= a[i]
        #     stock += 1
        # end
    else
        money += stock * a[i]
        stock = 0
        # while stock > 0
        #     money += a[i]
        #     stock -= 1
        # end
    end
end

if stock > 0
    money += stock * a.last
    stock = 0
end

puts money


Measured memory_bytes: 14304
function Main(input) {

  var input = input.split("\n")
  var n = input[0];
  var aryn = input[1].split(" ").map(val => parseInt(val, 10));
  var aryc = input[2].split(" ").map(val => parseInt(val, 10));
  var result = 0;

  for(var i=0;i< n;i++){
    var r = aryn[i] - aryc[i];
    if(r > 0) {
      result = result + r;
    }
  }


  console.log(result);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

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

int main() {
  int N, M;
  cin >> N >> M;
  vector<int> L(M);
  vector<int> R(M);
  for (int i = 0; i < M; i++) {
    cin >> L.at(i) >> R.at(i);
  }
  int ansL=0, ansR=100000;
  for (int i = 0; i < M; i++) {
    ansL = max(L.at(i),ansL);
    ansR = min(R.at(i),ansR);
  }
  if (ansR - ansL < 0) {
    cout << 0;
  }
  else {
    cout << ansR - ansL + 1;
  }
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
 
#define pb push_back
#define ll long long
#define maxn 100005
#define fr(i,j,k) for(int i=j;i<k;i++)
#define f(n) fr(i,0,n)
#define f1(n) fr(i,1,n+1)
#define ms(i) memset(i,0,sizeof(i));
#define ms1(i) memset(i,-1,sizeof(i));
#define F first
#define S second
const int mod = 1e9 + 7;

int main() {
    ios_base::sync_with_stdio(false); cin.tie(0);
    int n;
    cin >> n;
    int mul[n];
    mul[1] = mul[0] = 1;
    for(int i = 2 ; i <= n ; i++){
        mul[i] = mul[i - 1] * i;
    }
    int u[n+5] = {}, add;
    ll rk1 = 0, rk2 = 0;
    for(int i = 0 ; i < n ; i++){
        cin >> add;
        int cnt = 0;
        for(int j = 1 ; j < add ; j ++){
            if(!u[j]){
                cnt++;
            }
        }
        u[add] = 1;
        rk1 += mul[n - i - 1] * cnt;
    }
    ms(u);
    for(int i = 0 ; i < n ; i++){
        cin >> add;
        int cnt = 0;
        for(int j = 1 ; j < add ; j ++){
            if(!u[j]){
                cnt++;
            }
        }
        u[add] = 1;
        rk2 += mul[n - i - 1] * cnt;
    }
    cout << abs(rk1 - rk2) << '\n';
}

Measured memory_bytes: 256
"""
Writer: SPD_9X2
https://atcoder.jp/contests/agc036/tasks/agc036_c

可能性:
3MをN個に分割する分け方から、存在しない分け方を引く

存在しない分け方とは？
→奇数個だけ置かれている場所の数がM個より多い場合

k(M+1～N)までに関して、1をk箇所に分配し、その後2個ずつ好きな場所に分配する方法を数えればいい
→解けたかな？

→まだ駄目な条件が抜けてる
最大値が2Mより大きいならダメ
↑の部分で引いてないのは、奇数個置かれている場所はM個以下だが、最大値が2Mより大きい分け方…

(k個の1のおき方) * {(1の中から2Mを超えるように置く場所の選び方)*残りの2の分配法}
+ (k個の1のおき方) * {(0の中から2Mを超えるように置く場所の選び方)*残りの2の分配法}

をk(0以上M以下に関して求める)

→解けた！
"""

def modfac(n, MOD):
 
    f = 1
    factorials = [1]
    for m in range(1, n + 1):
        f *= m
        f %= MOD
        factorials.append(f)
    inv = pow(f, MOD - 2, MOD)
    invs = [1] * (n + 1)
    invs[n] = inv
    for m in range(n, 1, -1):
        inv *= m
        inv %= MOD
        invs[m - 1] = inv
    return factorials, invs


def modnCr(n,r,mod,fac,inv): #上で求めたfacとinvsを引数に入れるべし(上の関数で与えたnが計算できる最大のnになる)
    if n < r:
        return 0
    return fac[n] * inv[n-r] * inv[r] % mod

mod = 998244353
N,M = map(int,input().split())

fac,inv = modfac(N+3*M+10,mod)

ans = modnCr(3*M+N-1,N-1,mod,fac,inv)
#print (3*M+N-1,N-1,ans)

for k in range(M+1,N+1):

    #print (k,ans)

    if (3*M-k) % 2 == 0:
        ans -= modnCr(N,k,mod,fac,inv) * modnCr((3*M-k)//2 + N-1 , N-1 , mod,fac,inv)
        ans %= mod

for k in range(M+1):

    if (3*M-k) % 2 == 0:
        
        amari = (3*M - (k+2*M))//2

        now = modnCr(N,k,mod,fac,inv) * k * modnCr(amari+N-1,N-1, mod,fac,inv)

        amari -= 1
        now +=modnCr(N,k,mod,fac,inv)*(N-k)*modnCr(amari+N-1,N-1, mod,fac,inv)

        ans -= now
        ans %= mod

    #print (ans)

print (ans)




Measured memory_bytes: 124984
s = input()
s1 = s[:2]
s2 = s[2:4]
r = int(s2)
l = int(s1)

if(1<=r<=12 and 1<=l<=12):
    print("AMBIGUOUS")
elif((r > 12 or r == 0) and 1 <= l <= 12):
    print("MMYY")
elif((l >= 12 or l == 0) and 1 <= r <= 12):
    print("YYMM")
else:
    print("NA")




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

using namespace std;

int main() {
  int n;
  string s;

  cin >> n >> s; 

  for (int i = 0; i < s.length(); i++) {
    char t = s[i];

    if (s[i] + n > 'Z') { t = s[i] + n - 26; }
    else { t = s[i] + n; }

    cout << t;
  }

  cout << endl;

  return 0;
}

Measured memory_bytes: 256