akhauriyash/Code-Regression huggingface dataset:
#pragma GCC optimize("O3")

#define _GLIBCXX_DEBUG
#include <iostream>
#include <vector>
#include <string>
#include <string_view>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <cassert>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
using namespace std;

/*----------macros----------*/

//input, output================
#define fastio                          \
std::ios::sync_with_stdio(false);       \
std::cin.tie(nullptr);                  \
std::cout.tie(nullptr)

#define endl '\n'
#define fcout(a)                        \
cout << fixed << setprecision((int)(a))

//typedef===============
typedef long long       ll;
typedef long double     ld;
typedef vector<int>     Vi;
typedef vector<ll>      Vl;
typedef pair<int, int>  Pii;
typedef pair<ll, ll>    Pll;

//const number==========
constexpr ll INF    = (ll)1e9 + 1;
constexpr ll INFll  = (ll)1e18 + 1;
constexpr ll MOD1   = 1000000007;
constexpr ll MOD2   = 998244353;
constexpr ld PI     = 3.141592653589793L;

//member================
#define psb push_back
#define epb emplace_back
#define psf push_front
#define mkp make_pair
#define fst first
#define snd second

//others================
#define sz(x)                           \
(int) x.size()

#define all(x)                          \
(x).begin(), (x).end()

#define rall(x)                         \
(x).rbegin(), (x).rend()

#define rep(i, n)                       \
for(int i = 0; (i) < (n); ++(i))

#define reps(i, n)                      \
for(int i = 1; (i) <= (n); ++(i))

#define rrep(i, n)                      \
for(int i = n - 1; (i) >= 0 ; --(i))

#define repbit(bit, n)                  \
for(int bit = 0; (bit) < (1 << (n)); ++(bit))

#define ifbit(bit, i)                   \
if((bit) & (1 << (i)))

#define CtoI(c)                         \
int((c)) - int('0')

#define ItoC(c)                         \
char((c) + '0')

//functions=============
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); }

// Vi  dx = {1, 0, -1, 0},
//     dy = {0, 1, 0, -1};

// Vi  dx2 = { 1,1,0,-1,-1,-1,0,1 },
//     dy2 = { 0,1,1,1,0,-1,-1,-1 };

/*--------additional--------*/



/*----------main------------*/

int main() {
fastio;

    int x; cin >> x;
    if(x == 7 || x == 5 || x == 3){
        cout << "YES" << endl;
        return 0;
    }
    else cout << "NO" << endl;

return 0;
}

Measured memory_bytes: 3632
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<iostream>
#include<string>
#include<vector>
#include<stack>
#include<bitset>
#include<cstdlib>
#include<cmath>
#include<set>
#include<list>
#include<deque>
#include<map>
#include<queue>
using namespace std;
char a[100];
int main()
{
    int i,j;
    scanf("%s",a);
    if(a[2]==a[3]&&a[4]==a[5])
        printf("Yes\n");
    else
        printf("No\n");
}


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

typedef long long ll;

#define REP(i, n) for(int i=0; i<(n); i++)
#define REPS(i, n) for(int i=0; i<=(n); i++)
#define FOR(i, a, b) for(int i=a; i<(b); i++)
#define FORS(i, a, b) for(int i=a; i<=(b); i++)
// for container x
#define ALL(v) (v).begin(),(v).end()
#define RALL(v) (v).rbegin(),(v).rend()
#define SIZE(v) ((ll)(v).size())
#define MAX(v) *max_element(ALL(v))
#define MIN(v) *min_element(ALL(v))
#define UNIQUE(v) v.erase(unique(ALL(v)), v.end())
#define LB(v, x) distance((v).begin(), lower_bound(ALL(v), (x)))
#define UB(v, x) distance((v).begin(), upper_bound(ALL(v), (x)))

struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
#pragma endregion

int main(){
    int l, r, d;
    cin >> l >> r >> d;
    int ans=0;
    FORS(i, l, r){
        if (i%d==0) ans++;
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3608
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a,b,m;
    cin>>a>>b>>m;
    vector<int> va(a),vb(b),vd,vp,vq;
    for(int i=0;i<a;i++)
    {
        cin>>va[i];
    }
    for(int i=0;i<b;i++)
    {
        cin>>vb[i];
    }
    vp=va;
    vq=vb;
    sort(vp.begin(),vp.end());
    sort(vq.begin(),vq.end());
    int t=vp[0]+vq[0];

    for(int i=0;i<m;i++)
    {
        int x,y,z;
        cin>>x>>y>>z;
        int cost=va[x-1]+vb[y-1]-z;
        vd.push_back(cost);
    }

    sort(vd.begin(),vd.end());
    cout<<min(t,vd[0]);



}


Measured memory_bytes: 2428
import java.util.Scanner;
  
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while(true) {
           int n = sc.nextInt();
           if(n==0) break;
           double[] a = new double[n];
           double sum = 0;
           for(int i=0; i<n; i++) {
               a[i] = sc.nextDouble();
               sum += a[i];
           }
           sum = sum / n;
           int cnt = 0;
           for(int i=0; i<n; i++) {
               if(a[i] <= sum) cnt++;
           }
           System.out.println(cnt);
        }
    }
}


Measured memory_bytes: 72900
def collatz(n):
    if n % 2 == 0:
        return int(n / 2)
    else:
        return int(n * 3 + 1)


s = int(input())
As = [s]
num = collatz(s)
while num not in As:
    As.append(num)
    num = collatz(num)

print(len(As) + 1)

Measured memory_bytes: 3060
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Globalization;
using System.Diagnostics;
using static System.Console;
using Pair = System.Collections.Generic.KeyValuePair<int, int>;
//using System.Numerics;
//using static System.Math;

class Program
{
    static void Main()
    {
        //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
        new Program().solve();
        Out.Flush();
    }
    Scanner cin = new Scanner();
    readonly int[] dd = { 0, 1, 0, -1, 0 };
    readonly int mod = 1000000007;
    readonly string alfa = "abcdefghijklmnopqrstuvwxyz";
    readonly string ALFA = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";

