akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#define MAX_L 200001
#define MIN_PRO -1000000000
int R[MAX_L];
int main() {
    int n;
    int temp;
    scanf("%d", &n);
    int profit = MIN_PRO;
    for(int i = 0;i<n;i++)
    {
        scanf("%d", &R[i]);
    }
    int min = R[0];
    for(int j=1;j<n;j++)
    {
        temp = R[j] - min;
        if(profit<temp){profit = temp;}
        if(R[j]<min){min=R[j];}
    }
    printf("%d\n", profit);
    return 0;
}



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

int main()
{
    int a, b, c;
    cin >> a >> b >> c;
    int i = 0, sum = 0;
    while(c > sum){
        i++;
        sum += a + (i % 7 == 0 ? b : 0);
    }
    cout << i << endl;
    return 0;
}


Measured memory_bytes: 3116
#include <stdio.h>
int main(){
	int W,H;
	char S[2];
	scanf("%d%d%s",&W,&H,S);
	for(int h=0;h<H;puts(""),h++)for(int w=0;w<W;w++)putchar(
		(h==0&&w==0) || (h==0&&w==W-1) || (h==H-1&&w==0) || (h==H-1&&w==W-1) ? '+' :
		h==0 || h==H-1 ? '-' :
		w==0 || w==W-1 ? '|' :
		h==H/2&&w==W/2 ? *S : '.'
	);
}

Measured memory_bytes: 1760
#include<iostream>
#include<algorithm>
#include<string>
#include<queue>
#include<vector>
using namespace std;
int main()
{
	int a, b;
	cin >> a >> b;
	if (b >= a)
		cout << "unsafe" << endl;
	else
		cout << "safe" << endl;
	return 0;
}

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

#define int long long int
#define ff first
#define ss second
#define pb push_back
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

const int mod = 1e9 + 7;
const int cmod = 998244353;
const int N = 1e3 + 5;
const int inf = 1e16 + 2;

void solve(int Case) {
    int n;
    cin >> n;
    int arr[n + 1] , cnt = 0;
    for(int i = 1 ; i <= n ; i ++) {
        cin >> arr[i];
        if((i & 1) and (arr[i] & 1)) cnt ++;
    }
    cout << cnt << '\n';
}
/*
 */

int32_t main()
{
    fastio
    int testcase = 1;
    //cin >> testcase;
    int Case = 1;
    while(testcase --) {
        solve(Case ++);
    }
    return 0;
}
 



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

typedef long long ll;
using namespace std;

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

	int n,m,X,Y; cin >> n >> m >> X >> Y;
	int x[105],y[105];
	for (int i = 0;i < n;i++){
		cin >> x[i];
	}
	sort(x,x+n);	
	for (int i = 0;i < m;i++){
		cin >> y[i];
	}
	sort(y,y+m);

	int a = max(X,x[n-1]);
	int b = min(Y,y[0]);	

	cout << (a<b?"No War":"War") << endl;

	return 0;

}



Measured memory_bytes: 256
// Problem : D - Alter Altar
// Contest : AtCoder - AtCoder Beginner Contest 174
// URL : https://atcoder.jp/contests/abc174/tasks/abc174_d
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#define _CRT_SECURE_NO_WARNINGS
#include <queue>
#include <cstdio>
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long ll;

int main()
{
	ios::sync_with_stdio(0);cin.tie(0);
    int n;cin >> n;
    string s;cin >> s;
    int cnt = 0;
    for(int i = 0;i < n;++i)	cnt += (s[i] == 'R');
    int res = 0;
    for(int i = 0;i < cnt;++i)
    {
    	if(s[i] == 'W')
    		++res;
    }	
    cout << res << endl;
    return 0;
}


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

int main() {
int N;
cin>>N;
int ans=1;
for(int b=2;b<32;b++){
  for(int p=2;p<10;p++){
    int tmp=pow(b,p);
    if(tmp<=N){
      ans= max(ans,tmp);
    }
  }
}
cout<<ans<<endl;
}


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

int remedial( int a )
{
    if( a < 40 )
        return 40;
    else
        return a;
}

int main()
{
    int a, b, c, d, e;

    cin >> a >> b >> c >> d >> e;
    
    cout << ( remedial(a) + remedial(b) + remedial(c) + remedial(d) + remedial(e) ) / 5  << endl; 
    
    return 0;
}


Measured memory_bytes: 3100
import std.stdio, std.algorithm, std.conv, std.array, std.string, std.math, std.typecons, std.numeric;

int[10^^5+1] L, R;

void main()
{
    auto N = readln.chomp.to!int;
    auto AS = readln.split.to!(int[]);

    auto g = AS[0];
    foreach (i, a; AS) {
        g = gcd(g, a);
        L[i] = g;
    }
    g = AS[$-1];
    foreach_reverse (i, a; AS) {
        g = gcd(g, a);
        R[i] = g;
    }

    int max_g;
    foreach (i; 0..N) {
        if (i == 0) {
            g = R[i+1];
        } else if (i == N-1) {
            g = L[i-1];
        } else {
            g = gcd(L[i-1], R[i+1]);
        }
        max_g = max(max_g, g);
    }
    writeln(max_g);
}

Measured memory_bytes: 5116
def two(n):
    if n == 1:
        return True
    elif n%2 != 0:
        return three(n)
    else:
        q = n/2
        return two(q)

def three(n):
    if n == 1:
        return True
    elif n%3 != 0:
        return five(n)
    else:
        q = n/3
        return three(q)

def five(n):
    if n == 1:
        return True
    elif n%5 != 0:
        return False
    else:
        q = n/5
        return five(q)

while True:
    input_line = raw_input()
    if input_line == '0': break
    m, n = map(int, input_line.split())
    c = 0
    for n in range(m, n+1):
        if two(n):
            c += 1
    else:
        print c

Measured memory_bytes: 35952
#include <stdio.h>
#include <stdlib.h>
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)

ll w,h;
char s[99][99];
ll d4[]={0,-1,0,1,0};
void f(char c,int a[][99]){
	int que[10000],quecnt=0;
	rep(i,0,h)rep(j,0,w){
		if(s[i][j]==c){
			a[i][j]=10;
			que[quecnt++]=i*128+j;
		}else{
			a[i][j]=0;
		}
	}
	for(int idx=0;idx<quecnt;idx++){
		int x=que[idx]/128;
		int y=que[idx]%128;
		rep(k,0,4){
			int xx=x+d4[k];
			int yy=y+d4[k+1];
			if(0<=xx&&xx<h&&0<=yy&&yy<w&&!a[xx][yy]){
				if(s[xx][yy]=='.'){
					que[quecnt++]=xx*128+yy;
					a[xx][yy]=2;
				}else{
					a[xx][yy]=1;
				}
			}
		}
	}
}

