akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

const int MAXM = 2e5 + 10;
const int MAXN = 2e5 + 10;
const int MAXNODE = 100 + 10;
const int INF = 1e4;

struct Edge {
	int nxt, v, w;
} e[MAXM];
int head[MAXN], tot;

inline void addEdge (int u, int v, int w) {
	e[++tot] = (Edge){head[u],v,w};
	head[u] = tot;
}

void reset (void) {
	memset(head,-1,sizeof(head));
	tot = -1;
}

int n, m, s, t, node_tot;
int cur[MAXN];
int dis[MAXN];
int gap[MAXN];
queue<int> q;

void maxflow_bfs (void) {
	memcpy(cur,head,sizeof(head));
	memset(dis,-1,sizeof(dis));
	memset(gap,0,sizeof(gap));

	gap[0] = 1;
	dis[t] = 0;
	q.push(t);
	while (!q.empty()) {
		int u = q.front(); q.pop();
		for (int i = head[u]; ~i; i = e[i].nxt) {
			if (e[i^1].w > 0 && dis[e[i].v] == -1) {
				dis[e[i].v] = dis[u] + 1;
				gap[dis[e[i].v]]++;
				q.push(e[i].v);
			}
		}
	}
}

int maxflow_dfs (int u, int flow) {
	if (u == t) return flow;

	int sum_flow = 0;
	for (int & i = cur[u]; ~i; i = e[i].nxt) {
		if (e[i].w > 0 && dis[u] == dis[e[i].v] + 1) {
			int new_flow = maxflow_dfs(e[i].v, min(flow, e[i].w));
			e[i].w -= new_flow;
			e[i^1].w += new_flow;
			flow -= new_flow;
			sum_flow += new_flow;
			if (!flow) return sum_flow;
		}
	}
	if (--gap[dis[u]] == 0) dis[s] = node_tot;
	gap[++dis[u]]++;
	cur[u] = head[u];

	return sum_flow;
}

int SAP (void) {
	int ret = 0;
	maxflow_bfs();
	while (dis[s] < node_tot) {
		ret += maxflow_dfs(s, INF);
	}
	return ret;
}

char a[MAXNODE][MAXNODE];
int h, w;


int main (void) {
	reset();
	scanf("%d%d", &w, &h);

	s = h + w + 1;
	t = h + w + 2;
	node_tot = h + w + 2;

	int a1, a2, b1, b2;
	for (int i = 0; i < w; i++) {
		for (int j = 0; j < h; j++) {
			scanf(" %c", &a[i][j]);
			if (a[i][j] == 'S') {
				a1 = i;
				b1 = j;
				addEdge(s,i,INF);
				addEdge(i,s,0);
				addEdge(s,j + w,INF);
				addEdge(j + w,s,0);
			} else if (a[i][j] == 'T') {
				a2 = i;
				b2 = j;
				addEdge(i,t,INF);
				addEdge(t,i,0);
				addEdge(j + w,t,INF);
				addEdge(t,j + w,0);
			} else if (a[i][j] != '.') {	
				addEdge(i,w + j,1);
				addEdge(w + j,i,0);
				addEdge(w + j,i,1);
				addEdge(i,w + j,0);
			}
		}
	}
	if (a1 == a2 || b1 == b2) {
		printf("-1\n");
		return 0;
	}
	printf("%d\n", SAP());

}

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

using namespace std;

#define FOR(i, n) for(int i = 0; i < (int) n; i++)
#define PB push_back
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define F first
#define S second

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

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

	int n; cin >> n;

	int lcm = 360 * n / __gcd(360, n);

	cout << lcm/n << '\n';

	return 0;
}


Measured memory_bytes: 3648
#include<iostream>
#include<iomanip>
#include<string>
#include<queue>
#include<vector>
using namespace std;
int main(){
  string s;
  cin>>s;
  char c[4];
  int syurui=0;
  for(int i=0;i<4;i++){
    c[i]=s.at(i);
  }

  for(int i=0;i<4;i++){
    int count=0;
    for(int j=i+1;j<4;j++){
      if(c[i]==c[j])count++;
    }
    if(count==1)syurui++;
  }
if(syurui==2)cout<<"Yes";
else cout<<"No";
return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define rep(i, n) FOR(i, 0, n)
#define rep1(i, n) FOR(i, 1, n+1)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; --i)
#define whole(x) (x).begin(),(x).end()
#define rwhole(x) (x).rbegin(), (x).rend()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
#define P pair<int, int>
#define debug(var) cerr << "[" << #var << "] " << var << endl
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define vi vector<int>
#define vl vector<ll>
#define pb push_back
#define eb emplace_back
const ll mod = 1000000007;
const int dx[] = {-1,0,1,0};
const int dy[] = {0,-1,0,1};


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int n = 3;
    vector<int> v(n);
    rep(i, n) cin >> v[i];
    sort(whole(v));
    string ans = "YES";
    int x[3] = {5, 5, 7};
    rep(i, 3) {
        if (x[i]!=v[i]) ans = "NO";
    }
    
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3604
#include <stdio.h>

int 
main(){
	
	long int A,B;	
	scanf("%ld %ld",&A,&B);
	
	if(A==B){
		printf("1\n");;
	}
	else {
		if( (A+B)%2 == 0){
			printf("%ld\n", (A+B)/2);
		}
		else printf("IMPOSSIBLE\n");
	}

 return 0;
}

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

using namespace std;

int main() {
  int N, T;
  cin >> N >> T;
  int min_c = 1001;

  for ( int i = 0; i < N; i++ ) {
    int c, t;
    cin >> c >> t;
    if ( T >= t )
      min_c = min( min_c, c );
  }
  if ( min_c < 1001 )
    cout << min_c << endl;
  else
    cout << "TLE" << endl;
  return 0;
}

Measured memory_bytes: 256
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)


def main():
    n,k = LI()
    a = sorted([I() for _ in range(n)])
    r = inf
    for i in range(n-k+1):
        t = a[i+k-1] - a[i]
        if r > t:
            r = t

    return r


print(main())


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

using namespace std;

using ll = long long;

template<class T>
std::vector<std::pair<T, T>> PrimeFactorization(T n) {
    std::vector<std::pair<T, T>> pf;
    T m = n;
    for (T i = 2; i * i <= n; ++i) {
        if (m % i != 0) continue;
        T cnt = 0;
        while (m % i == 0) { ++cnt; m /= i; }
        pf.emplace_back(std::make_pair(i, cnt));
    }
    if (1 < m) pf.emplace_back(std::make_pair(m, 1));

    return pf;
}

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

    ll n, p;
    cin >> n >> p;

    ll ans = 1;
    auto pf = PrimeFactorization<ll>(p);
    for (auto p : pf) {
        if (n <= get<1>(p))
            ans *= pow(get<0>(p), get<1>(p) / n);
    }
    std::cout << ans << std::endl;

    return 0;
}


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