    int H, W, d;
    void solve()
    {
        H = cin.nextint;
        W = cin.nextint;
        d = cin.nextint;

        var C = new[] { ' ', 'R', 'Y', 'G', 'B' };
        int Z = H + W - 1;
        var S = new int[Z, Z];
        for (int i = 0; i < Z; i++)
        {
            for (int j = 0; j < Z; j++)
            {
                if (S[i, j] == 0)
                {
                    int color = i / d % 2 * 2 + j / d % 2 + 1;
                    for (int k = 0; k < d; k++)
                    {
                        if (i + k >= Z) break;
                        for (int l = 0; l < d; l++)
                        {
                            if (j + l >= Z) break;
                            S[i + k, j + l] = color;
                        }
                    }
                }
            }
        }
        //for (int i = 0; i < Z; i++)
        //{
        //    for (int j = 0; j < Z; j++)
        //    {
        //        Write(S[i, j]);
        //    }
        //    WriteLine();
        //}
        for (int i = 0; i < H; i++)
        {
            for (int j = 0; j < W; j++)
            {
                Write(C[S[i + j, i - j + W - 1]]);
            }
            WriteLine();
        }
    }

}

class Scanner
{
    string[] s; int i;
    char[] cs = new char[] { ' ' };
    public Scanner() { s = new string[0]; i = 0; }
    public string[] scan { get { return ReadLine().Split(); } }
    public int[] scanint { get { return Array.ConvertAll(scan, int.Parse); } }
    public long[] scanlong { get { return Array.ConvertAll(scan, long.Parse); } }
    public double[] scandouble { get { return Array.ConvertAll(scan, double.Parse); } }
    public string next
    {
        get
        {
            if (i < s.Length) return s[i++];
            string st = ReadLine();
            while (st == "") st = ReadLine();
            s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
            i = 0;
            return next;
        }
    }
    public int nextint { get { return int.Parse(next); } }
    public long nextlong { get { return long.Parse(next); } }
    public double nextdouble { get { return double.Parse(next); } }
}

Measured memory_bytes: 16608
import java.util.Scanner;
import java.lang.Math.*;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[] a = new int[N];
		int[] b = new int[N];
		int[] c = new int[N];

		for (int i = 0; i < N; i++) {
			a[i] = sc.nextInt();
			b[i] = sc.nextInt();
			c[i] = sc.nextInt();
		}

		int[][] dp = new int[N][3];

		dp[0][0] = a[0];
		dp[0][1] = b[0];
		dp[0][2] = c[0];

		for (int i = 1; i < N; i++) {
			dp[i][0] = Math.max(dp[i - 1][1], dp[i - 1][2]) + a[i];
			dp[i][1] = Math.max(dp[i - 1][0], dp[i - 1][2]) + b[i];
			dp[i][2] = Math.max(dp[i - 1][0], dp[i - 1][1]) + c[i];
		}

		System.out.println(Math.max(dp[N - 1][0], Math.max(dp[N - 1][1], dp[N - 1][2])));
	}
}


Measured memory_bytes: 98624
N, = map(int, input().split())
tt, aa, bb = 0, 0, 0
for _ in range(N):
    t, a, b = map(int, input().split())
    d = abs(aa-a) + abs(bb-b)
    if d <= t - tt and (t-tt-d) % 2 == 0:
        pass
    else:
        print("No")
        break
    aa, bb, tt = a, b, t
else:
    print("Yes")


Measured memory_bytes: 46952
s=input()
n=len(s)

x=[i%2 for i in range(n)]
y=[(i+1)%2 for i in range(n)]
d=0
f=0

for i in range(n):
    if int(s[i])!=x[i]:
        d+=1
for i in range(n):
    if int(s[i])!=y[i]:
        f+=1
print(min(d,f))


Measured memory_bytes: 10704
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		//????????£?????????????????????
		Scanner sc = new Scanner(System.in);
		//??°????????????
		int num = sc.nextInt();
		//??????????????°??????3?????????
		int intNum = num * num * num;
		//???????????¨???
		System.out.println(intNum);
	}
}

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

using namespace std;
#define io ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)

#define MOD 1000000007
#define fix(n) cout << fixed << setprecision(n)
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define REP(i, a, b) for(long i=a; i<=b; i++)
#define REN(i, a, b) for(long i=b; i>=a; i--)
// Debugging 
#define line cout << endl
#define out(n) cout << n << " "
#define bug(n) cout << n << "\n"
#define print(arr, start, end) REP(i, start, end) out(arr[i]); line

typedef long long ll;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef pair<int, int> pi;
typedef map<int, int> mii;

///// General Purpose functions /////

////////////////
int util(int s, vector<int> adj[], vector<bool> &visited)
{
  	visited[s] = true;
  	queue<int> q;
    q.push(s);
 	int l=0;
  
  	while(!q.empty())
    {
      int tmp = q.front();
      l++;
      q.pop();
      
       for(auto it = adj[tmp].begin(); it != adj[tmp].end(); it++)
       {
         if(visited[*it] == true) continue;
         visited[*it] = true;
         q.push(*it);
       }
    }
  
  	return l;
}


int bfs(vector<int> adj[], int V)
{
 	int len = 0;
  	vector<bool> visited(V, false);	
  	
  	for(int i=0; i<V; i++)
    {
      if(visited[i] == false)
      {
        int l = util(i, adj, visited);
        len = max(len, l);
      }
    }

  	return len;
}


void solve(){
	int V, m;
  	cin >> V >> m;
    int x,y;
    
  	vector<int> adj[V];
 	
  	for(int i=0; i<m; i++)
    {
      cin >> x >> y;
      adj[x-1].push_back(y-1);
      adj[y-1].push_back(x-1);
    }
  	
  	int max_len = bfs(adj, V);
	//out("a\n");
  	bug(max_len);
}

void prep(){

}

int main()
{
	//code
	io;
	int t = 1;
	//cin >> t;
	prep();
	fix(12);
	while(t--){
	    solve();
	}
	
	return 0;
}

Measured memory_bytes: 14924
#include <iostream>
#include <string>
#include<algorithm>
#include <vector>
#include<stack>
#include<queue>
#include<list>
#include<set>
#include<map>
#include<sstream>
using namespace std;

int ctoi(char c) {
	switch (c){
	case '1':
		return 1; break;
	case '2':
		return 2; break;
	case '3':
		return 3; break;
	case '4':
		return 4; break;
	case '5':
		return 5; break;
	case '6':
		return 6; break;
	case '7':
		return 7; break;
	case '8':
		return 8; break;
	case '9':
		return 9; break;
	case '0':
		return 0; break;
	}

}


int f(int a, int b, int c) {
	return a * 100 + b * 10 + c;
}

int abs_i(int a) {
	if (a >= 0) return a;
	else return -a;
}


int main() {
	string S;
	cin >> S;
	
	int N = S.length();
	int a[N];
	for (int i = 0; i < N; i++) {
		a[i] = ctoi(S[i]);
	}

	/*
	for (int i = 0; i < N; i++) {
		cout << a[i] << " ";
	}
	*/

	int ans = abs_i(753 - f(a[0], a[1], a[2]));

	
	for (int i = 1; i < N - 2; i++) {
		int temp = abs_i(753 - f(a[i], a[i+1], a[i+2]));
		ans = min(ans, temp);
	}

	cout << ans << endl;
	

	return 0;
}

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