int a[99][99];
int b[99][99];

int main(){
	while(scanf("%lld%lld",&w,&h),w){
		rep(i,0,h)scanf(" %s",s[i]);
		f('B',a);
		f('W',b);
		ll x=0,y=0;
		rep(i,0,h)rep(j,0,w){
			if(a[i][j]==2&&b[i][j]!=2)x++;
			if(a[i][j]!=2&&b[i][j]==2)y++;
		}
		printf("%lld %lld\n",x,y);
	}
}


Measured memory_bytes: 2036
# -*- coding: utf-8 -*-
def calc_div(num):
    return num / 2

n = str(input())
num_list = list(map(int, input().split()))

cnt = 0
while True:
    shouldDiv = True

    for i in num_list:
        if i % 2 != 0:
            shouldDiv = False
            break

    if shouldDiv:
        num_list = list(map(calc_div, num_list))
        cnt += 1
    else:
        break

print(cnt)


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

using namespace std;
typedef long long ll;
#define int ll

template<typename T1,typename T2> inline void chmin(T1 &a, T2 b){ if(a > b) a = b; }
template<typename T1,typename T2> inline void chmax(T1 &a, T2 b){ if(a < b) a = b; }

#define REP(i,n) for(int i=0;i<n;++i)
#define SORT(name) sort(name.begin(), name.end())
#define ZERO(p) memset(p, 0, sizeof(p))
#define MINUS(p) memset(p, -1, sizeof(p))
#if 1
#  define DBG(fmt, ...) printf(fmt, ##__VA_ARGS__)
#else
#  define DBG(fmt, ...)
#endif

const ll LLINF = (1LL<<60);
const int INF = (1LL<<30);
const double DINF = std::numeric_limits<double>::infinity();
const int MOD = 1000000007;
const int MAX_N = 100010;

vector<int> GetDivisor(int n) {
    vector<int> v;
    for(int i = 1; i*i <= n; ++i) {
        if(n % i == 0) {
            v.push_back(i);
            if(i != n / i) { v.push_back(n / i); }
        }
    }
    sort(v.begin(), v.end());
    return v;
}

template< typename T >
class CumulativeSum
{
public:
    CumulativeSum() {}
    CumulativeSum(int sz) : m_Data(sz, T(0)) {};

    void Init(int sz) { m_Data.assign(sz, T(0)); }

    // k に x を加える O(1)
    void Add(int k, T x) {
        assert(static_cast<int>(m_Data.size()) >= k);
        if(static_cast<int>(m_Data.size()) <= k) { m_Data.push_back(x); }
        else { m_Data[k] = (m_Data[k] + x); }
    }

    // 累積和の構築 O(m_Data.size())
    void Build() {
        for(int i = 1; i < static_cast<int>(m_Data.size()); i++) {
            m_Data[i] = (m_Data[i] + m_Data[i - 1]);
        }
    }

    // 区間 [0, k] の和を返す O(1)
    // 閉区間なので k が含まれることに注意
    T Query(int k) {
        if(k < 0) { return T(0); }
        return (m_Data[min(k, static_cast<int>(m_Data.size()) - 1)]);
    }

    // 区間 [l, h] の和を返す O(1)
    // 閉区間なので k が含まれることに注意
    T Query(int l, int h) {
        return (this->Query(h) - this->Query(l-1));
    }
private:
    vector< T > m_Data;
};

int N, K;
vector<int> A;

// n を約数とする最小の変化量
int Check(int n) {
    // cs の作成
    vector< pair<int, int> > A_pn;
    CumulativeSum<int> cs_p(N), cs_n(N);
    REP(i, N) {
        int p_val = n - (A[i] % n);
        int n_val = A[i] % n;
        A_pn.push_back(make_pair(p_val, n_val));
    }
    SORT(A_pn);
    REP(i, N) {
        cs_p.Add(i, A_pn[i].first);
        cs_n.Add(i, A_pn[i].second);
    }
    cs_p.Build();
    cs_n.Build();

    // 累積和が等しくなる場所を探す
    REP(i, N-1) {
        if(cs_p.Query(0, i) == cs_n.Query(i + 1, N-1)) {
            return cs_p.Query(0, i);
        }
    }
    return -1;
}

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

    cin >> N >> K;
    A.resize(N);

    int a_sum = 0;
    REP(i, N) {
        cin >> A[i];
        a_sum += A[i];
    }

    auto a_div = GetDivisor(a_sum);

    int ans = 1;
    for(auto cand : a_div) {
        auto res = Check(cand);
        if(res > 0 && res <= K) {
            chmax(ans, cand);
        }
    }

    printf("%lld\n", ans);

    return 0;
}


Measured memory_bytes: 3764
n=int(input())
sosu=[2]
def bunkai(num):
    flag=True
    for i in range(2,int(num**0.5)+1):
        if num%i==0:
            flag=False
            break
    return flag
for i in range(3,n+1): #素数を見つける
    f=bunkai(i)
    if f:
        sosu.append(i)
#print(sosu)
count=[]
for i in range(len(sosu)):
    s=sosu[i]
    count_=0
    for j in range(2,n+1):
        flag2=True
        while flag2:
            if j%s==0:
                count_+=1
                j=j//s
            else:
                flag2=False
    count.append(count_)
mod=10**9+7
ans=1
for i in range(len(count)):
    ans=ans*(count[i]+1)
    ans=ans%mod
#print(count)
print(ans)


Measured memory_bytes: 39792
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
static const int INF (1<<30);

int main() {
  string S, T;
  cin >> S >> T;
  sort(all(S));
  sort(all(T));

  priority_queue<int> qs, qt;

  int cnt = 1;
  for (int i = 1; i < S.length(); i++) {
    if (S[i] == S[i-1]) {
      cnt++;
    } else {
      qs.push(cnt);
      cnt = 1;
    }
  }
  qs.push(cnt);

  cnt = 1;
  for (int i = 1; i < T.length(); i++) {
    if (T[i] == T[i-1]) {
      cnt++;
    } else {
      qt.push(cnt);
      cnt = 1;
    }
  }
  qt.push(cnt);

  if (qs.size() != qt.size()) {
    cout << "No" << endl;
    return 0;
  }

  while (!qs.empty()) {
    if (qs.top() != qt.top()) {
      cout << "No" << endl;
      return 0;
    }

    qs.pop();
    qt.pop();
  }

  cout << "Yes" << endl;

  return 0;
}