public class Main {
  private static long solve(int n, int[] as) {
    long answer = as[0] / 2;
    as[0] %= 2;
    for (int i = 1; i < n; i++) {
      if (as[i - 1] == 1 && as[i] > 0) {
        answer++;
        as[i]--;
      }
      answer += as[i] / 2;
      as[i] %= 2;
    }
    return answer;
  }
  
  private static void execute(ContestReader reader, PrintWriter out) {
    int n = reader.nextInt();
    int[] as = reader.nextInt(n);
    out.println(solve(n, as));
  }
  
  public static void main(String[] args) {
    ContestReader reader = new ContestReader(System.in);
    PrintWriter out = new PrintWriter(System.out);
    execute(reader, out);
    out.flush();
  }
}

class ContestReader {
  private BufferedReader reader;
  private StringTokenizer tokenizer;
  
  ContestReader(InputStream in) {
    reader = new BufferedReader(new InputStreamReader(in));
  }
  
  public String next() {
    while (tokenizer == null || !tokenizer.hasMoreTokens()) {
      try {
        tokenizer = new java.util.StringTokenizer(reader.readLine());
      } catch (Exception e) {
        throw new RuntimeException(e);
      }
    }
    return tokenizer.nextToken();
  }
  
  public int nextInt() {
    return Integer.parseInt(next());
  }
  
  public long nextLong() {
    return Long.parseLong(next());
  }
  
  public double nextDouble() {
    return Double.parseDouble(next());
  }
  
  public String[] next(int n) {
    String[] array = new String[n];
    for (int i = 0; i < n; i++) {
      array[i] = next();
    }
    return array;
  }
  
  public int[] nextInt(int n) {
    int[] array = new int[n];
    for (int i = 0; i < n; i++) {
      array[i] = nextInt();
    }
    return array;
  }
  
  public long[] nextLong(int n) {
    long[] array = new long[n];
    for (int i = 0; i < n; i++) {
      array[i] = nextLong();
    }
    return array;
  }
  
  public double[] nextDouble(int n) {
    double[] array = new double[n];
    for (int i = 0; i < n; i++) {
      array[i] = nextDouble();
    }
    return array;
  }
  
  public char[] nextCharArray() {
    return next().toCharArray();
  }
  
  public int[][] nextInt(int n, int m) {
    int[][] matrix = new int[n][m];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        matrix[i][j] = nextInt();
      }
    }
    return matrix;
  }
  
  public long[][] nextLong(int n, int m) {
    long[][] matrix = new long[n][m];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        matrix[i][j] = nextLong();
      }
    }
    return matrix;
  }
  
  public double[][] nextDouble(int n, int m) {
    double[][] matrix = new double[n][m];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        matrix[i][j] = nextDouble();
      }
    }
    return matrix;
  }
  
  public char[][] nextCharArray(int n) {
    char[][] matrix = new char[n][];
    for (int i = 0; i < n; i++) {
      matrix[i] = next().toCharArray();
    }
    return matrix;
  }
}


Measured memory_bytes: 37080
a,b,c,d=input()
x=int(a+b)
y=int(c+d)
if 1<=x<=12 and 1<=y<=12:
  print('AMBIGUOUS')
elif 1<=x<=12 and 0<=y<=99:
  print('MMYY')
elif 0<=x<=99 and 1<=y<=12:
  print('YYMM')
else:
  print('NA')

Measured memory_bytes: 3060
#include <iostream>
#include <cstdio>
#include <vector>
#include <cmath>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <string>
#include <climits>
#include <iomanip>
#include <algorithm>
#include <functional>

using namespace std;
#define fast ios::sync_with_stdio(false);cin.tie(0); cout.tie(0)
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, a, b) for (int i = (int)(a); i >= b; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)
#define all(c) c.begin(), c.end()
#define rall(c) c.rbegin(), c.rend()
#define tr(container, it) \
for(typeof(container.begin()) it = container.begin(); it != container.end(); it++)
#define sz(a) int((a).size())
#define pb push_back

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

template<typename T> T gcd(T a,T b) { if(a==0) return b; return gcd(b%a,a); }
template<typename T> T pow(T a,T b, ll m){T ans=1; while(b>0){ if(b%2==1) ans=(ans*a)%m; b/=2; a=(a*a)%m; } return ans%m; }

const int N = (int)2e5+77;
const ll mod = (ll)1e9+7;

ll n,m;
ll a[N];

int main() {
    fast;
    cin>>n;
    map<int,int> mp;
    forn(i,n) cin>>a[i], mp[a[i]]++;

    sort(a,a+n);

    ll mx=0,sm=0;

    for(ll i=n-1;i>0;){
        if(a[i] == a[i-1]){
            if(!mx) mx = a[i];
            else if(!sm) sm = a[i];
            i-=2;
        }else i--;
    }

    cout<<mx*sm<<endl;
    return 0;
}

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

using namespace std;
#define mx 200000
#define ll long long
int main()
{

    int x,y,x1,y1;
    cin>>x>>y>>x1>>y1;
    if(x!=x1)printf("1");
    else printf("0");

    cout<<endl;

    return 0;
}



Measured memory_bytes: 256
N,M = [int(i) for i in input().split()]
store = [[int(i) for i in input().split()] for j in range(N)]
store.sort()
tc = 0
for i in range(N):
    tc += min(store[i][1], M) * store[i][0]
    M -= store[i][1]
    if M <= 0:
        break
print(tc)

Measured memory_bytes: 25728
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
class Program
{
    static void Main(string[] args)
    {
            // 入力
            string[] sS = System.Console.ReadLine().Trim().Split(' ');
            int iA = int.Parse(sS[0]);
            int iB = int.Parse(sS[1]);

            System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();
            sw.Start();

            // 解析
            // 出力
            System.Console.WriteLine("{0}", (iA * iB).ToString().Trim());

            sw.Stop();
#if DEBUG
            Console.WriteLine();
            Console.WriteLine("{0}", sw.Elapsed.ToString());
            Console.WriteLine("続行するには何かキーを押してください．．．");
            Console.ReadKey();
#endif
    }

}


Measured memory_bytes: 27516
#include <bits/stdc++.h>
#define oo int(1e9)
using namespace std;
typedef long long ll;
int n, W;

int main() {
	cin.tie(0); ios::sync_with_stdio(0); cout.tie(0);
	cin >> n >> W;
	vector<int> w(n);
	vector<int> v(n);
	for (int i = 0; i < n; i++) cin >> w[i] >> v[i];
	vector<ll> dp(W + 1);
	for (int i = 0; i < n; i++)
	    for (int j = W; j >= w[i]; j--)
	        dp[j] = max(dp[j], dp[j - w[i]] + (ll)v[i]);
	 cout << dp[W];       
	
	return 0;
}