#define int long long
#define vi vector<int>
#define pb push_back
#define forn(i,n) for(int i=0;i<n;i++)

void solve(){
	
	
	
	
	
}

int32_t  main(){

   int a,b;
   cin>>a>>b;
   cout<<a*b<<endl;
   
   
    return 0;	
}

Measured memory_bytes: 3592
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <deque>
#include <queue>
#include <cctype>
#include <cstdio>
#include <math.h>
#include <set>
#include <stack>
#include <cstring>
#define INF 10000000000000
using namespace std;
using ll = long long;
int n,w;
int grid[60][60];
bool flag[60][60];
int cnt[60][60]={};
int siro = 0;
queue<int> q;
ll ans = INF;
int xm[4] = {-1,0,1,0};
int ym[4] = {0,-1,0,1};
void dfs(){
    while(q.size()>0){
        int x = q.front();
        q.pop();
        int y = q.front();
        q.pop();
        if(x==n-1&&y==w-1){
            if(cnt[x][y]<ans){
                ans = cnt[x][y];
            }
        }else{
            for(int i=0;i<4;i++){
                if(flag[x+xm[i]][y+ym[i]]==false&&grid[x+xm[i]][y+ym[i]]==1){
                    flag[x+xm[i]][y+ym[i]]=true;
                    q.push(x+xm[i]);
                    q.push(y+ym[i]);
                    cnt[x+xm[i]][y+ym[i]]=cnt[x][y]+1;
                }
            }
        }
    }
}
int main() {
    cin >> n >> w;
    for(int i=0;i<n;i++){
        string s;
        cin >> s;
        for(int j=0;j<w;j++){
            if(s[j]=='.'){
                grid[i][j]=1;
                siro++;
            }else{
                grid[i][j]=0;
            }
            flag[i][j] = false;
        }
    }
    flag[0][0]=true;
    q.push(0);
    q.push(0);
    cnt[0][0]=0;
    dfs();
    if(ans == INF){
        cout << -1 << endl;
    }else{
        cout << siro - ans -1<< endl;
    }
}

Measured memory_bytes: 256
import java.util.*;
public class Main {
	public static void main(String[] args)  {
		Scanner scan = new Scanner(System.in);
		String s = scan.next();
		int len = s.length();

		int ans = 0;
		for (int i = 1;i  < len ; ++i){
			if (s.charAt(i-1) != s.charAt(i))++ans;
		}

		System.out.print(ans);

	}
}
//end


Measured memory_bytes: 24528
import sys
import math
import fractions
from collections import deque
from collections import defaultdict
sys.setrecursionlimit(10**7)

S = input()

dp = [[0] * 13 for _ in range(len(S))]
mod = 10 ** 9 + 7

if S[0] == '?':
    for i in range(10):
        dp[0][i] = 1
else:
    dp[0][int(S[0])] = 1

for i in range(1, len(S)):
    if S[i] == '?':
        for j in range(13):
            for k in range(10):
                dp[i][(j * 10 + k) % 13] += dp[i-1][j]
                dp[i][(j + 10 + k) % 13] %= mod
    else:
        for j in range(13):
            dp[i][(j * 10 + int(S[i])) % 13] += dp[i-1][j]
            dp[i][(j * 10 + int(S[i])) % 13] %= mod
print(dp[len(S) - 1][5])


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

int main(){
    int A,B,C,D;
  cin>>A>>B>>C>>D;
  for(int i=0;i<100;i++){
    C-=B;
    if(C<=0){
      cout<<"Yes"<<endl;
      break;
    }
    A-=D;
    if(A<=0){
      cout<<"No"<<endl;
      break;
    }
  }
}

Measured memory_bytes: 3632
#include <iostream>
#include <vector>
#include <algorithm>
#include <stack>

using namespace std;

int main() {
  int n, in;
  long long int s = 0;
  vector<int> a;
  stack<int> ans;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> in;
    a.push_back(in);
  }
  sort(a.begin(), a.end());
  int x = 0;
  for (int i = 0; i < n; i++) {
    if (!x) {
      x = a[i];
    } else {
      if (a[i] == x) {
        ans.push(x);
        x = 0;
      } else {
        x = a[i];
      }
    }
  }
  if (ans.size() >= 2) {
    s = ans.top();
    ans.pop();
    s = s * ans.top();
  }
  cout << s << endl;
  return 0;
}


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

int N, Y;

int main(void){
    
    cin >> N >> Y;
    
    int temp = Y / 1000 - N;
    
    for(int x = 0; x <= N; ++x){
        int num = temp - 9 * x;
        if(num % 4 == 0){
            int y = num / 4;
            int z = N - x - y;
            if(x >= 0 && y >= 0 && z >= 0 && x * 10000 + y * 5000 + z * 1000 == Y){
                cout << x << " " << y << " " << z << endl;
                return 0;
            }
        }
    }
    cout << "-1 -1 -1" << endl;
    
    return 0;
}


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

using namespace std;

#define il inline
#define re register
#define Rep(i, s, e) for (re int i = s; i <= e; ++i)
#define Dep(i, s, e) for (re int i = s; i >= e; --i)
#define file(a) freopen(#a".in", "r", stdin), freopen(#a".out", "w", stdout)

const int N = 200010;

il int read() {
    int x = 0; bool f = true; char c = getchar();
    while (c < '0' || c > '9') {if (c == '-') f = false; c = getchar();}
    while (c >= '0' && c <= '9') x = (x << 1) + (x << 3) + (c ^ 48), c = getchar();
    return f ? x : -x;
}

int n;
long long a[N], cnt[N];

int main() {
    n = read();
    Rep(i, 1, n) a[i] = read(), ++cnt[a[i]];
    long long ans = 0;
    Rep(i, 1, n) ans += (cnt[i] * (cnt[i] - 1)) >> 1;
    Rep(i, 1, n) {
        printf("%lld\n", ans - cnt[a[i]] + 1);
    }
    return 0;
}