Measured memory_bytes: 776
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cctype>
using namespace std;
typedef long long i64;
inline int read(int f = 1, int x = 0, char ch = ' ')
{
    while(!isdigit(ch = getchar())) if(ch == '-') f = -1;
    while(isdigit(ch)) x = x*10+ch-'0', ch = getchar();
    return f*x;
}
const int N = 1e3+5, M = 4e1+5, L = 31;
int n, m, c[M], fix; char s[M]; i64 a[N], b[N], v;
int main()
{
    n = read(); for(int i = 1; i <= n; ++i) a[i] = read(), b[i] = read();
    c[0] = 1; for(int i = 1; i < L; ++i) c[i] = c[i-1]<<1; v = c[L-1]*2ll-1;
    for(int i = 2; i <= n; ++i) if(((a[i]+b[i])&1) != ((a[1]+b[1])&1)) return puts("-1"), 0;
    fix = (a[1]+b[1]+v)&1; for(int i = 1; i <= n; ++i) a[i] -= fix;
    printf("%d\n", L+fix);
    for(int i = 0; i < L; ++i) printf("%d ", c[i]); puts(fix?"1":"");
    for(int i = 1; i <= n; ++i)
    {   
        i64 dx = (a[i]+b[i]+v)>>1, dy = (a[i]-b[i]+v)>>1;
        for(int i = 0, x, y; i < L; ++i) 
            x = dx>>i&1, y = dy>>i&1, putchar("LDUR"[x<<1|y]);
        puts(fix?"R":"");
    }
    return 0;
} 

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
public class Hello{
    public static void Main(){
        var days = new List<string>(){
            "SUN","MON","TUE","WED","THU","FRI","SAT"
        };
        string s = Console.ReadLine();
        Console.WriteLine(7 - days.IndexOf(s));
    }
}


Measured memory_bytes: 13148
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	static class time implements Comparable<time>{
		int num;
		double numtime;
		public time(int num, double numtime) {
			this.num = num;
			this.numtime = numtime;
		}
		@Override
		public int compareTo(time o) {
			if(o.numtime-numtime < 0) return 1;
			else return 0;
		}
	}
	
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		time[][] a = new time[3][8];
		for(int i=0;i<3;i++){
			for(int j=0;j<8;j++)a[i][j]=new time(in.nextInt(),in.nextDouble());
			Arrays.sort(a[i]);
		}
		time[] t = new time[6];
		int x = 0;
		for(int i=0;i<3;i++){
			System.out.printf("%d %.2f\n", a[i][0].num, a[i][0].numtime);
			System.out.printf("%d %.2f\n", a[i][1].num, a[i][1].numtime);
			t[x++] = a[i][2];
			t[x++] = a[i][3];
		}
		Arrays.sort(t);
		System.out.printf("%d %.2f\n", t[0].num, t[0].numtime);
		System.out.printf("%d %.2f\n", t[1].num, t[1].numtime);
	}
}

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

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	cin >> n;
	map<int, int> cnt;
	rep(i,n){
		int a;
		cin >> a;
		cnt[a-1]++;
		cnt[a]++;
		cnt[a+1]++;
	}
	int ans = 0;
	for(auto p : cnt){
		chmax(ans, p.second);
	}
	cout << ans << endl;
	return 0;
}


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

int main()
{
  int N, M;
  cin >> N >> M;
  vector<int> A(M);
  long long total = 0;
  rep(i, M)
  {
    cin >> A.at(i);
    total += A.at(i);
  }
  if(N>=total)
    cout << N - total << endl;
  else
    cout << "-1" << endl;

  return 0;
  }


Measured memory_bytes: 3644
#include<stdio.h>

int main(){
	double a,b,c,d,e,f;
	double ans,ans2;

	while(scanf("%lf%lf%lf%lf%lf%lf",&a,&b,&c,&d,&e,&f)!=EOF){

			ans2=(c*d-a*f)/(b*d-a*e);
			ans=(c-b*ans2)/(a);

		printf("%.3f %.3f\n",ans,ans2);
	}
	return 0;
}

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

int main(){
  int n;
  cin >> n;
  string s;
  cin >> s;
  int maxx = 0;
  int x = 0;
  rep(i,n){
    if(s.at(i) == 'I'){
      x++;
    }else{
      x--;
    }
    maxx = max(x,maxx);
  }
  cout << maxx << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
    string s; cin >> s;
    if (s[0] == s[1] || s[1] == s[2] || s[2] == s[3]) {
        cout << "Bad" << endl;
    } else cout << "Good" << endl;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

#define max(a,b) ( (a) > (b) ? (a) : (b) )

int n,sum[3][101],temp,ans;

int main(void){
	register int i,j;
	scanf("%d",&n);
	for(i=1;i<=2;i++)
		for(j=1;j<=n;j++)
			scanf("%d",&temp),
			sum[i][j]=sum[i][j-1]+temp;
	for(i=1;i<=n;i++)
		ans=max(ans,sum[2][n]+sum[1][i]-sum[2][i-1]);
	printf("%d\n",ans);
	return 0;
}

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

public class Main {
	public static void main(String args[]) throws NumberFormatException, IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line = br.readLine();
		String text[] = line.split(" ");
		
		//表したい数と、使えない数の数
		String N;
		int K;
		N = text[0];
		K = Integer.parseInt(text[1]);
		
		line = br.readLine();
		text = line.split(" ");
		//使える数字の配列
		ArrayList <Integer> D = new ArrayList<Integer>();
		for(int i = 0; i< 10; i++){
			D.add(i);
		}
		
		for(int i =0 ; i < K; i++){
			D.remove(D.indexOf(Integer.parseInt(text[i])));
		}
		for(int i = 0; i < D.size(); i++){
//			System.out.println(D.get(i));
		}
		
		//可能性のある数字の最大値(0除く)
		int max;
		if(D.get(0) == 0){
			max = D.get(1) * 11111;
		}else{
			max = D.get(0) * 11111;
		}
//		System.out.println("max : " + max);
		//答え
		int ans = 0;
		int num;
		String si;
		String st;
		//判定
		loop:for(int i = Integer.parseInt(N); i < max + 1; i++){
			si = String.valueOf(i);
//			System.out.println(si);
			for(int k = 0; k < si.length(); k++){
				st = si.substring(k,k + 1);	
				num  = Integer.parseInt(st);
				if(!D.contains(num)){
					continue loop;
				}
			}
			ans = i;
			break;
		}
		System.out.println(ans);
	}
}