Measured memory_bytes: 1024
#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
using namespace std;
typedef long long int lli;
typedef unsigned long long int ulli;
#define vec(s) vector

#define vvec(s) vector<vector
>
typedef vector<lli> vi;
typedef vector<vi> vvi;
typedef pair<lli,lli> pii;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define YN(x) cout<<(x?"Yes":"No")<<endl;
#define out(s) cout<<s<<endl;
#define pb(s) push_back(s);
#define sp " ";
#define INF 10000000000
#define LINF 9000000000000000000
#define all(s) s.begin(),s.end()
void vout(vi v){
    for(int i=0;i<v.size();i++)
    cout<<v.at(i)<<endl;
}
int main(){
    lli ans = 0;
    lli n;
    cin >> n;
    rep(i,10){
        if(pow(2,i)>n){
            ans = i-1;
            break;
        }
    }
    out(pow(2,ans));
}

Measured memory_bytes: 4168
#include<iostream>
#include<string>
#include<algorithm>
#include<functional>
#include<vector>
#include<set>
#include<queue>
#include<list>
#include<stdio.h>
#include<stdlib.h>
#include<map>
#include<cstdio>
#include <iomanip>

#define rep(i,b) for(int i=0;i<b;i++)
#define rrep(i,a,b) for(int i=a;i<=b;i++)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()

using namespace std;
typedef long long ll;

int N, C;
int imos[30][101010];

int main() {
	
	cin >> N >> C;

	rep(i, N) {
		int a, b, c; cin >> a >> b >> c;
		
		//aは左端。0.5秒使えないという制限。
		//厳しい方にとるので-1しておく。

		//cは0indexedにするための調整。？

		a--; c--;

		//imos前の端の記録。入り口+1,出口-1;
		//本来なら出口は区間の+1だが、bを0indexedになおしていないので
		//これで辻褄が合う。

		imos[c][a]++;
		imos[c][b]--;

	}

	//累積和
	rep(c, C)rrep(i, 1, 101010)imos[c][i] += imos[c][i - 1];

	//ダブリの解消。2を1にする。
	rep(c, C)rep(i,101010)if (imos[c][i])imos[c][i] = 1;

	int ans = 0;
	//各時間について、縦にみて最大何チャンネル必要か数えていく。
	rep(i, 101010) {
		int cnt = 0;
		//あるiについて、全てのチャンネルについて放送しているか数える。
		rep(c, C)cnt += imos[c][i];
		ans = max(ans, cnt);
	}

	cout << ans << endl;
}

Measured memory_bytes: 12032
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
 
using namespace std;

int main(void)
{
    long double a, b, c;
    scanf("%Lf%Lf%Lf", &a, &b, &c);
    long double eps = 1.0e-14;
    
    if (sqrtl(a) + sqrtl(b) + eps < sqrtl(c)) {
        printf("Yes\n");
    }
    else {
        printf("No\n");
    }
    return 0;
}


Measured memory_bytes: 128
import math
x = y = n= 0
while True:
	d,a = map(int,input().split(','))
	if d == a == 0: break
	x += d*math.sin(math.radians(n))
	y += d*math.cos(math.radians(n))
	n+=a
print(*map(int,(x,y)),sep='\n')


Measured memory_bytes: 5716
#include <bits/stdc++.h>
#define ll long long
#define all(a) (a).begin(),(a).end()

using namespace std;

int main(int argc, char const *argv[]) {
  string N;
  std::cin >> N;
  for (size_t i = 0; i < 2; i++) {
    if(N[i]=='9'){
      printf("Yes\n");
      return 0;
    }
  }
  printf("No\n");
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
 
  //input output template
  /*
  int N;
  cin >> N;
  cout << "Hello, world!" << endl;
  */
  
  int num;
  cin >> num;
  
  int x=0;
  int y=0;
  
  int ans=0;
  for(int i=1;i<=num;i++){
   for(int j=1;j<=num;j++){ 
    for(int k=1;k<=num;k++){
  	 x = std::gcd(i, j);
     y = std::gcd(x, k);
      ans += y;
    }
   }
  }
  
  cout << ans << endl;
}

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

int a[2], q;
ll s[2][mx], x;

int main(){
  scanf("%d%d%d", a, a+1, &q);
  for(int i = 0; i < 2; i++){
    for(int j = 1; j <= a[i]; j++) scanf("%lld", s[i]+j);
    s[i][0] = -1e12, s[i][a[i]+1] = 1e12;
  }
  for(int i = 0; i < q; i++){
    scanf("%lld", &x);
    ll t[2][2], ans = 1e12;
    for(int j = 0; j < 2; j++){
      ll* tm = lower_bound(s[j], s[j]+a[j]+2, x);
      t[j][0] = *(tm-1), t[j][1] = *tm;
    }
    for(int j = 0; j < 8; j++){
      ans = min(ans, abs(x - t[j&1][j>>2]) + abs(t[j&1][j>>2] - t[(~j)&1][(j>>1)&1]));
    }
    printf("%lld\n", ans);
  }
}

Measured memory_bytes: 2816
e1,e2,e3,e4=map(int,input().split())
if e1==e2 and e3==e4:
    print('yes')
elif e2==e3 and e1==e4:
    print('yes')
elif e3==e1 and e2==e4:
    print('yes')
else:
    print('no')


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