Measured memory_bytes: 4736
#define _CRT_SECURE_NO_WARNINGS 1
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cstdlib>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <queue>
#include <sstream>
#include <climits>
#include <cmath>
#include <list>
#include <functional>
#include <map>
#include <stack>
using namespace std;
#define M_PI 3.141592
#define FOR(i,n) for(int i=0;i<(int)n;i++)
#define FORI(i,k,n) for(int i=k;i<(int)n;i++)
#define toRad 2.0*M_PI/360.0
#define inin(x) int x;cin>>x;
#define all(x) x.begin(),x.end()
#define debug(x) cout<<#x<<" :"<<x<<endl;
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define EPS 1e-12
#define pri_max 60000
typedef pair<int, int> pii;
typedef pair<double, double> pdd;
int dx[4] = { 0,1,0,-1 };
int dy[4] = { 1,0,-1,0 };

/* 
bool memo[pri_max] = {};
vector<int> pri;
void calc()
{
	for (int i = 2; i < pri_max; i++)
	{
		if (memo[i] == false)
		{
			pri.push_back(i);
			for (int l = i; l < pri_max; l += i)
			{
				memo[l] = true;
			}
		}
	}
}*/
double len(pdd a, pdd b)
{
	return sqrt((b.first - a.first)*(b.first - a.first) + (b.second - a.second)*(b.second - a.second));
}



int main()
{
	int a, b,c=-1;
	int m[110] = {};
	while (cin >> a >> b)
	{
		c = max(max(a, b),c);
		if (a == 0 && b == 0)
		{
			bool flag = true;
			for (int i = 3; i <= c; i++)
			{
				if (m[i] & 1)
				{
					cout << "NG" << endl;
					flag = false;
					break;
				}
			}
			if (flag&&m[1] & 1 && m[2] & 1)
			{
				cout << "OK" << endl;
				flag = false;
			}
			if (flag)cout << "NG" << endl;
			memset(m, 0, sizeof m);
		}
		else
		{
			m[a]++;
			m[b]++;
		}
	}
}

Measured memory_bytes: 1156
#include <iostream>
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define M 1000000007
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define io ios_base::sync_with_stdio(false);cin.tie(NULL);
#define loop(i,n) for(int i=0;i<n;i++)
void solve()
{
    int n;
    cin>>n;
    cout<<n*n;
}
int main() {
	// your code goes here
// 	int t ;
// 	cin>>t;
// 	while(t--)
    solve();
	return 0;
}


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

int main() {
	int N, A, B, T, count = 0;
	cin >> N >> A >> B;
	for (int i = 0; i < N; i++) {
		cin >> T;
		if (T < A || B <= T) count++;
	}
	cout << count << endl;
}

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

using namespace std;
#define ll long long
#define rep(i,n) for (int i = 0; i < n; i++)
#define MOD (1000000007)

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 INF = 1LL << 60;

int main(){
  int a,b; cin >> a >> b;
  std::cout << a*b - a - b + 1 << '\n';
}


Measured memory_bytes: 256
N, M=map(int, input().split())
A=[input() for _ in range(N)]
B=[input() for _ in range(M)]

def f(i, j):
  for s in range(M):
    for t in range(M):
      if A[i+s][j+t]!=B[s][t]:
        return False
  return True

for i in range(N-M+1):
  for j in range(N-M+1):
    r=f(i, j)
    if r==True:
      print('Yes')
      exit()
print('No')

Measured memory_bytes: 3064
#include<stdio.h>
int main(){
  int x,y,z;
  int a;
  scanf("%d%d",&x,&y);
  if(x<y){
    z=x;
    x=y;
    y=z;
  }

  a=x%y;
  while(a!=0){
    x=y;
    y=a;
    a=x%y;
  }

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



Measured memory_bytes: 2140
#pragma GCC optimize(2)
#include<bits/stdc++.h>
typedef long long ll;
const int maxn=1e6+5;
using namespace std;
ll n,m;
int nex[maxn][11];
ll num[maxn];
int pos[maxn];
void restart()
{
    //m为 一个字符后有多少中选择，例如a-z就有26种选择
    for(int i=1;i<=n;i++)
        for(int k=0;k<=10;k++)
            nex[i][k]=-1;
    for(int i=n;i>=2;i--)
    {
        for(int k=0;k<=10;k++) nex[i-1][k]=nex[i][k];//前一个数与当前数对应的一个位置一定相同除了自己
        nex[i-1][num[i]]=i;//包括自己
    }
}
int main()
{
    scanf("%lld",&n);
    for(int i=1;i<=n;i++)
    {
        scanf("%1d",&num[i]);
        if(!pos[num[i]]) pos[num[i]]=i;
    }
    restart();
    ll res=0;
    for(int i=0;i<=9;i++)
        for(int k=0;k<=9;k++)
            for(int j=0;j<=9;j++)
            {
                int x=pos[i];
                if(x)
                {
                    int y=nex[x][k];
                    if(y!=-1&&nex[y][j]!=-1) res++;
                }
            }
    printf("%lld\n",res);
    return 0;
}

/**

**/



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

typedef unsigned long long ll;
const ll INF = 1010000000000000017LL;
const ll MOD = 1000000007LL;

#define REP(i, n) for(ll i = 0 ; i < n; i++)

//#define DEBUG(fmt, ...)
#define DEBUG(fmt, ...) fprintf(stderr, fmt "\n", ##__VA_ARGS__)

int main(){
    std::cout<<std::fixed<<std::setprecision(10);

    ll N;
    cin >> N;
    vector<ll> array(N, 0);

    REP(i, N){ cin >> array[i]; }

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

    if( array[0] == 0 ){
        cout << 0 << endl;
        return 0;
    }

    ll ans = 1;
    REP(i,N){
       if( array[i] > (1000000000000000000 / ans) ){
            cout << -1 << endl;
            return 0;
       }
       ans *= array[i];
    }

    cout << (ll)ans << endl;
}


Measured memory_bytes: 4056
#include<bits/stdc++.h>
#define db double
#define ll long long
#define reg register
#define pb(x) push_back(x)
#define fup(i,x,y) for(reg int i=x;i<=y;++i)
#define fdw(i,x,y) for(reg int i=x;i>=y;--i)
using namespace std;
const int N=2100;
int f[N][N];
ll ans,n;
inline int read()
{
	int x=0,ff=1;
	char ch=getchar();
	while(!isdigit(ch)) {if(ch=='-') ff=-1;ch=getchar();}
	while(isdigit(ch)) {x=(x<<1)+(x<<3)+(ch^48);ch=getchar();}
	return x*ff;
}
inline int Gcd(int a,int b){return b?Gcd(b,a%b):a;}
int main()
{
	//freopen("1.in","r",stdin);
	n=read();
	for(int i=1;i<=n;++i)
		for(int j=1;j<=n;++j) f[i][j]=Gcd(i,j);
	for(int i=1;i<=n;++i)
		for(int j=1;j<=n;++j)
		{
			int d=f[i][j];
			for(int k=1;k<=n;++k) ans+=(ll)f[d][k];
		}
	printf("%lld",ans);
	return 0;
}



Measured memory_bytes: 4684
#include<stdio.h>

int main()
{
    int x,a,b;
    scanf("%d %d %d",&x,&a,&b);
    int over=b-a;
    if(over<=0)printf("delicious");
    if(over>0 && over <=x) printf("safe");
    if(over>x) printf("dangerous");

    return 0;
}

Measured memory_bytes: 128
#include <stdio.h>

int main(){
  while(1){
    int w, h;
    scanf("%d%d", &w, &h);
    if(w == 0 && h == 0) break;
    for(int i = 0; i < w; i++){
      for(int j = 0; j < h; j++){
        printf("#");
      }
      printf("\n");
    }
    printf("\n");
  }
}



Measured memory_bytes: 2688
#include <iostream>
#include <sstream>
#include <stack>
#include <iomanip>
#include <numeric>
#include <string>
#include <cstring>
#include <algorithm>
#include <functional>
#include <cstdlib>
#include <cassert>
#include <map>
#include <set>
#include <vector>
#include <utility>
#include <queue>
#include <cmath>

#define BEGIN(x) x.begin()
#define END(x) x.end()
#define ALL(x) BEGIN(x), END(x)
#define PAIR make_pair
#define VEC(type) vector<type >
#define endl '\n'
#define FIR first
#define SEC second
#define PB push_back
#define SZ(x) ((int)x.size())

#define FOR(i, A, B) for(auto i = (A);i != (B); i++)
#define FORD(i, A, B) for(auto i = (A);i != (B); i--)

#define READRANGE(begin, end) FOR(it, begin, end) cin >> *it
#define READVEC(V) READRANGE(BEGIN(V), END(V))

using namespace std;

typedef long long lint;
typedef pair<int, int> Pii;
typedef pair<int, lint> Pil;
typedef pair<lint, lint> Pll;
typedef pair<lint, int> Pli;

template<class U, class V>
istream& operator >>(istream& in, pair<U, V>& pr) {
    return in >> pr.first >> pr.second;
}

template<class U, class V>
ostream& operator <<(ostream& out, pair<U, V>& p) {
    return out << p.first << " " << p.second;
}

template<class T>
ostream& operator <<(ostream& out, vector<T> vec) {
    for (T& e : vec)
        out << e << " ";
    return out << endl;
}

// ---- BEGIN LIBRARY CODE ----
// ---- END LIBRARY CODE ----
void io_init()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
};