Measured memory_bytes: 17364
/*
--------------              |   /
      |                     |  /
      |                     | /
      |             *       |/          |    |         ------            *
      |                     |           |    |        /      \
      |             |       |\          |    |       |       |\          |
   \  |             |       | \         |    |       |       | \         |
    \ |             |       |  \        |    |        \     /   \        |
     V              |       |   \        \__/|         -----     \       |
*/
#include <bits/stdc++.h>
using namespace std;

#define EmiliaMyWife ios::sync_with_stdio(0); cin.tie(NULL);
#define mem(i,j) memset(i,j,sizeof (i));
#define F first
#define S second
#define lowbit(x) ((x)&(-(x)))
#define siz(v) (long long)(v).size()
typedef int64_t ll;
typedef uint64_t ull;
const double EPS  = 1e-8;
const int INF     = 0x3F3F3F3F;
const ll LINF     = 4611686018427387903;
const int MOD     = 1e9+7;
/*-----------------------------------------------------------------------------------------------------*/

int dp[101][101];

signed main() {
	EmiliaMyWife

	memset(dp, 0x3F, sizeof dp);
	int n, m;
	vector<pair<pair<int,int>, int>> edge;
	cin >> n >> m;
	for(int i = 0, a, b, c; i < m; i++) {
		cin >> a >> b >> c;
		edge.push_back({{a, b}, c});
		dp[a][b] = dp[b][a] = c;
	}
	for(int i = 1; i <= 100; i++)
		dp[i][i] = 0;
	for(int k = 1; k <= 100; k++)
		for(int i = 1; i <= 100; i++)
			for(int j = 1; j <= 100; j++)
				dp[i][j] = min(dp[i][j], dp[i][k] + dp[k][j]);
	int ans = 0;
	for(auto &x : edge) {
		if(dp[x.first.first][x.first.second] != x.second)
			ans++;
	}
	cout << ans;

	return 0;
}


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

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            ABC100_B();
        }

        static void ABC100_B()
        {
            var DN = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            var D = DN[0];
            var N = DN[1] == 100 ? DN[1]+1 : DN[1];
            Console.WriteLine(Math.Pow(100, D) * N);
        }
    }
}

Measured memory_bytes: 13396
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
const ll mod=1000000007;
const int MAX_N = 1000;         // n の最大値
 
int main() {
ll n;
cin>>n;
ll f=0;
ll counter=0;
ll a[n+1]={};
ll dp[10000100]={};
for(ll i=1; i<=n; i++){
a[i]++;}
for(ll i=2; i<=n; i++){
ll f =i;
ll j =i;
while(f<=n){
a[f]++;
//if(f==6) cout << i << endl;
f+=j;}}
for(ll i=1; i<=n; i++){
counter+=a[i]*i;}
//for(ll i=1; i<=n; i++){
//cout << a[i] << endl;}
cout << counter << endl;}


Measured memory_bytes: 81752
#include<bits/stdc++.h>
//#pragma GCC optimize("Ofast")
//#pragma GCC target("avx,avx2,fma")

using namespace std;

typedef long long ll;

//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
//typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>pb_ds;

#define IN freopen("in.txt","r",stdin)
#define OUT freopen("out.txt","w",stdout)
#define pi pair<int,int>
#define F first
#define S second
#define pb push_back
#define pp pop_back
#define eps 10E-10
#define mod 998244353
#define pai acos(-1)
#define N 200005

int ar[N],br[N];

int main ()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int n,k;cin>>n>>k;
    for(int i=1;i<=n;i++) cin>>ar[i];

    for(int i=1;i<=k;i++){
      for(int j=1;j<=n;j++){
         int l=max(1,j-ar[j]),r=min(n,j+ar[j]);
         br[l]++,br[r+1]--;
      }
      bool change=0;
      for(int j=1;j<=n;j++){
         br[j]+=br[j-1];
         if(br[j]!=ar[j]) change=1;
         ar[j]=br[j];
      }
      if(!change) break;
      memset(br,0,sizeof br);
    }

    for(int i=1;i<=n;i++) cout<<ar[i]<<" ";
    return 0;
}




Measured memory_bytes: 5216
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
typedef long long ll;
const int Max = 1e5 + 7;
string lst[Max];

int main()
{
	int n, m;
	cin >> n >> m;
	for (int i = 1; i <= n; i++)
	{
		cin >> lst[i];
	}
	for (int i = 1; i <= m + 2; i++)printf("#");
	cout << endl;
	for (int i = 1; i <= n; i++)
	{
		cout << "#" << lst[i] << "#" << endl;
	}
	for (int i = 1; i <= m + 2; i++)printf("#");
}

Measured memory_bytes: 5388
#include <cstdio>
#include <algorithm>
#include <vector>
#include <map>

struct Bingo {
  std::map<int, std::pair<int, int>> card;
  std::vector<int> row, col, diag;
  int num_bingo, size;

  Bingo(int n):
    row(n), col(n), diag(2), num_bingo(0), size(n)
  {}

  void set(int r, int c, int x) {
    card[x] = std::make_pair(r, c);
  }

  int push(int x) {
    auto it=card.find(x);
    if (it == card.end())
      return num_bingo;

    const std::pair<int, int> &p=it->second;

    if (++row[p.first] == size)
      ++num_bingo;

    if (++col[p.second] == size)
      ++num_bingo;

    if (p.first == p.second)
      if (++diag[0] == size)
        ++num_bingo;

    if (p.first + p.second + 1 == size)
      if (++diag[1] == size)
        ++num_bingo;

    if (num_bingo && size == 1)
      return (num_bingo = 1);

    return num_bingo;
  }
};

int main() {
  int n, u, v, m;
  scanf("%d %d %d %d", &n, &u, &v, &m);

  Bingo usagi(n), neko(n);
  for (int r=0; r<n; ++r)
    for (int c=0; c<n; ++c) {
      int k;
      scanf("%d", &k);
      usagi.set(r, c, k);
    }

  for (int r=0; r<n; ++r)
    for (int c=0; c<n; ++c) {
      int k;
      scanf("%d", &k);
      neko.set(r, c, k);
    }

  for (int i=0; i<m; ++i) {
    int k;
    scanf("%d", &k);

    int usagi_line=usagi.push(k);
    int neko_line=neko.push(k);

    bool usagi_bingo=(usagi_line>=u);
    bool neko_bingo=(neko_line>=v);

    if (usagi_bingo && neko_bingo) {
      return !printf("DRAW\n");
    } else if (usagi_bingo) {
      return !printf("USAGI\n");
    } else if (neko_bingo) {
      return !printf("NEKO\n");
    }
  }

  printf("DRAW\n");
  return 0;
}  

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

#define ONLINE_JUDGE
#define pb(a) push_back(a)
#define all(a) (a.begin(), a.end())