int main() {
  int A,B,C,D;
  cin >> A >> B >> C >> D;
  int L = A + B;
  int R = C + D;
  
  if(L > R){
    cout << "Left" << endl;
  }
  else if(L == R){
      cout << "Balanced" << endl;
  }
  else{
    cout << "Right" << endl;
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long int
using namespace std;
#define mod 1000000007
#define pb push_back
#define ff first
#define ss second
#define mp make_pair
#define lb lower_bound
#define debug(x) cout<<"["<<#x<<": "<<x<<"]"<<endl
#define f(p,n) for(ll i=p;i<n;i++)
ll exp(ll a,ll b,ll m);

int main()
{
 ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
 	/*
 	#ifndef ONLINE_JUDGE
        freopen("/home/savish/Desktop/2019/io/input.txt", "r", stdin);
        freopen("/home/savish/Desktop/2019/io/output.txt", "w", stdout);
    #endif
        */
    ll n;
    cin>>n;
    ll a[n][3];
    f(0,n)
    {
    	cin>>a[i][0]>>a[i][1]>>a[i][2];
    }
    ll dp[n][3];
    dp[0][0] = a[0][0],dp[0][1] = a[0][1] , dp[0][2] = a[0][2];

    f(1,n)
    {
    	dp[i][0] = max(dp[i-1][1],dp[i-1][2])+a[i][0];
    	dp[i][1] = max(dp[i-1][0],dp[i-1][2])+a[i][1];
    	dp[i][2] = max(dp[i-1][1],dp[i-1][0])+a[i][2];
    }
    cout<<max(max(dp[n-1][0],dp[n-1][1]),dp[n-1][2])<<endl;
return 0;
}

ll exp(ll a,ll b,ll m)
{
	if(b==0)
	{
		return 1;
	}
	ll temp =exp(a,b/2,m);
	temp=(temp*temp)%m;
	if(b&1)
	{
		return (temp*(a%m))%m;
	}
	return temp;
}

Measured memory_bytes: 4992
#include <iostream>

using namespace std;

int main() {
	int D;
	cin >> D;
	
	switch (D) {
	case 22:
		cout << "Christmas Eve Eve Eve";
		break;
	case 23:
		cout << "Christmas Eve Eve";
		break;
	case 24:
		cout << "Christmas Eve";
		break;
	case 25:
		cout << "Christmas";
		break;
	}

	cout << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  
  int a,b;
  cin>>a>>b;
  
  for(int i =0 ;i<=100000;i++)
  {
     if(floor(i*0.08)==a && floor(i*0.1)==b)
     {
       cout<<i<<endl;return 0;
     }
  }
  cout<<-1<<endl;
}

Measured memory_bytes: 256
// clang-format off

#include <bits/stdc++.h>

#define int long long int
#define main signed main()
#define bye return 0
#define rep(i, n) for (int i = 0; i < (n); i++)
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define each(p, v) for (auto p = (v).begin(); p != (v).end(); p++)
#define all(v) (v).begin(), (v).end()
#define prec(n) fixed << setprecision(n)
#define exact(x) { return (x); }

#define sum(v) accumulate(all(v), 0)
#define stlice(s, l) substr(s, (s) + (l) + 1)
#define odd(n) ((n) % 2)
#define even(n) (!((n) % 2))

#define INF 1e9
#define EPS 1e-10
#define MOD (1e9 + 7)

#define pb push_back
#define mt make_tuple
#define fi first
#define se second
#define str string
#define vi vector<int>
#define vb vector<bool>
#define vc vector<char>
#define vs vector<str>

using namespace std;

// clang-format on

main {
  int n;
  cin >> n;
  int a[n];
  int c = 1, m = 2; // m=0↓, m=1↑, m=2→
  cin >> a[0];
  loop(i, 1, n) {
    cin >> a[i];
    if (m == 2) {
      if (a[i] > a[i - 1])
        m = 1;
      if (a[i] < a[i - 1])
        m = 0;
    }
    if (m == 1 && a[i] < a[i - 1]) {
      c++;
      m = 2;
    }
    if (m == 0 && a[i] > a[i - 1]) {
      c++;
      m = 2;
    }
  }
  cout << c << endl;
  bye;
}


Measured memory_bytes: 1152
#include <iostream>
#include <utility>
#include <map>
#include <vector>
#include <algorithm>
#include <queue>
#include <math.h>
#include <stack>
#include <set>
#include <deque>
#include <cmath>
#include <cassert>

using namespace std;
typedef long long ll;
ll mod = 1e9+7;
#define rep(i,n) for(int i = 0; i < (n); ++i)

int main(){
    int n;
    cin >> n;
    ll mul = 1LL;
    vector<ll> a(n);
    bool flg = false;
    rep(i, n) {
        cin >> a[i];
        if (a[i] == 0) flg = true;
    }
    if (flg) {
        cout << 0 << endl;
        return 0;
    }
    ll pre_mul = 0;
    rep(i, n) {
        mul *= a[i];
        //cout << mul << endl;
        if (mul < pre_mul || mul > 1000000000000000000) {
            cout << -1 << endl;
            return 0;
        }
        pre_mul = mul;
    }
    if ( mul > 1000000000000000000 ) cout << -1 << endl;
    else                             cout << mul << endl;
    return 0;
}


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

using namespace std;

int main (){

int i,n,m,c=0;

  cin>>n>>m;

 if (m>1) 
c+=m*(m-1)/2;

  if(n>1)
c+=n*(n-1)/2;
  cout<<c<<endl;
return 0;}

Measured memory_bytes: 256
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
const int maxn = 200005;

typedef long long ll;
ll a[maxn];
void action()
{
    int n;
    scanf("%d",&n);
    int flag = 0;
    for(int i=0; i<n; i++)
    {
        scanf("%lld",&a[i]);
    }

     for(int i=1; i<n; i++)
        if(a[i] != a[i-1])
            flag = 1;
    if(flag == 0)
    {
        cout<<a[n-1]<<' '<<a[n-2]<<endl;
        return;
    }

    sort(a,a+n);
    double cnt = a[n-1]*1.0/2;
    int pos = upper_bound(a,a+n,(int)cnt) - a;
    int pos1 = pos;

    while(a[pos1] > cnt)
        pos1 --;

    if(pos == n-1)
        pos--;

    if(abs(a[pos1] - cnt) <= abs(a[pos] - cnt) )
    {
        cout<<a[n-1]<<' '<<a[pos1]<<endl;
    }
    else
    {
        cout<<a[n-1]<<' '<<a[pos]<<endl;
    }
}
int main()
{
    action();

    return 0;
}


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

typedef pair<int, int> i_i;

i_i f(int H, int W, int z) {
	int x, y;
	if (z < W) {
		x = z;
		y = 0;
	}
	else if (z >= W + H - 2) {
		x = (W - 1) - (z - (W + H - 2));
		y = H - 1;
	}
	else {
		x = W - 1;
		y = z - (W - 1);
	}
	return i_i(x, y);
}

int main() {
	int W, H; cin >> W >> H;
	int a = 0, b = 0;
	int N; cin >> N;
	int cnt = 0;
	while (N--) {
		int z; cin >> z;
		if (z) a++;
		else b++;
		i_i p = f(H - 2, W - 1, a), q = f(H, W, b);
		if (abs(p.first - q.first) + abs(p.second - q.second + 1) == 1)
			cnt++;
	}
	cout << cnt << endl;
}

Measured memory_bytes: 3116
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<stdbool.h>
#include<math.h>
#include<limits.h>
#define MAX 6
char table[MAX][MAX];
char table_copy[MAX][MAX];
char table_ori[MAX][MAX];
int H, W, K;
int count()
{
    int ret = 0;
    for (int i = 0; i < H; i++) {
        for (int j = 0; j < W; j++) {
            if (table[i][j] == '#')
                ret++;
        }
    }
    return ret;
}

int main()
{
    int ans = 0;
    scanf("%d %d %d", &H, &W, &K);
    char str[100];
    for (int i = 0; i < H; i++){
        scanf("%s", str);
        for (int j = 0; j < W; j++) {
            table[i][j] = str[j];
        }
    }

    memcpy(table_ori, table, sizeof(table));

    for (int bit1 = 0; bit1 < (1 << W); bit1++) {
        memcpy(table, table_ori, sizeof(table));
        for (int i = 0; i < W; i++) {
            if (bit1 & (1 << i)) {
                for (int j = 0; j < H; j++)
                    table[j][i] = '*';
            }
        }

        memcpy(table_copy, table, sizeof(table));

        for (int bit2 = 0; bit2 < (1 << H); bit2++) {
            memcpy(table, table_copy, sizeof(table));
            for (int k = 0; k < H; k++) {
                if (bit2 & 1 << k) {
                    for (int l = 0; l < W; l++)
                        table[k][l] = '*';
                }
            }
            if (count() == K)
                ans++;
        }
    }

    printf("%d", ans);
}


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

void printv(double x, double y) {
  cout << fixed << setprecision(8) << x << ' ' << y << endl;
}

struct pos {
  double x, y;
};

void koch(double sx, double sy, double ex, double ey, int n) {
  if (!n) {
    printv(sx, sy);
    return;
  }
  pos m1 = {(2 * sx + ex) / 3, (2 * sy + ey) / 3};
  pos m2 = {sx + (ex - sx) / 2 - (ey - sy) * sqrt(3) / 6,
            sy + (ey - sy) / 2 + (ex - sx) * sqrt(3) / 6};
  pos m3 = {(sx + 2 * ex) / 3, (sy + 2 * ey) / 3};

  koch(sx, sy, m1.x, m1.y, n - 1);
  koch(m1.x, m1.y, m2.x, m2.y, n - 1);
  koch(m2.x, m2.y, m3.x, m3.y, n - 1);
  koch(m3.x, m3.y, ex, ey, n - 1);
}

int main() {
  int c;
  cin >> c;
  koch(0, 0, 100, 0, c);
  printv(100, 0);
}



Measured memory_bytes: 3248
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	int n;
	cin >> n;
	vector<int>d1(n), d2(n);
	for (int i = 0; i < n; ++i) 
		cin >> d1[i] >> d2[i];
	for (int i = 0; i < n - 2; ++i) {
		if (d1[i] == d2[i] && d1[i + 1] == d2[i + 1] && d1[i + 2] == d2[i + 2]) {
			cout << "Yes";
			return 0;
		}
	}
	cout << "No";
}

Measured memory_bytes: 3652
K, A, B = map(int,input().split())
biscuit = 1
yen = 0
if A >= B or B-A == 1:
    biscuit += K

else:
    biscuit += A-1
    K -= A-1
    
    biscuit += (B-A)*(int(K/2))
    
    if K%2 == 1:
        biscuit += 1

print(biscuit)

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

void update(int v, int d, int c, vector<vector<int> > &adj, vector<vector<int> > &dp){

    if(dp[v][d] != 0) return;

    dp[v][d] = c;
    if(d == 0) return;

    update(v, d - 1, c, adj, dp);

    for(auto u : adj[v]){
        update(u, d - 1, c, adj, dp);
    }

    return;
}

int main(){

    int n, m; cin >> n >> m;
    vector<vector<int> > adj(n);
    for(int i = 0; i < m; i++){
        int a, b; cin >> a >> b;
        a--;
        b--;
        adj[a].push_back(b);
        adj[b].push_back(a);
    }

    int q; cin >> q;
    vector<int> v(q);
    vector<int> d(q);
    vector<int> c(q);
    for(int i = 0; i < q; i++){
        cin >> v[i] >> d[i] >> c[i];
        v[i]--;
    }
    
    vector<vector<int> > dp(n, vector<int> (11, 0));
    
    for(int i = q - 1; i >= 0; i--){
        update(v[i], d[i], c[i], adj, dp);
    }

    for(int i = 0; i < n; i++) cout << dp[i][0] << endl;

    return 0;
}

Measured memory_bytes: 16248
#include<iostream>
using namespace std;
int main(void){
  int m[100][100];
  int n, u, k, v;
  cin >> n;
  for(int i=0; i<n; i++){
    for(int j=0; j<n; j++){
      m[i][j]=0;
    }
  }

  for(int i=0; i<n; i++){
    cin >> u >> k;
    u--;
    for(int j=0; j<k; j++){
      cin >> v;
      v--;
      m[u][v]=1;
    }
  }

  for(int i=0; i<n; i++){
    for(int j=0; j<n; j++){
      if(j)cout << " ";
      cout << m[i][j];
    }
    cout << endl;
  }

  return 0;
}

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

int main() {
	int n, result = 0;
	int arr[200001] = { 0, };
	scanf("%d", &n);
	for (int i = 0; i < n; i++) {
		scanf("%d", &arr[i]);
		result ^= arr[i];
	}

	for (int i = 0; i < n; i++) {
		printf("%d ", result^arr[i]);
	}

	return 0;
}

Measured memory_bytes: 3284
from itertools import product


def BothAreOpen(arrange1, arrange2):
    counter = 0
    for element in zip(arrange1, arrange2):
        if element == (1, 1):
            counter += 1
    return counter


N = int(input())
OpeningHours = [list(map(int, input().split())) for i in range(N)]
Profits = [list(map(int, input().split())) for i in range(N)]

ans = -1000000000000000000000000

for MyShop in product([0, 1], repeat=10):
    if MyShop == tuple([0] * 10):
        continue

    chofuku = []
    for OtherStore in OpeningHours:
        chofuku.append(BothAreOpen(MyShop, OtherStore))

    x = sum([Profits[i][chofuku[i]] for i in range(N)])
    if x > ans:
        ans = x

print(ans)


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

int main(){
    ll N;
    cin >> N;
    ll ans = 0;
    for (ll i = 1; i <= sqrt(N); i++) {
        if (i*i >= N) break;
        if ((N-i)%i == 0) {
            if ((N-i)/i <= i) continue;
            ans += (N-i)/i;
            //cout << (N-i)/i << endl;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
# include <iostream>
# include <algorithm>
#include <array>
# include <cassert>
#include <cctype>
#include <climits>
#include <numeric>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <tuple>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <bitset>
# include <complex>
# include <chrono>
# include <random>
# include <limits.h>
# include <unordered_map>
# include <unordered_set>
# include <deque>
# include <cstdio>
# include <cstring>
#include <stdio.h>
#include <stdlib.h>
#include <cstdint>
#include <cfenv>
//#include <bits/stdc++.h>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
constexpr long long MOD = 1000000000 + 7;
constexpr long long INF = std::numeric_limits<long long>::max();
const double PI = acos(-1);
#define fir first
#define sec second
#define thi third
#define debug(x) cerr<<#x<<": "<<x<<'\n'
typedef pair<LL, LL> Pll;
typedef pair<LL, pair<LL, LL>> Ppll;
typedef pair<LL, pair<LL, bitset<100001>>> Pbll;
typedef pair<LL, pair<LL, vector<LL>>> Pvll;
typedef pair<LL, LL> Vec2;
struct Tll { LL first, second, third; };
typedef pair<LL, Tll> Ptll;
#define rep(i,rept) for(LL i=0;i<rept;i++)
#define Mfor(i,mf) for(LL i=mf-1;i>=0;i--)
LL h, w, n, m, k, s, t, q, sum, last, cnt, ans,a[1000000];
string str, ss;
bool f;
char c;
int di[4][2] = { {1,0},{-1,0} ,{0,1},{0,-1} };
struct Edge { LL to, cost; };
vector<Edge>vec[10000], rev[10000];
void YN(bool f) {
	if (f)
		cout << "YES" << endl;
	else
		cout << "NO" << endl;
}
void yn(bool f) {
	if (f)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
}
int main() {
	cin >> n;
	rep(i, n) {
		cin >> a[i];
	}
	sort(a, a + n);
	ans = a[n - 1];
	cnt = INF;
	rep(i, n - 1) {
		if (abs(a[i]*2 - ans)<cnt) {
			cnt = abs(a[i]*2 - ans);
			q = a[i];
		}
	}
	cout << ans << " " << q << endl;
	return 0;
}

Measured memory_bytes: 1536
#include <stdio.h>

int main() {

 int P;
 int Q;
 int R;
 int min;
 int ret = scanf("%d %d %d", &P, &Q, &R);
 if( ret == EOF ) {
    printf( "scanfでエラー\n" );
    return -1;
  }
 if( P < 1 || 100 < P || Q < 1 || 100 < Q || R < 1 || 100 < R){
	printf( "scanfでエラー\n" );
    return -2;
 }
 
 min = P+Q;
 if ( Q+R < min){
	min =Q+R;
 }
 if ( R+P < min){	
	min =R+P;
 }
 printf("%d\n",min);
 
 return 0;

}

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

int main() {
  int N;
  cin >> N;
  vector<int> b(N);
  rep(i, N) cin >> b[i];
  reverse(b.begin(), b.end());
  int i = 0;
  vector<int> ans;
  while(!b.empty()){
    i = 0;
    bool erase = false;
    for(auto it = b.begin(); it != b.end(); it++){
      if(*it == b.size() - i){
        ans.push_back(*it);
        b.erase(b.begin() + i);
        erase = true;
        break;
      }
      ++i;
    }
    if(!erase){
      cout << -1 << endl;
      return 0;
    }
  }

  for(int i = 0; i < ans.size(); ++i){
    cout << ans[ans.size() - 1 - i] << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

typedef long long ll;

#define MAXN 3005

ll arr[MAXN];

ll dp[MAXN][MAXN];

int main(){

    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);cerr.tie(NULL);

    int n;cin>>n;

    for(int i=1;i<=n;i++) cin>>arr[i];

    for(int r = 1;r<=n;r++){
        for(int l = r;l>0;l--){
            dp[r][l] = max(arr[l] - dp[r][l+1], arr[r] - dp[r-1][l]);

        }

    } 

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

}


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

int main(void){
    set<string>set;
    string s; cin >> s;
    int k; cin >> k;
    for(int i=0;i<s.length();i++){
        for(int j=1;j<=k;j++){
            set.insert(s.substr(i,j));
        }
    }
    auto itr = set.begin();
    for(int i=1;i<k;i++) itr++;
    cout << *itr << endl;
    return 0;
}

Measured memory_bytes: 1664
#include <bits/stdc++.h>
#define WHOLE(v) (v).begin(), (v).end()
#define REV_WHOLE(v) (v).rbegin(), (v).rend()
using i64 = int64_t;
using namespace std;
template <size_t I, class H, class... T> struct TupleReaderWriter{static tuple<H,T...> r(istream&i){H v;i>>v;return tuple_cat(tuple<H>(v),TupleReaderWriter<sizeof...(T)-1,T...>::r(i));}static void w(ostream&o,tuple<H,T...>&t,string d){TupleReaderWriter<I-1,H,T...>::w(o,t,d);o<<d<<get<I>(t);}};
template <class H, class... T> struct TupleReaderWriter<0,H,T...>{static tuple<H,T...> r(istream&i){H v;i>>v;return tuple<H>(v);}static void w(ostream&o,tuple<H,T...>&t,string d){o<<get<0>(t);}};
template <class... T> istream& operator>>(istream&i,tuple<T...>& t) { t = TupleReaderWriter<sizeof...(T), T...>::r(i); return i; }
template <class... T> ostream& operator<<(ostream& o, tuple<T...>& t) { string delim = " "; TupleReaderWriter<sizeof...(T) - 1, T...>::w(o, t, delim); return o; }
template<typename T> using rev_priority_queue = priority_queue<T, vector<T>, greater<T>>;
template<typename T> using vector2d = vector<vector<T>>;
void R_YESNO(bool p) { cout << (p ? "YES" : "NO") << endl; }
void R_YesNo(bool p) { cout << (p ? "Yes" : "No") << endl; }
int main() {
    int N;
    cin >> N;
    bool ans = false;
    for(int i = 1; i < 10; i++) {
        for(int j = 1; j < 10; j++) {
            ans |= i * j == N;
        }
    }
    R_YesNo(ans);
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <math.h>
#include <algorithm>
#define N 100005
using namespace std;

struct kv
{
    int key, value;
};

bool cmp(kv a, kv b)
{
    return a.value > b.value;
}

int main()
{
    int n, change, a;
    struct kv even[N], odd[N];
    cin >> n;
    for (int i = 0; i < N; i++)
    {
        odd[i].key = i;
        odd[i].value = 0;
        even[i].key = i;
        even[i].value = 0;
    }

    for (int i = 1; i <= n; i++)
    {
        cin >> a;
        if (i % 2 == 0)
        {
            even[a].value++;
        }
        else
        {
            odd[a].value++;
        }
    }

    sort(odd, odd + N, cmp);
    sort(even, even + N, cmp);

    if (odd[0].key != even[0].key)
    {
        change = n - odd[0].value - even[0].value;
    }
    else
    {
        change = min(n - odd[0].value - even[1].value, n - odd[1].value - even[0].value);
    }

    cout << change << endl;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define INF (1<<30)
#define MOD 1000000007
#define l_ength size
using ll = long long;
using namespace std;

ll dp[2000000];

int main(){
	int x; cin >> x;
	vector<int> color = {100, 101, 102, 103, 104, 105};
	dp[0] = 1;
	for( int i = 1; i <= 100000; ++i ){
		for( auto k : color ){
			if( i-k >= 0 ) dp[i] += dp[i-k];
		}
	}
	cout << ( ( dp[x] == 0 ) ? "0" : "1" ) << endl;
	return 0;
}

Measured memory_bytes: 1024
using System;
using System.Collections.Generic;
using System.Linq;

namespace ABC
{
    class Program
    {
        static void Main(string[] args)
        {
            ABC106_A();
        }

        static void ABC106_A()
        {
            var AB = Console.ReadLine().Split(' ').Select(int.Parse).ToList();
            Console.WriteLine((AB[0] - 1) * (AB[1] - 1));
        }
    }
}

Measured memory_bytes: 11220
N = int(raw_input())
a = []
b = []
for i in range(N):
  a.append(int(raw_input()))
a.sort()
if N%2==0:
  b.append(a[N/2-1])
  for i in range(N/2-1):
    b.append(a[N-1-i])
    b.append(a[i])
  b.append(a[N/2])
else:
  if abs(a[(N-1)/2]-a[(N-3)/2])<abs(a[(N-1)/2]-a[(N+1)/2]):
    b.append(a[(N-3)/2])
    a.pop((N-3)/2)
    for i in range((N-1)/2):
      b.append(a[N-i-2])
      b.append(a[i])
  else:
    b.append(a[(N+1)/2])
    a.pop((N+1)/2)
    for i in range((N-1)/2):
      b.append(a[i])
      b.append(a[N-i-2])
x = 0
for i in range(N-1):
  x += abs(b[i+1]-b[i])
print x

Measured memory_bytes: 10208
#include <cstdio>
#include<iostream>
#include<algorithm>

#define NMAX 10000
#define QMAX 500
using namespace std;

int main(void){

	int n,q;
	long long S[NMAX],T;
	int cnt=0;

	cin>>n;

	for(int i=0;i<n;i++){
		cin>>S[i];
	}
	sort(S,S+n);

	cin>>q;

	for(int i=0;i<q;i++){
		cin>>T;
		for(int j=0;j<n;j++){
			if(S[j]==T){
				cnt++;
				break;
			}
			if(S[j]>T) break;
		}
	}

	cout<<cnt<<endl;

    return 0;
}

Measured memory_bytes: 1264
#include<bits/stdc++.h>
using namespace std;
int main()
{int n ;
 cin>>n;
 int a[n-1];
 int hash[n+1]={0};

 for(int i=0;i<n-1;i++)
 {  cin>>a[i];
hash[a[i]]++;
  
  
 }
 for(int i =1;i<=n;i++)
   cout<<hash[i]<<endl;

}

Measured memory_bytes: 5192
import sys
input = sys.stdin.readline
N, W = map(int, input().split())
b = []
for _ in range(N):
  w, v = map(int, input().split())
  b.append((w, v))
wbias = b[0][0]
dp = [[[0] * (3 * N + 1) for _ in range(N + 1)] for _ in range(N + 1)]
for i in range(N):
  for k in range(N):
    for j in range(3 * N + 1):
      if i + 1 <= N:
        dp[i + 1][k][j] = max(dp[i + 1][k][j], dp[i][k][j])
        if j + b[i][0] - wbias <= 3 * N and (k < N):
          dp[i + 1][k + 1][j + b[i][0] - wbias] = max(dp[i + 1][k + 1][j + b[i][0] - wbias], dp[i][k][j] + b[i][1])

#print(dp)
res = 0
for k in range(N + 1):
  for j in range(3 * N + 1):
    if j + k * wbias <= W:
      res = max(res, dp[-1][k][j])
print(res)

Measured memory_bytes: 68828
#include <iostream>
#include <bitset>
#include <string>
#include <algorithm>
#include <cmath>
#include <vector>
#include <numeric>
#include <functional>
using namespace std;

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

template<typename T>
void remove(std::vector<T>& vector, unsigned int index)
{
    vector.erase(vector.begin() + index);
}

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

    vector<int> div;
    int now=1;
    int count = 0;
    for(int i = 0; i < N; i++)
    {
        if (S[i] == (char)('0' + now))
            count++;
        else
        {
            div.push_back(count);
            now ^= 1;
            count = 1;
        }
    }
    if (count != 0) div.push_back(count);
    if (div.size() % 2 == 0) div.push_back(0);
    
    vector<int> acc(div.size() + 1);
    for(int i = 0; i < div.size(); i++)
    {
        acc[i+1] = acc[i] + div[i];
    }
    
    int Add = 2*K+1;
    int ans = 0;
    for(int i = 0; i < div.size(); i+=2)
    {
        int left = i;
        int right = min(i+Add, (int)div.size());
        int temp = acc[right] - acc[left];
        ans = max(ans, temp);
    }
    cout << ans << endl;
}


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

const string bo = "aiueo";
const string shi = "kstnhmyrwgzdbp";
const string musei = "ksthp";
int main(){
  string s;
  while(cin >> s, s!="#"){
    vector< pair<string,int> > haku;
    rep(i,s.size()){
      int len = 0, type = 0;
      if(bo.find(s[i]) != string::npos){
	if(i>0 && bo.find(s[i-1]) != string::npos)len = 1, type = 6;
	else len = 1, type = 1;
      }else{
	if(i+1<(int)s.size()){
	  if(s[i+1] == '\'')len = 2, type = 5;
	  else if(s[i+1] == s[i])len = 1, type = 4;
	  else if(s[i+1] == 'y')len = 3, type = 3;
	  else if(bo.find(s[i+1]) != string::npos)len = 2, type = 2;
	  else len = 1, type = 5;
	}else len = 1, type = 5;
      }
      haku.push_back(make_pair(s.substr(i,len), type) );
      i += len-1;
    }
    /*
    rep(i,haku.size()){
      cout << haku[i].first << " " << haku[i].second << endl;
    }
    */

    vector<int> par(haku.size(),0);
    rep(i,haku.size()){
      if( (haku[i].second == 2 || haku[i].second == 3)
	 && musei.find(haku[i].first[0]) != string::npos){
	if(haku[i].first.back() == 'i' || haku[i].first.back() == 'u'){
	  if(i+1==(int)haku.size() || musei.find(haku[i+1].first[0]) != string::npos){
	    par[i] = 1;
	  }
	}
	if(haku[i].first.back() == 'a' || haku[i].first.back() == 'o'){
	  if(i+1<(int)haku.size() && (haku[i+1].second == 2 || haku[i+1].second == 3)
	     && musei.find(haku[i+1].first[0]) != string::npos
	     && haku[i+1].first.back() == haku[i].first.back()){
	    par[i] = 1;
	  }
	}
      }
    }
    
    //rep(i,haku.size())cerr << par[i] << " "; cerr << endl;

    int prv = 0;
    rep(i,haku.size()){
      if(bo.find(haku[i].first.back()) != string::npos){
	if(par[i] && !prv){
	  cout << haku[i].first.substr(0,haku[i].first.size()-1) << "(" << haku[i].first.back() << ")";
	  prv = 1;
	}else{
	  cout << haku[i].first;
	  prv = 0;
	}
      }else{
	cout << haku[i].first;
      }	
    }
    cout << endl;
  }
}

Measured memory_bytes: 1196
//#pragma GCC target("avx2")
#pragma GCC optimize("O3")
//#pragma GCC optimize("unroll-loops")

#include <bits/stdc++.h>

using namespace std;

#ifdef LOCAL
#include <prettyprint.hpp>
#define debug(...)  cerr << "[" << #__VA_ARGS__ << "]: ", d_err(__VA_ARGS__);
#else
#define debug(...) 83;
#endif

void d_err() {
    cerr << endl;
}

template <typename H, typename... T>
void d_err(H h, T... t) {
    cerr << h << " ";
    d_err(t...);
}

template <typename T>
void print(T x) {
    cout << x << "\n";
}

#define ALL(x) (x).begin(), (x).end()
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define REVFOR(i, m, n) for (int i = (n - 1); i >= (m); --i)
#define REP(i, n) FOR(i, 0, n)
#define REVREP(i, n) REVFOR(i, 0, n)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define bcnt __builtin_popcountll

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<ll,ll> Pll;
typedef pair<int,int> Pin;

ll INF = 1e16;
int inf = 1e9;
ll MOD = 1e9+7;

int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    
    string s;
    cin >> s;

    if (s.back() == 's') s += "es";
    else s += 's';

    print(s);
    
}


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

int main(void){
    int n;
    int a,b,c,d;
    int count;
    while(cin>>n){
        count=0;
        for(a=0;a<=9;a++){
            for(b=0;b<=9;b++){
                for(c=0;c<=9;c++){
                    d=n-a-b-c;
                    if(0<=d and d<=9){count++;}
                }
            }
        }
        cout<<count<<endl;
    }
    return 0;
}



Measured memory_bytes: 3108
#include <bits/stdc++.h>
using namespace std; 
typedef long long int ll;
typedef unsigned long long int ull;
typedef pair <int,int> PII;
typedef pair <int,string> PIS;
typedef vector <int> vec;
#define endl '\n'
#define pi 3.141592653589793
#define fori(z,n) for(int i=z;i<n;i++)
#define forii(z,n) for(int i=z;i<=n;i++)
int main() 
{ 
    std::ios::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int n,d;
    cin>>n>>d;
    int m = d*2+1;
    double di = n*1.0/m;
    cout<<ceil(di);
    cerr<<"Time elapsed"<<1.0*clock()/CLOCKS_PER_SEC<<"s\n";
    return 0;
}


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

class Main{
    public static void main(String[] args) throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] input = br.readLine().split(" ");
        int n = Integer.parseInt(input[0]);
        int m = Integer.parseInt(input[1]);
        int x = Integer.parseInt(input[2]);

        input = br.readLine().split(" ");
        int left = 0;
        int right = 0;
        for(String s : input){
            if(Integer.parseInt(s) < x){
                left++;
            }else if(Integer.parseInt(s) > x){
                right++;
            }
        }

        System.out.println(Math.min(left,right));
    }
}

Measured memory_bytes: 22868
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<vector>
#include<queue>
#include<algorithm>
using namespace std;
int main(void){
	int a[7];
	int b[100000];
	int c;
	int k;
	int n;
	int m;
	int p;
	int q;
	long long s;
	int x;
	int y;
	int z;
	c = 0;
	long long plus=0;
	long long minus=0;
	long long max;
	s = 0;
	scanf("%d %d %d %d %d %d %d", &a[0], &a[1], &a[2], &a[3], &a[4], &a[5],&a[6]);
	s = s + a[1];
		if (a[0]!=0&&a[3] != 0 && a[4] != 0){
			c = (a[0]%2) + (a[3]%2) + (a[4]%2);
			if (c > 1){
				s = s + 3;
				a[0]--;
				a[3]--;
				a[4]--;
			}
		}
	s = s + 2 * (a[0] / 2);
	s = s + 2 * (a[3] / 2);
	s = s + 2 * (a[4] / 2);
	printf("%lld\n", s);

	return 0;
}

Measured memory_bytes: 128
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <iostream>
#include <utility>
#include <set>
#include <list>
#include <cctype>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <iomanip>
#include <iterator> 
#include <limits>

#define REP(i,n) for (int i=0;i<(n);i++)
#define FOR(i,a,b) for (int i=(a); i<(b); i++)
#define ALL(a) (a).begin(),(a).end()
#define RALL(A) (a).rbegin(),(a).rend()
#define PB push_back
#define MP make_pair

#define dump(x) cerr << #x << " = " << (x) << endl;

using namespace std;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const int INF = numeric_limits<int>::max() / 2;
const int NEG_INF = numeric_limits<int>::min() / 2;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

int H, W, K;
VS table;
const int MAX_H = 800 + 10;
const int MAX_W = 800 + 10;
int cost_mat[MAX_H][MAX_W];

void solve() {
    PII start;
    REP(i, H) {
        REP(j, W) {
            cost_mat[i][j] = INF;
            if (table[i][j] == 'S') {
               start = make_pair(i, j); 
            }
        }
    }
    // startからK回で移動できるところを列挙
    int dx[4] = {-1, 0, 1, 0};
    int dy[4] = {0, -1, 0, 1};
    queue<PII> que;
    que.push(start);
    cost_mat[start.first][start.second] = 0;

    while (!que.empty()) {
        PII pos = que.front(); que.pop();
        if (cost_mat[pos.first][pos.second] < K) {
            REP(d, 4) {
                int ni = pos.first + dx[d];
                int nj = pos.second + dy[d];
                if (0 <= ni and ni < H and 0 <= nj and nj < W and table[ni][nj] != '#') {
                    if (cost_mat[ni][nj] > cost_mat[pos.first][pos.second] + 1) {
                        cost_mat[ni][nj] = cost_mat[pos.first][pos.second] + 1;
                        que.push(make_pair(ni, nj));
                    }
                }
            }
        }
        
    }

    // 移動できるところから最短距離を求める
    int ans = INF;
    REP(i, H) {
        REP(j, W) {
            if (cost_mat[i][j] != INF) {
                //cout << i << " " << j << endl;
                ans = min(ans, (i + K - 1) / K);
                ans = min(ans, (j + K - 1) / K);
                ans = min(ans, (H - i - 1 + K - 1) / K);
                ans = min(ans, (W - j - 1 + K - 1) / K);
            }
        }
    }
    cout << ans + 1 << endl;


    
}

int main(int argc, char const* argv[])
{
    cin >> H >> W >> K;
    REP(i, H) {
        string s; cin >> s;
        table.PB(s);
    }
    solve();
    return 0;
}


Measured memory_bytes: 3584