void solveSingleCase(int caseNo)
{
    int N, M;
    cin >> N;
    VEC(string) B(N);
    READVEC(B);
    cin >> M;
    VEC(string) R(M);
    READVEC(R);

    int ret = 0;
    for (string s : B) {
        int score = 0;
        for (string ss : B)
            if (s == ss)
                score++;
        for (string t : R)
            if (s == t)
                score--;
        ret = max(ret, score);
    }

    cout << ret << endl;
};

int main(int argc, char **argv)
{
    io_init();

    // Actual program code starts here.
    int T = 1;
    // cin >> T;
    FOR(tcase, 1, T + 1) {
        solveSingleCase(tcase);
    }
    return 0;
};


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
  int n, t, c, x, ans;
  ans = 10000;
  cin >> n >> t;
  for(int i=0; i<n; i++){
    cin >> c >> x;
    if(x <= t && ans > c){
      ans = c;
    }
  }
  if(ans == 10000){
    cout << "TLE" << endl;
  }else{
    cout << ans << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define IO_OP std::ios::sync_with_stdio(0); std::cin.tie(0);
#define F first
#define S second
#define V vector
#define PB push_back
#define MP make_pair
#define EB emplace_back
#define ALL(v) (v).begin(), (v).end()
#define debug(x) cerr << #x << " is " << x << endl

using namespace std;

typedef long long ll;
typedef pair<int, int> pi;
typedef V<int> vi;

const int INF = 1e9 + 7;

int a[55], b[55], c[55], d[55];
vi s;
int n, m, q;
int mx = 0;

void go() {
	if(s.size() == n) {
		int cur = 0;
		for(int i = 0; i < q; i++) {
			if(s[b[i]]-s[a[i]] == c[i])
				cur += d[i];
		}
		mx = max(mx, cur);
		return;
	}
	for(int i = s.back(); i <= m; i++) {
		s.PB(i);
		go();
		s.pop_back();
	}
}

signed main()
{
	IO_OP;
	
	cin >> n >> m >> q;	
	for(int i = 0; i < q; i++) {
		cin >> a[i] >> b[i] >> c[i] >> d[i];
		a[i]--, b[i]--;
	}
	s.PB(1);
	go();
	cout << mx << endl;
}





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

int main(){
  int n,k,q;
  cin >> n >> k >> q;
  vector<int> p(n);
  rep(i,q){
    int a;
    cin >> a;
    a--;
    p.at(a)++;
  }
  rep(i,n){
    if( p.at(i) > q-k ){
      cout << "Yes" << endl;
    }else{
      cout << "No" << endl;
    }
  }
    
  return 0;
}


Measured memory_bytes: 1024
import sys
input = sys.stdin.readline

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

"""
最後に食べるもので場合わけ，最後のもの以外を使う．
[0,i)と(i,N-1]の2つのdpで
"""
def main():
    mod=10**9+7
    N,T=MI()
    A=[0]*N
    B=[0]*N
    for i in range(N):
        A[i],B[i]=MI()
        
    M=3000
    
    def calc(A,B):
        dp=[[0]*(M+1) for _ in range(N+1)]
        for i in range(N):
            a=A[i]
            b=B[i]
            for j in range(1,M+1):
                dp[i+1][j]=max(
                    dp[i+1][j], # ここ
                    dp[i+1][j-1],# 1つまえの時間でも達成できる
                    dp[i][j]# i番目を選ばない
                    )
                if j-a>=0:
                    dp[i+1][j]=max(
                        dp[i+1][j],
                        dp[i][j-a]+b
                    )
        return dp
                
    dp=calc(A,B)
    # dp[i][j]はi番目までみて，j分以内に食べられる最大値
    
    dp2=calc(A[::-1],B[::-1])
    # dp2[i][j]は後ろからi個みて，j分以内に食べられる最大値
    

              
    ans=0
    for i in range(N):
        a=A[i]
        b=B[i]
        temp=0
        for j in range(T):#最後にi番目をオーダーするので，T-1秒の間にどこまでいけるか
            aa=dp[i][j]
            bb=dp2[N-i-1][T-j-1]
            temp=max(temp,aa+bb)
        ans=max(ans,temp+b)
            
        # print(i,a,b,ans)
            
    print(ans)
                
 

main()


Measured memory_bytes: 215992
a,b,c = map(int,input().split())
if a > b:
    
    t = a
    a = b
    b = t

if b > c:
    t = b
    b = c
    c = t
    
if a > b:
    t = a
    a = b
    b = t
print(a,b,c)
    
    


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

using namespace std;

int main(void) {
    int N;
    cin >> N;
    double ans = 0;
    for (int i = 0; i < N; i++) {
        double x;
        string u;
        cin >> x >> u;
        if (u == "JPY") ans += x;
        else ans += 380000 * x;
    }
    cout << fixed << setprecision(10) << ans << endl;
}


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

#define rep(i, a) for (int i = 0; i < (a); ++i)
#define REP(i, a, b) for (int i = (a); i < (b); ++i)
#define FORV(a, A) for (auto &a : A)

using namespace std;
using ll = long long;
using P = pair<int, int>;

const int INF = 1000;

void Main() {
  int h, w;
  cin >> h >> w;
  vector<vector<bool>> M(h, vector<bool>(w, false));
  vector<vector<int>> A(h, vector<int>(w, -1));
  rep(i, h) {
    string s;
    cin >> s;
    rep(j, w) {
      if (s[j] == '.') M[i][j] = true;
    }
  }
  rep(i, h) {
    rep(j, w) {
      if (!M[i][j]) continue;
      vector<vector<int>> G(h, vector<int>(w, INF));
      G[i][j] = 0;
      queue<P> Q;
      Q.emplace(i, j);
      while (!Q.empty()) {
        P v = Q.front();
        Q.pop();
        int x = v.first;
        int y = v.second;
        if (x != 0 && M[x - 1][y]) {
          if (G[x - 1][y] == INF) Q.emplace(x - 1, y);
          G[x - 1][y] = min(G[x - 1][y], G[x][y] + 1);
        }
        if (x != h - 1 && M[x + 1][y]) {
          if (G[x + 1][y] == INF) Q.emplace(x + 1, y);
          G[x + 1][y] = min(G[x + 1][y], G[x][y] + 1);
        }
        if (y != 0 && M[x][y - 1]) {
          if (G[x][y - 1] == INF) Q.emplace(x, y - 1);
          G[x][y - 1] = min(G[x][y - 1], G[x][y] + 1);
        }
        if (y != w - 1 && M[x][y + 1]) {
          if (G[x][y + 1] == INF) Q.emplace(x, y + 1);
          G[x][y + 1] = min(G[x][y + 1], G[x][y] + 1);
        }
      }
      int mx = 0;
      rep(x, h) rep(y, w) if (G[x][y] != INF) mx = max(mx, G[x][y]);
      A[i][j] = mx;
    }
  }
  int ans = 0;
  rep(i, h) rep(j, w) ans = max(ans, A[i][j]);
  cout << ans << endl;
}

int main() {
  std::cin.tie(nullptr);
  std::ios_base::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);
  Main();
  return 0;
}


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