using ll = long long;

const int E5 = 1e5;

//////////// Solution /////////////////////////////////

void solve() {
	int D,G,p[10],c[10];
	cin >> D >> G;
	int ans = 1e9;

	for (int i = 0; i < D; ++i) {
		cin >> p[i] >> c[i];
	}

	for (int mask = 0; mask < (1<<D); ++mask) {
		int cur = 0;
		int cnt = 0;
		int mx = -1;
		for (int i = 0; i < D; ++i) {
			if (mask & (1<<i)) {
				cur += p[i] * (i+1) * 100 + c[i];
				cnt += p[i];
			} else {
				mx = i;
			}
		}
		int j = 0;
		if (cur >= G) {
			ans = min(ans,cnt);
		} else {
			while (mx != -1 && j < p[mx] && cur < G) {
				cur += 100 * (mx+1);
				++cnt;
				++j;
			}
			if (cur >= G) {
				ans = min(ans,cnt);
			}
		}
	}

	cout << ans << '\n';
}	

/////////// End Solution ///////////////////////////////////////

//////// Initialization ////////////////////////////////////

int main() {

	#ifndef ONLINE_JUDGE
	FILE *FIN = freopen("/home/danil/prog/input.txt", "r", stdin);
	clock_t time_start = clock();
	#endif

	ios::sync_with_stdio(false);
	cin.tie(NULL);

	solve();

	#ifndef ONLINE_JUDGE
	fclose(FIN);
	cerr << "\x1b[031m\n-----------------\nTime=" << (ll)((double)(clock()-time_start) / CLOCKS_PER_SEC * 1000) << "ms\n\x1b[0m";
	#endif

	return 0;
}

	//////// End Initialization ///////////////////////////////////////

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define endl '\n'
#define FOR(i, a, n) for (int i = (a); i < (n); ++i)
#define REP(i, n) FOR(i, 0, n)
using namespace std;

template <typename T> map<T, int> coordinate_compression(vector<T> x) {
    int n = x.size();
    vector<int> y(n);
    iota(y.begin(), y.end(), 0);
    sort(y.begin(), y.end(), [&](int i, int j) { return x[i] < x[j]; });
    map<T, int> res;
    for (int i : y) if (!res.count(x[i])) {
        int j = res.size();
        res[x[i]] = j;
    }
    return res;
}

// Dual Segment Tree
template <class OM = int> struct DST {
    int n, lev;
    vector<OM> lz;
    virtual OM h(OM, OM) = 0;
    const OM e0;

    DST(int n_, const OM& e0) : e0(e0) {
        for (n = 1, lev = 0; n < n_; n <<= 1, ++lev);
        lz.assign(n << 1, e0);
    }

    inline void push(int k) {
        for (int i = lev; i > 0; --i) {
            int j = k >> i;
            if (lz[j] == e0) continue;
            lz[(j << 1) | 0] = h(lz[(j << 1) | 0], lz[j]);
            lz[(j << 1) | 1] = h(lz[(j << 1) | 1], lz[j]);
            lz[j] = e0;
        }
    }

    // [l, r)
    // l, r: 0-indexed
    void update(int l, int r, const OM& x) {
        push(l += n);
        push(r += n - 1);
        for (++r; l < r; l >>= 1, r >>= 1) {
            if (l & 1) lz[l] = h(lz[l], x), l++;
            if (r & 1) --r, lz[r] = h(lz[r], x);
        }
    }

    // k: 0-indexed
    OM query(int k) {
        push(k += n);
        return lz[k];
    }

    void dump(int);
};

// Range Update Query (RUQ)
template <class OM> struct RUQ : DST<OM> {
    RUQ(int n, OM e0 = numeric_limits<OM>::max()) : DST<OM>(n, e0) {}
    OM h(OM a, OM b) override { return b; }
};

// Range Add Query (RAQ)
template <class OM> struct RAQ : DST<OM> {
    RAQ(int n, OM e0 = 0) : DST<OM>(n, e0) {}
    OM h(OM a, OM b) override { return a + b; }
};

// print for debug
template <class M> void DST<M>::dump(int time) {
    if (~time) cerr << "time = " << time << endl;
    for (int i = 1; i <= (1LL << lev); i <<= 1) {
        for (int j = 0; j < i; ++j) {
            cerr << "  " << lz[j + i];
        }
        cerr << endl;
    }
    cerr << endl;
}

int N, Q;
int S[200010], T[200010], X[200010], D[200010];

void _main() {
    cin >> N >> Q;
    vector<int> v;
    REP (i, N) {
        cin >> S[i] >> T[i] >> X[i];
        v.push_back(max(0LL, S[i] - X[i]));
        v.push_back(max(0LL, T[i] - X[i]));
    }
    REP (i, Q) {
        cin >> D[i];
        v.push_back(D[i]);
    }
    vector<int> ord(N);
    iota(ord.begin(), ord.end(), 0);
    sort(ord.begin(), ord.end(), [&](int i, int j) {
        return X[i] > X[j];
    });
    RUQ<int> ruq(Q, -1);
    REP (i, N) {
        int j = ord[i];
        int posL = lower_bound(D, D + Q, S[j] - X[j]) - D;
        int posR = lower_bound(D, D + Q, T[j] - X[j]) - D;
        ruq.update(posL, posR, j);
    }
    REP (i, Q) {
        int j = ruq.query(i);
        if (j == -1) cout << -1 << endl;
        else cout << X[j] << endl;
    }
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(10);
    _main();
    return 0;
}

Measured memory_bytes: 19560
#include<stdio.h>
#define INF 2000000
#define WHITE 1
#define BLACK 2

void dijkstra();
int kill,baby,i,j,yasuna,sonya,me[101][101]
  ,color[101],d[101],pi[101],n;
int main(){
  scanf("%d",&kill);
  for(i=0;i<kill;i++){
    for(j=0;j<kill;j++)me[i][j]=-1;
    color[i]=WHITE;
    d[i]=INF;
  }
  for(i=0;i<kill;i++){
    scanf("%d%d",&yasuna,&sonya);
    for(j=0;j<sonya;j++){
      scanf("%d",&baby);
      scanf("%d",&n);
      me[yasuna][baby]=n;
    }
  }
  dijkstra();
  for(i=0;i<kill;i++)printf("%d %d\n",i,d[i]);
  return 0;
}
void dijkstra(){
  int mincost,u,i,j;
  d[0]=0;
  while(1){
    mincost=INF;
    for(i=0;i<kill;i++){
      if(color[i]!=BLACK&&d[i]<mincost){
	mincost=d[i];
	u=i;
      }
    }
    if(mincost==INF)break;

    color[u]=BLACK;
    for(i=0;i<kill;i++){
      if(color[i]!=BLACK && d[u]+me[u][i]<d[i]&&me[u][i]!=-1){
	pi[i]=u;
	d[i]=d[u]+me[u][i];
      }
    }
  }
}



Measured memory_bytes: 2052
import java.io.InputStream;
import java.io.PrintStream;
import java.util.Scanner;

public class Main {
    static final int MAX = 100100100;
    InputStream in = System.in;
    PrintStream out = System.out;

    public void _main(String[] args) {
        Scanner sc = new Scanner(in);
        int N = sc.nextInt();
        int L = sc.nextInt();

        int sum=0;
        for(int i=1;i<=N;i++) sum+=L+i-1;
        int diff = MAX;
        int c=0;
        for(int i=1;i<=N;i++) {
            if (Math.abs((L+i-1))<diff) {
                c=sum-(L+i-1);
                diff = Math.abs((L+i-1));
            }
        }
        out.println(c);
    }

    public static void main(String[] args) {
        new Main()._main(args);
    }
}


Measured memory_bytes: 21972
#include <algorithm>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
 
using namespace std;
 
typedef long long ll;
 
#define sz size()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(c) (c).begin(), (c).end()
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define per(i,a,b) for(ll i=b-1LL;i>=(a);--i)
#define clr(a, b) memset((a), (b) ,sizeof(a))
#define ctos(c) string(1,c)
#define print(x) cout<<#x<<" = "<<x<<endl;
 
#define MOD 1000000007

int main(){
  ll n;
  cin>>n;
  if(n%2==1){
    cout << n/2+1 << endl;
  }
  else{
    cout << n/2 << endl;
  }
  return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Security.Cryptography.X509Certificates;
using System.Text;
using static System.Console;

namespace ABC126C
{
    static class Program
    {
        static void Main(string[] args)
        {
            var n = ReadLine().SplitTryParseToList<int>();

            double a = 0.0;
            for (int j = 1; j <= n[0]; j++)
            {
                int c = j;
                double d = 1.0 / n[0];
                while (c < n[1])
                {
                    c *= 2;
                    d /= 2.0;
                }

                a += d;

            }
            WriteLine(a);
        }

        public static T TryParse<T>(this String input)
        {
            try
            {
                var converter = TypeDescriptor.GetConverter(typeof(T));
                if (converter != null)
                {
                    return (T)converter.ConvertFromString(input);
                }
                else
                {
                    throw new InvalidCastException("");
                }
            }
            catch
            {
                throw new InvalidCastException(typeof(T) + " is not supported.");
            }
        }

        public static List<T> SplitTryParseToList<T>(this String input)
        {
            return input.Split().Select(n => n.TryParse<T>()).ToList();
        }

        public static List<T> ListSwap<T>(this List<T> list, Int32 index1, Int32 index2)
        {
            var t = list[index1];
            list[index1] = list[index2];
            list[index2] = t;
            return list;
        }

        public static List<Tuple<T, int>> DuplicateCount<T>(this IEnumerable<T> list)
        {
            return list
                .GroupBy(i => i)
                .Where(g => g.Any())
                .Select(g => Tuple.Create(g.Key, g.Count()))
                .ToList();
        }
        public static List<Tuple<T, int>> DuplicateSort<T>(this IEnumerable<Tuple<T, int>> list)
        {
            return list.OrderByDescending((x) => x.Item2).ToList();
        }
        public static List<T> ReadLineOne<T>(int n)
        {
            var list = new List<T>();
            foreach (var i in Enumerable.Range(1, n))
            {
                list.Add(Console.ReadLine().TryParse<T>());
            }
            return list;
        }
        public static void PrintAll<T>(this IEnumerable<T> list)
        {
            foreach (var i in list)
            {
                Console.Write($"{i} ");
            }

            Console.WriteLine();
        }
    }
}


Measured memory_bytes: 15828
D = int(input())

cs = [int(i) for i in input().split()]

last = {n: 0 for n in range(1, 27)}
ans = []
change = 2
for day in range(1, D-change):
    ss = [int(i) for i in input().split()]
    max_score = 0
    max_i = 1
    for i, s in enumerate(ss, 1):
        human = day-last[i]
        s_human = s + cs[i-1] * (human*6)
        if s_human > max_score:
            max_score = s_human
            max_i = i
    ans.append(max_i)
    last[max_i] = day
for day in range(D-change, D+1):
    ss = [int(i) for i in input().split()]
    m = 0
    mi = 1
    for i, s in enumerate(ss,1):
        if s > m:
            m = s
            mi = i
    ans.append(mi)
for a in ans:
    print(a)

Measured memory_bytes: 9288
#include <bits/stdc++.h>
#include <math.h>
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rrep(i, n) for(int i = (n-1); i >= 0; i--)
using namespace std;
typedef long long ll;
const int MOD = 1000000007;
const ll INF = 1LL<<60;
const int IINF = 1000000000;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main(){

	ios::sync_with_stdio(false);
	cin.tie(nullptr);

	int N; cin >> N;

	ll ans = 0;
	for(int i = 1; i <= N; i++){
		int count = (N-1) / i;
		ans += count;
	}
	cout << ans << endl;
}

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

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, m, c;
  cin >> n >> m >> c;
  vector<vector<int> > a(n, vector<int>(m));
  vector<int> b(m);
  for (int i = 0; i < m; i++) {
    cin >> b[i];
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      cin >> a[i][j];
    }
  }
  int ans = 0;
  for (int i = 0; i < n; i++) {
    int cur = c;
    for (int j = 0; j < m; j++) {
      cur += a[i][j] * b[j];
    }
    if (cur > 0) {
      ans++;
    }
  }
  cout << ans << '\n';
  return 0;
}

Measured memory_bytes: 256
// atcoder/abc056/A/main.cpp
// author: @___Johniel
// github: https://github.com/johniel/

#include <bits/stdc++.h>

#define each(i, c) for (auto& i : c)
#define unless(cond) if (!(cond))

using namespace std;

typedef long long int lli;
typedef unsigned long long ull;
typedef complex<double> point;

template<typename P, typename Q> ostream& operator << (ostream& os, pair<P, Q> p) { os << "(" << p.first << "," << p.second << ")"; return os; }
template<typename P, typename Q> istream& operator >> (istream& is, pair<P, Q>& p) { is >> p.first >> p.second; return is; }
template<typename T> ostream& operator << (ostream& os, vector<T> v) { os << "("; each (i, v) os << i << ","; os << ")"; return os; }
template<typename T> istream& operator >> (istream& is, vector<T>& v) { each (i, v) is >> i; return is; }