int N;
string s;
bool zoo[100007];

bool check(char ch, bool a, bool b, bool c)
{
    if (b) {
        if (ch == 'o') {
            return a == c;
        } else {
            return a != c;
        }
    } else {
        if (ch == 'o') {
            return a != c;
        } else {
            return a == c;
        }
    }
}

bool solve(bool first, bool second)
{
    zoo[0] = first;
    zoo[1] = second;
    for (int i = 2; i < N; i++) {
        if (zoo[i - 1]) {
            if (s[i - 1] == 'o') {
                zoo[i] = zoo[i - 2];
            } else {
                zoo[i] = !zoo[i - 2];
            }
        } else {
            if (s[i - 1] == 'o') {
                zoo[i] = !zoo[i - 2];
            } else {
                zoo[i] = zoo[i - 2];
            }
        }
    }

    return check(s[N - 1], zoo[N - 2], zoo[N - 1], zoo[0]) &&
           check(s[0], zoo[N - 1], zoo[0], zoo[1]);
}

void display()
{
    for (int i = 0; i < N; i++) {
        cout << (zoo[i] ? 'S' : 'W');
    }
    cout << endl;
}

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

    cin >> N >> s;

    if (solve(1, 1)) {
        display();
        return 0;
    }
    if (solve(1, 0)) {
        display();
        return 0;
    }
    if (solve(0, 1)) {
        display();
        return 0;
    }
    if (solve(0, 0)) {
        display();
        return 0;
    }

    cout << -1 << endl;

    return 0;
}

Measured memory_bytes: 720
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    int count = 0;
    loop: for (int b=1;b<10;b++){
      for (int c = 1;c<10;c++){
        if (a == b*c){
          count =count +1;
          System.out.println("Yes");
          break loop;

        }
      }
    }
    if(count ==0){
    System.out.println("No");
    }
  }
}

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

int main(){
    double l;cin>>l;
    double edge = l / 3;
    double ans = edge * edge * edge;
    printf("%.7lf", ans);
    return 0;
}


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

using namespace std;

int main()

{
    int a, b;

    cin>>a>>b;

    if(a>=13)
        cout<<b<<endl;
    else if(a>=6 && a<=12)
        cout<<b/2<<endl;
    else
        cout<<0<<endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); i++)
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define MOD 1000000007
using namespace std;
typedef long long ll;

int main(){
    int x;
    cin >> x;
    if(x < 1200) cout << "ABC" << endl;
    else cout << "ARC" << endl;
    return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize ("O3")
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
using namespace std;

const long long MOD = 1000000007;

// Ref. https://qiita.com/ofutonfuton/items/c17dfd33fc542c222396 //
struct UnionFind {
    vector<int> par;
    vector<int> sz;

    // Initialize. All vertices are roots when initial state.
    UnionFind(int N) : par(N),sz(N) {
      REP(n,N){
        par[n] = n;
        sz[n] = 1;
      }
    }

    // Return the root of tree which consists of vertex(x)
    int root(int x) {
      if (par[x] == x) return x;     // If x is the root, return x
      return par[x] = root(par[x]);  // Recursively find the root of tree. 
    }

    // Unite two vertices into one tree. 
    void unite(int x, int y) {
      int rx = root(x);
      int ry = root(y);
      if (rx == ry) return;
      if(sz[rx] > sz[ry]){
        par[ry] = rx;
        sz[rx] += sz[ry];
      }else{
        par[rx] = ry;
        sz[ry] += sz[rx];
      }
    }

    // Return true if two vertices has the same root, else return false.
    bool same(int x, int y) {
      int rx = root(x);
      int ry = root(y);
      return rx == ry;
    }

    // Return the number of vertices which are component of a tree
    int size(int x){
      return sz[root(x)];
    }
};

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


  vector<int> A(M);
  vector<int> B(M);

  REP(m,M){
    int a, b;
    cin >> a >> b;
    A[m] = a-1, B[m] = b-1;
  }

  UnionFind tree(N);

  long long inconv = N*(long long)(N-1)/2;
  vector<long long> res;
  
  RREP(m,M){
    res.push_back(inconv);
    if (tree.same(A[m],B[m])) continue;

    inconv -= tree.size(A[m])*(long long)tree.size(B[m]);
    tree.unite(A[m],B[m]);

  }
  reverse(res.begin(),res.end());
  REP(m,M) cout << res.at(m) << endl;
}