template<typename T> inline T setmax(T& a, T b) { return a = std::max(a, b); }
template<typename T> inline T setmin(T& a, T b) { return a = std::min(a, b); }

int main(int argc, char *argv[])
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);

  char a, b;
  while (cin >> a >> b) {
    cout << (a == b ? 'H' : 'D') << endl;
  }

  return 0;
}


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

int main()
{
  int n;
  cin>>n;
  int a1[n], a2[n];
  for(int i=0; i<n; i++){
      cin>>a1[i]>>a2[i];
  }
  int count=0;
  for(int i=0;i<n;i++){
      if(count>=3)break;
      if(a1[i]==a2[i]){
          count++;
      }else{
          count=0;
      }
  }
  count>=3?cout<<"Yes":cout<<"No"<<endl;
  return 0;
}

Measured memory_bytes: 3612
list_a = list(str(input()))
list_b = list(str(input()))
list_c = list(str(input()))

def list2phase(list_hoge):
    if list_hoge[0] == "a":
        phase = 1
        del list_hoge[0]
    elif list_hoge[0] == "b":
        phase = 2
        del list_hoge[0]
    else:
        phase = 3
        del list_hoge[0]
    return (phase,list_hoge)

phase = 1
list_some = list_a
while True:
    if phase == 1:
        if len(list_a) == 0:
            print("A")
            break
        (phase, list_a) = list2phase(list_a)
        continue
    elif phase == 2:
        if len(list_b) == 0:
            print("B")
            break
        (phase, list_b) = list2phase(list_b)
        continue
    else:
        if len(list_c) == 0:
            print("C")
            break
        (phase, list_c) = list2phase(list_c)
        continue
    break


Measured memory_bytes: 3064
N= int(input())

a=0
b = 0
k = 0
ans = 0
for i in range(N):
  s = input()
  ans += s.count('AB')
  if s[len(s)-1] == 'A': a+=1
  if s[0] == 'B': b+=1
  if s[len(s)-1] == 'A' and s[0] == 'B': k+=1

if(b==0 or a==0): print(ans) 
elif(k>0 and k==a and b==k): print(ans+k-1)
else: print(ans + min(a,b,N-1))

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

int main()
{
  char op;
  int a, b;
  cin >> a >> op >> b;
  if (op == '+')
  {
    cout << a + b << endl;
  }
  else
  {
    cout << a - b << endl;
  }
}

Measured memory_bytes: 256
/**
  @date Time-stamp: <2019-05-19 11:17:30 tagashira>
  @file a.cpp
  @title A - Double Helix
  @brief https://atcoder.jp/contests/abc122/tasks/abc122_a
**/

#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main(int argc, char* argv[]) {
  int H, W, h, w;
  cin >> H >> W;
  cin >> h >> w;

  cout << (H-h)*(W-w) << "\n";

  return 0;
}


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

using namespace std;

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

#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define all(a) a.begin(), a.end()
#define sz(a) (ll)(a.size())
#define endl "\n"

ll gcd(ll a, ll b)
{
    if(b==0)
    {
        return a;
    }

    return gcd(b, a%b);
}

const ll L = 1e5+5;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    
    ll N;
    cin >> N;

    vector <ll> h;

    for(ll i=0; i<N; i++)
    {
        ll t;
        cin >> t;

        h.pb(t);
    }

    h[0]--;

    for(ll i=1; i<N; i++)
    {
        if(h[i] < h[i-1])
        {
            cout << "No" << endl;
            return 0;
        }

        if(h[i]-1 >= h[i-1])
        {
            h[i]--;
        }
    }

    cout << "Yes" << endl;

    return 0;
}

Measured memory_bytes: 1400
#include<bits/stdc++.h>
using namespace std;
const int maxn=3e5+10;
int m,d;

int main(){
    int ans=0;
    scanf("%d%d",&m,&d);
    for(int i=2;i<=9;i++){
        for(int j=2;j<=9;j++){
            if(i*j<=m&&i*10+j<=d)ans++;
        }
    }
    printf("%d\n",ans);
}
/*
    Good Luck
        -Lucina
*/


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int a[100010];

int main(int argc, char const *argv[])
{
	int n, L;
	scanf("%d %d", &n, &L);
	deque <int> Q;
	long long sum = 0;
	for(int i = 1; i <= n; i++) {
		scanf("%d", &a[i]);
	}
	for(int i = 1; i < n; i++) {
		if(a[i] + a[i + 1] >= L) {
			printf("Possible\n");
			for(int x = 1; x < i; x++) {
				printf("%d ", x);
			}
			for(int x = n-1; x > i; x--) {
				printf("%d ", x);
			}
			printf("%d\n", i);
			exit(0);
		}
	}
	printf("Impossible\n");
	return 0;
}

Measured memory_bytes: 1152
#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
	int arr[10];
	for (int i = 0;i < 10;i++) cin >> arr[i];
	sort(arr, arr + 10);
	cout << arr[9] << endl << arr[8] << endl << arr[7] << endl;
	return 0;
}

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

typedef long long lint;
typedef long double louble;

template<typename T1,typename T2> inline T1 max(T1 a,T2 b){return a<b?b:a;}
template<typename T1,typename T2> inline T1 min(T1 a,T2 b){return a<b?a:b;}

namespace ae86
{
	const int bufl = 1<<15;
	
	char buf[bufl],*s=buf,*t=buf;
	
	inline int fetch()
	{
		if(s==t){t=(s=buf)+fread(buf,1,bufl,stdin);if(s==t)return EOF;}
		return *s++;
	}
	
	inline int ty()
	{
		int a=0,b=1,c=fetch();
		while(!isdigit(c))b^=c=='-',c=fetch();
		while(isdigit(c))a=a*10+c-48,c=fetch();
		return b?a:-a;
	}
}
using ae86::ty;

const int _ = 503;

int n,m;

inline int fuck(int x,int y)
{
	int val=(x&1)*n+(x+n-y)%n+1;
	if(val>m)val-=n;
	return val;
}

int main()
{
	m=ty(),n=(m+1)>>1,n+=n&1;
	if(m==1){puts("1\n1");return 0;}
	printf("%d\n",n);
	for(int i=1;i<=n;i++)
		for(int j=1;j<=n;j++)
			printf("%d%c",fuck(i,j)," \n"[j==n]);
	return 0;
}


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

typedef long long ll;

int main(){
    string s;
    cin>>s;
    if(s=="abc"||s=="acb"||s=="bac"||s=="bca"||s=="cab"||s=="cba"){
        printf("Yes\n");
    }else{
        printf("No\n");
    }
    return 0;
}

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