Measured memory_bytes: 3828
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <list>
#include <queue>
#include <cmath>
using namespace std;

int inf = (1 << 30);
int mod = 1e9 + 7;
int64_t inf64 = (1LL << 60);

template <typename T>
T gcd(T a, T b) {
    if(b == 0) return a;
    else return gcd(b, a % b);
}

template <typename T>
T lcm(T a, T b) {
    T g = gcd(a, b);
    return a / g * b;
}

bool check(vector<int> a, int index, int key){
    if(a[index] >= key) return true;
    else return false;
}

int lower_bound(vector<int> a, int key){
    int left = -1, right = a.size();
    while(right - left > 1){
        int mid = left + (left + right) / 2;
        if(check(a, mid, key)) right = mid;
        else left = mid;
    }
    return right;
}

int main(){

    int64_t N, K;
    cin >> N >> K;

    cout << (int64_t)(K * pow(K - 1, N - 1)) << endl;

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cmath>
#include<map>
#include<vector>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)

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

    if(n > 999){
        cout << "ABD" << endl;
    }
    else{
        cout << "ABC"<< endl;
    }

	return 0;
}

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

using namespace std;

typedef pair<int, int> ii;
typedef long long ll;
const int oo = 1e9 + 7;

int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n, pos = 0, neg = 0, mz = oo;
  ll ans = 0;
  cin >> n;
  for (int i = 1; i <= n; ++i) {
    int a;
    cin >> a;
    if (a >= 0) pos++;
    else neg++;
    ans += abs(a);
    mz = min(mz, abs(a));
  }
  if (neg % 2 == 0) cout << ans;
  else cout << ans - 2 * mz;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <string>
#include <cstring>
#include <cmath>
#include <cstdio>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <utility>
#include <numeric>
#include <stack>
#include <queue>
using namespace std;
#define ll long long
#define INF 1000000007
using P = pair<int, int>;
int main(){
    int n;
    cin>>n;
    int t[114514];
    bool ans=true;
    t[0]=0;
    vector<P> a(114514);
    a[0].first=0;
    a[0].second=0;
    for(int i=0;i<n;i++){
        cin>>t[i+1]>>a[i+1].first>>a[i+1].second;
    }
    for(int i=0;i<n;i++){
        if(t[i+1]-t[i]<abs(a[i+1].first-a[i].first)+abs(a[i+1].second-a[i].second))ans=false;
        else if(((t[i+1]-t[i])-abs(a[i+1].first-a[i].first)+abs(a[i+1].second-a[i].second))%2!=0)ans=false;
        if(ans==false)break;
    }
    if(ans)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}


Measured memory_bytes: 1536
use proconio::{fastout, input};