using namespace std;
#define ll long long
#define FOR(i, a, b) for (ll i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define PRINT(item) cout << (item) << endl;
#define PRINT_VEC(V) \
    for (auto v : (V)) cout << v << ' ';
const int MOD = 1000000007;
/* cout << fixed << setprecision(10) << decimal << endl; */

int main() {
    /* code */
    ll N;
    cin >> N;
    vector<ll> A(N);
    REP(i, N) { cin >> A[i]; }
    ll minItem = A[0];
    int res = 1;
    FOR(i, 1, N) {
        minItem = min(minItem, A[i - 1]);
        if (minItem >= A[i]) {
            ++res;
        }
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
typedef long long ll;
using namespace std;
const ll mod=1000000007, INF=(1LL<<60);
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;

int main() {
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    int a, b;
    cin >> a >> b;
    if(a %3 == 0|| b % 3== 0 || (a + b) %3 ==0){
    	cout << "Possible" << endl;
    }else{
    	cout << "Impossible" << endl;
    }
    return 0;
}


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

long long int X;

int main(){
    cin >> X;
    int sum = 0;
    
    if(X >= 400 && X <= 599) sum = 8;
        if(X >= 600 && X <= 799) sum = 7;
            if(X >= 800 && X <= 999) sum = 6;
                if(X >= 1000 && X <= 1199) sum = 5;
                    if(X >= 1200 && X <= 1399) sum = 4;
                        if(X >= 1400 && X <= 1599) sum = 3;
                            if(X >= 1600 && X <= 1799) sum = 2;
                                if(X >= 1800 && X <= 1999) sum = 1;

    cout << sum << endl;
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define dunk(a) cout << (a) << endl
using namespace std;
typedef long long ll;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	char c; cin >> c;
	cout << char(c + 1) << endl;
	return 0;
}

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

using namespace std;
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)

typedef long long ll;
typedef pair<ll, ll> P;
const ll INF = 1LL<<60;

ll gcd(ll a, ll b) {
  if(b == 0) return a;
  return gcd(b, a % b);
}

template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

ll modpow(ll a, ll n, ll mod) {
  ll res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return res;
}

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

  int n;
  cin >> n;

  vector<ll> a(n+1);

  rep(i, n+1) cin >> a[i];

  vector<ll> max_node(n+1);
  max_node[0] = 1;

  ll A = 1e5;
  ll B = 1e8;
  ll max_val = A*B+10;
  rep(i, n){
    if(max_node[i] < a[i]){
      cout << -1 << endl;
      return 0;
    }
    max_node[i+1] = min(2 * (max_node[i] - a[i]), max_val);
  }

  if(max_node[n] < a[n]){
    cout << -1 << endl;
    return 0;
  }

  ll ans = 0;
  ll now = 0;
  for(int i = n; i >= 0; i--){
    now = min(now + a[i], max_node[i]);
    ans += now;
  }

  cout << ans << endl;

  return 0;
}


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

int main()
{
    int i, j, n, s[10010], q, t[510], sum = 0;
    cin >> n;
    for (i = 0; i < n; ++i)
    {
        cin >> s[i];
    }
    cin >> q;
    for (j = 0; j < q; ++j)
    {
        cin >> t[j];
        s[n] = t[j];
        i = 0;
        while(s[i] != t[j])
            ++i;
        if (i != n)
            sum++;
    }
    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 3116
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;
import java.util.stream.IntStream;

public class Main {

	public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			int n = scanner.nextInt();
			int[] a = new int[n];
			Map<Integer, Integer> map = new HashMap<>();
			IntStream.range(0, n).forEach(i -> {
				a[i] = scanner.nextInt();
				map.put(a[i], map.getOrDefault(a[i], 0) + 1);
			});
			int sum = map.entrySet().stream().mapToInt(entry -> entry.getValue() - 1).sum();
			System.out.println(n - sum - (sum & 1));
		}
	}
}


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

using namespace std;

using ll = long long;
const ll MOD = 1e9 + 7;
const ll INF = 1e18;

int main() {
    ll n, m, i, j, k;
    cin >> n;
    map<pair<ll,ll>,ll> mp;
    for(i=1;i<=n;i++){
        ll fr = i;
        while(fr/10!=0)fr/=10;
        mp[{fr,i%10}]++;
    }
    ll ret = 0;
    for(const auto x:mp){
        pair<ll,ll> p = x.first;
        ret += x.second * mp[{x.first.second,x.first.first}];
    }
    cout << ret << endl;
    return 0;
}

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

using namespace std;
#define MAX 300010
#define MOD 998244353

#define lli unsigned long long int
#define REP(i,n) for(int i=0;i<n;i++)
#define VIN(VECTOR,n)\
REP(CNT,n){\
	lli TMP;\
	cin>>TMP;\
	VECTOR.push_back(TMP);\
}

lli kaijo[MAX];
lli finv[MAX];
lli inv[MAX];

void calcKaijo(){

	REP(i,MAX){
		if(i==0 || i==1){
			kaijo[i]=1;
			finv[i]=1;
			inv[i]=1;
		}

		else {
			kaijo[i] = kaijo[i-1]*i;
			kaijo[i] %= MOD;
			inv[i] = MOD - inv[MOD%i]*(MOD/i)%MOD;
			finv[i] = finv[i-1]*inv[i] % MOD;
		}
	}
}

lli nCr(lli n,lli r){
	if(n<r)return 0;
	if(n<0 || r<0)return 0;
	return kaijo[n]*(finv[r]*finv[n-r]%MOD)%MOD;
}

int main(){

	lli n;
	vector<lli> a;
	cin>>n;
	lli  ans=0;
	REP(i,n){
		lli tmp;
		cin>>tmp;
		while(tmp>1){
			if(tmp%2!=0)break;
			tmp/=2;
			ans++;
		}
	}

	cout<<ans<<endl;
}



Measured memory_bytes: 256
S = list(input())

countA = 0
countB = 0
for i in range(len(S)):
  if S[i] == "A":
    countA = countA + 1
  elif S[i] == "B":
    countB = countB + 1

if countA == 3 or countB == 3:
  print('No')
else:
  print('Yes')

Measured memory_bytes: 3060
n=int(input())
a=[int(input())*(-1) for _ in range(n)]
inf=10**10
l=[inf]*n
import bisect
for i in range(n):
	r=bisect.bisect_right(l,a[i])
	l[r]=a[i]
cnt=0
for i in range(n):
	if l[i]!=inf:
		cnt+=1
	else:
		break
print(cnt)

Measured memory_bytes: 7836