#[fastout]
fn main() {
    input! {
        a: isize,
        b: isize,
        c: isize,
        d: isize,
    }

    let mut ans = a * c;
    ans = std::cmp::max(ans, a * d);
    ans = std::cmp::max(ans, b * c);
    ans = std::cmp::max(ans, b * d);

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


Measured memory_bytes: 2180
#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>;
#include <iostream>
#include <vector>
#include <math.h>
#define PI 3.14159265358979323846264338327950L


int main() {
  int a, b, h, m;
  cin >> a >> b >> h >> m;
  double time = double (60*h+m);
  double wa = double (time*PI/360);
  double wb = double (time*PI/30);
  double w = double (wb - wa);
  
 
  double ans = double (sqrt(a*a + b*b - 2 * a * b * cos(w)));
  printf("%.10f\n", ans);
  return 0;
}

Measured memory_bytes: 4192
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
using namespace std;

int main() {
	int N, K;
	cin >> N >> K;
	string S;
	cin >> S;

	vector<int> Nums;
	int now = 1; //今見ている数
	int cnt = 0; //nowがいくつ並んでいるか
	for (int i = 0; i < N; i++)
	{
		if (S[i] == (char)('0' + now)) cnt++;
		else {
			Nums.push_back(cnt);
			now = 1 - now; //0と1を切り替える時の計算 now ^= 1;
			cnt = 1; //新しいのをカウントし始める
		}
	}
	if (cnt != 0) Nums.push_back(cnt);

	//1-0-1-0-1-0-1って感じの配列が欲しい
	//1-0-1-0みたいに0で終わってたら、適当に１つ足す
	if (Nums.size() % 2 == 0) Nums.push_back(0);

	int Add = 2 * K + 1;

	//累積和を作る
	// 0 1 2 3 4 5 6
	//  0 1 2 3 4 5

	vector<int> sum(Nums.size() + 1);
	for (int i = 0; i < Nums.size(); i++)
	{
		sum[i + 1] = sum[i] + Nums[i];
	}


	int ans = 0;
	//1-0-1...の1から始めるので、偶数番目だけ見る
	for (int i = 0; i < Nums.size(); i += 2)
	{
		//次のleft, rightを計算する [left, right)
		int left = i;
		int right = min(i + Add, (int)Nums.size());
		int tmp = sum[right] - sum[left];

		ans = max(tmp, ans);
	}

	cout << ans << endl;
}


Measured memory_bytes: 4348
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cstdlib>

using namespace std;
using ll = long long;
static const ll INF = 1000000000000000000ll;
static ll dp[200001][5];

int main(){
	ios_base::sync_with_stdio(false);
	int n;
	cin >> n;
	vector<ll> a(n);
	for(int i = 0; i < n; ++i){ cin >> a[i]; }
	for(int i = 0; i <= n; ++i){
		for(int j = 0; j < 5; ++j){ dp[i][j] = INF; }
	}
	dp[0][0] = 0;
	for(int i = 0; i < n; ++i){
		const ll cost0 = a[i];
		const ll cost1 = (a[i] == 0) ? 2 : (a[i] % 2);
		const ll cost2 = 1 - a[i] % 2;
		dp[i + 1][0] = min(dp[i + 1][0], dp[i][0] + cost0);
		dp[i + 1][1] = min(dp[i + 1][1], dp[i][0] + cost1);
		dp[i + 1][2] = min(dp[i + 1][2], dp[i][0] + cost2);
		dp[i + 1][3] = min(dp[i + 1][3], dp[i][0] + cost1);
		dp[i + 1][4] = min(dp[i + 1][4], dp[i][0] + cost0);
		dp[i + 1][1] = min(dp[i + 1][1], dp[i][1] + cost1);
		dp[i + 1][2] = min(dp[i + 1][2], dp[i][1] + cost2);
		dp[i + 1][3] = min(dp[i + 1][3], dp[i][1] + cost1);
		dp[i + 1][4] = min(dp[i + 1][4], dp[i][1] + cost0);
		dp[i + 1][2] = min(dp[i + 1][2], dp[i][2] + cost2);
		dp[i + 1][3] = min(dp[i + 1][3], dp[i][2] + cost1);
		dp[i + 1][4] = min(dp[i + 1][4], dp[i][2] + cost0);
		dp[i + 1][3] = min(dp[i + 1][3], dp[i][3] + cost1);
		dp[i + 1][4] = min(dp[i + 1][4], dp[i][3] + cost0);
		dp[i + 1][4] = min(dp[i + 1][4], dp[i][4] + cost0);
	}
	ll answer = INF;
	for(int j = 0; j < 5; ++j){
		answer = min(answer, dp[n][j]);
	}
	cout << answer << endl;
	return 0;
}



Measured memory_bytes: 9600
#include <bits/stdc++.h>
#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define YES() printf("YES\n")
#define NO() printf("NO\n")
#define Yes() printf("Yes\n")
#define No() printf("No\n")
#define in(x,y,h,w) x >= 0 && x < h && y >= 0 && y < w
using namespace std;

//#define int long long
//typedef    long long          ll;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      P;
 
const int INF=1e+9;
const double EPS=1e-9;
const int MOD=1000000007;
 
const int dx[]={1,0,-1,0},dy[]={0,-1,0,1};

int dp[1 << 26],tmp = 0;

signed main(){
	string s;
	cin >> s;
	for(int i = 0;i < (1 << 26);i++) dp[i] = INF;
	dp[0] = 0;
	for(int i = 0;i < s.length();i++){
		tmp ^= 1 << (s[i] - 'a');
		for(int j = 0;j < 26;j++){
			dp[tmp] = min(dp[tmp],dp[tmp ^ (1 << j)] + 1);
		}
	}
	if(dp[tmp]) cout << dp[tmp] << endl;
	else cout << 1 << endl;
	return 0;
}

Measured memory_bytes: 262788
#include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <algorithm>
#include <functional>
#include <stack>
#include <queue>
#include <string>
#include <map>
#include <unordered_map>
#include <bitset>
#include <numeric>
#include <vector>
#include <set>
#include <unordered_set>
#include <bitset>
#include <limits>
#include <random>
#include <complex>
#include <numeric>


using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;

const ll mod=1000000007ll;
const ll inf=1000000000000000ll;


int main(){
    ll k;
    cin>>k;
    if(k%2==0)cout<<(k/2)*(k/2)<<endl;
    else cout<<(k-(k/2))*(k/2)<<endl;
    return 0;
}


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

#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rep2(i,s,n) for(int i = (s); i < (n); ++i)
#define ll long long
#define ld long double
#define P pair<ll,ll>
#define all(v) v.begin(),v.end()

const ll mod = 1e9+7;
const ll INF = 1e18;
const double pi = acos(-1.0);

ll sumofketa(ll a,ll b){
    string s=to_string(a),t=to_string(b);
    return max(s.size(),t.size());
}

int main(void)
{
    ll a,b,c,d,e,f;
    cin>>a>>b>>c>>d>>e>>f;

    ll ans1=100*a,ans2=0;
    double tmp=0;

    rep(i,31)rep(j,31){
        rep(k,101)rep(l,101){
            double w = 100 * (a * i + b * j);
            double s = c * k + d * l;
            if(w == 0) continue;
            if(w + s > f) break;
            if(s > e * (a * i + b * j) ) break;
            if(s / (w + s)  > tmp ){
                tmp = max(tmp, s/(w+s));
                ans1 = w + s;
                ans2 = s;
            }
        }
    }
    cout << ans1 << " " << ans2 <<endl;
    return 0;
}

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

typedef long long LL;

#define __m int mid=(l+r)>>1;
#define lson l,mid,rt<<1
#define rson mid+1,r,rt<<1|1

#define rep(i,a,b) for(register int i = (a); i< (b); i++)
#define per(i,a,b) for(register int i = (a); i> (b); i--)
#define mem(a) memset(a,0,sizeof(a));
#define pb push_back

#ifdef LOCAL
    #define bug(x) cout<<#x<<" : "<<x<<endl;
#else
    #define bug(x) ;
#endif

template<class T>
inline bool read(T &num)  
{
       char in;bool IsN=false;
       while(in=getchar(),in!='-'&&(in<'0'||in>'9'))if(in==EOF)return false;
       in=='-'?(IsN=true,num=0):num=in-'0';
       while(in=getchar(),in>='0'&&in<='9')num=num*10+in-'0';
       return IsN?num=-num:num,true;
}

const int maxn = 1e5+7;
const int inf  = 2e9+7;
const int mod  = 1e9+7;

int fa[maxn],num[maxn];
void init(){
    rep(i,0,maxn)
        fa[i]=i;
}
int find(int x){
    return fa[x]=(fa[x]==x)?x:find(fa[x]);
}
void merge(int x,int y){
    int fx=find(x),fy=find(y);
    if(fx==fy)
        return ;
    fa[fx]=fy;
}
int main(){
#ifdef LOCAL
    //freopen("sample.in","r",stdin);
#endif
    ios::sync_with_stdio(false);
    int n,m;
    cin>>n>>m;
    rep(i,1,n+1)cin>>num[i];
    init();
    while(m--){
        int a,b;
        cin>>a>>b;
        merge(a,b);
    }
    rep(i,1,n+1){
        while(find(i)==find(num[i])){
            if(num[i]==i)
                break;
            swap(num[i],num[num[i]]);
        }
    }
    int ans = 0;
    rep(i,1,n+1)if(num[i]==i)ans++;
    cout<<ans<<endl;
    return 0;
}



Measured memory_bytes: 1024