akhauriyash/Code-Regression huggingface dataset:
N=int(input())
honest=[0 for i in range(N)]
liar=[0 for i in range(N)]
for i in range(N):
  a=int(input())
  for j in range(a):
    x,y=map(int,input().split())
    if y==0:
      liar[i]|=(1<<(x-1))
    else:
      honest[i]|=(1<<(x-1))

ans=0
for i in range(2**N):
  # 1ループ＝正直者・不親切者の1パターン＝iをビット化したもの
  ok=True
  for j in range(N):
    # j番目が正直者であるパターン
    if (i>>j)&1:
      hon=honest[j]
      pat=i
      while hon>0:
        if hon&1==1 and pat&1==0:
          ok=False
          break
        hon>>=1
        pat>>=1
      li=liar[j]
      pat=i
      while li>0:
        if li&1==1 and pat&1==1:
          ok=False
          break
        li>>=1
        pat>>=1
      if not ok:
        break
  if ok:
    val=i
    cnt=0
    while val>0:
      if val&1==1:
        cnt+=1
      val>>=1
    ans=max(ans,cnt)
        
print(ans)

Measured memory_bytes: 3064
W, a, b = map(int, input().split())
if b > a:
    if b - (a+W) < 0:
        print(0)
    else:
        print(b - (a + W))
else:
    if a - (b+W) < 0:
        print(0)
    else:
        print(a-(b+W))

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

public class Main {
    FastScanner in;
    PrintWriter out;

    void solve() {
        int ami = in.nextInt();
        int legs = in.nextInt();
        for (int x = 0; x <= ami; x++) {
            if (x * 2 + (ami - x) * 4 == legs) {
                out.println("Yes");
                return;
            }
        }
        out.println("No");
    }


    final int mod = 988244353;

    int mul(int x, int y) {
        return (int) ((x * 1L * y) % mod);
    }

    int add(int x, int y) {
        x += y;
        return x >= mod ? (x - mod) : x;
    }

    void run() {
        try {
            in = new FastScanner(new File("Main.in"));
            out = new PrintWriter(new File("Main.out"));

            solve();

            out.close();
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        }
    }

    void runIO() {

        in = new FastScanner(System.in);
        out = new PrintWriter(System.out);

        solve();
        out.close();
    }

    class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        public FastScanner(File f) {
            try {
                br = new BufferedReader(new FileReader(f));
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            }
        }

        public FastScanner(InputStream f) {
            br = new BufferedReader(new InputStreamReader(f));
        }

        String next() {
            while (st == null || !st.hasMoreTokens()) {
                String s = null;
                try {
                    s = br.readLine();
                } catch (IOException e) {
                    e.printStackTrace();
                }
                if (s == null)
                    return null;
                st = new StringTokenizer(s);
            }
            return st.nextToken();
        }

        boolean hasMoreTokens() {
            while (st == null || !st.hasMoreTokens()) {
                String s = null;
                try {
                    s = br.readLine();
                } catch (IOException e) {
                    e.printStackTrace();
                }
                if (s == null)
                    return false;
                st = new StringTokenizer(s);
            }
            return true;
        }

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

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

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

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

Measured memory_bytes: 32644
import math
# スペース区切りの整数の入力
s=list(input().split(' '))
n=int(s[0]) 
y=int(s[1])
ret=int(0)

for a in range(n):
  k=list(input().split(' '))
  r = math.sqrt( int( k[0]) * int(k[0]) + int( k[1] ) * int( k[1] ) )
  if r <= y :
    ret +=1
print(ret)

Measured memory_bytes: 9180
#!/usr/bin/env python3
# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math
import sys
import collections
from decimal import Decimal # 10進数で考慮できる

mod = 10**9+7
sys.setrecursionlimit(mod) # 再帰回数上限はでdefault1000

d = collections.deque()
def LI(): return list(map(int, sys.stdin.readline().split()))

N, T = LI()
costs = []
for i in range(N):
    c, t = LI()
    if t <= T:
        costs.append(c)

if len(costs) > 0:

    costs.sort()
    print(costs[0])
else:
    print("TLE")

Measured memory_bytes: 10832
#include<iostream>
#include<string>
#define N 8
using namespace std;

void rot90(char from[N][N], char to[N][N]){
	for(int i=0;i<N;++i)for(int j=0;j<N;++j)
		to[j][N-i-1]=from[i][j];
}
int main()
{
	char pat[4][N][N];
	for(int i=0;i<N;++i){
		string s;
		cin >> s;
		for(int j = 0; j < N; ++j){
			pat[0][i][j] = s[j];
		}
	}
	rot90(pat[0],pat[1]);
	rot90(pat[1],pat[2]);
	rot90(pat[2],pat[3]);

	for(int k=1;k<=3;++k){
		cout << k*90 << '\n';
		for(int i=0;i<N;++i){
			for(int j=0;j<N;++j){
				cout << pat[k][i][j];
			}
			cout << '\n';
		}
	}
	return 0;
}

Measured memory_bytes: 0
#include <iostream>

using namespace std;

char table[6][5] = {

{'a','b','c','d','e'},
{'f','g','h','i','j'},
{'k','l','m','n','o'},
{'p','q','r','s','t'},
{'u','v','w','x','y'},
{'z','.','?','!',' '}
};
int temp[2];

int main() {

    string mes;

    while (cin>>mes) {

        if (mes.length()%2!=0) cout << "NA" << endl;

        else {

            string res="";

            bool flag=false;
            for (int i=0; i<mes.length(); i++) {

                if (i%2!=0) {

                    temp[1] = mes[i] - '0';

                    if (temp[0]<1||temp[1]<1||temp[0]>6||temp[1]>5) {
                        flag = true;
                        break;
                    } else {
                        res += table[temp[0]-1][temp[1]-1];
                    }

                } else temp[0] = mes[i] - '0';

            }
            if (flag) cout << "NA" << endl;

            else cout << res << endl;

        }

    }

}

Measured memory_bytes: 0
#include<stdio.h>
int main(void){
	int i,j,k,H[300],W[300];
	for(i=0;;i++){
		scanf("%d %d",&H[i],&W[i]);
		if(H[i]==0&&W[i]==0){
			break;
		}
	}
	for(i=0;H[i]!=0||W[i]!=0;i++){
		for(j=0;j<H[i];j++){
			for(k=0;k<W[i];k++){
				if(0<j&&j<H[i]-1){
					if(0<k&&k<W[i]-1){
						printf(".");
					}else{
						printf("#");
					}
				}else{
					printf("#");
				}
			}
			printf("\n");
		}
		printf("\n");
	}
	return 0;
}


Measured memory_bytes: 2036
#include<iostream>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
using ll =long long;
int main()
{
    ll ans=0;
    ll a,b,c,k;
    cin>>a>>b>>c>>k;
    if(a>=k)
    {
        ans=k;
        cout<<ans<<endl;
        return 0;
    }
    else
    {
        ans+=a;
        k-=a;
        if(b>=k)
        {
            cout<<ans<<endl;
            return 0;
        }
        {
            k-=b;
            ans-=k;
            cout<<ans<<endl;
            return 0;
        }
    }
    
    

    return 0;
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,i,maxv,sum=0,t;
	cin>>n;
	int l[n];
	for(i=1;i<=n;i++)
	{
		cin>>l[i];
		sum+=l[i];
	}
	maxv=l[1];
	for(i=1;i<=n;i++)
	{
		if(l[i]>maxv)
		{
			maxv=l[i];
		}
	}
	t=sum-maxv;
	if(maxv<t)
	{
		cout<<"Yes";
	}
	else
	{
		cout<<"No";
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
struct edge {
    int to;     // 辺の行き先
    int weight; // 辺の重み
    edge(int t, int w) : to(t), weight(w) { }
};
using Graph = vector<vector<int>>;
using dou =long double;
string Yes="Yes";
string YES="YES";
string NO="NO";
string No="No";
#define rep(i, n)         for(int i = 0; i < (int)(n); i++)
#define brep(n)           for(int bit=0;bit<(1<<n);bit++)
#define erep(i,container) for (auto i : container)
#define irep(i, n)        for(int i = n-1; i >= (int)0; i--)
#define rrep(i,m,n) for(int i = m; i < (int)(n); i++)
#define reprep(i,j,h,w) rep(i,h)rep(j,w)
#define all(x) (x).begin(),(x).end()
#define aall(x,n) (x).begin(),(x).begin()+(n)
#define VEC(type,name,n) std::vector<type> name(n);rep(i,n)std::cin >> name[i];
#define pb push_back
#define pf push_front
#define lb lower_bound
#define ub upper_bound
#define res resize
#define as assign
#define fi first
#define se second
#define itn int
#define mp make_pair
#define sum(a) accumulate(all(a),0)
#define keta fixed<<setprecision
#define vvector(name,typ,m,n,a)vector<vector<typ> > name(m,vector<typ> (n,a))
#define vvvector(name,t,l,m,n,a) vector<vector<vector<t> > > name(l, vector<vector<t> >(m, vector<t>(n,a)));
#define vvvvector(name,t,k,l,m,n,a) vector<vector<vector<vector<t> > > > name(k,vector<vector<vector<t> > >(l, vector<vector<t> >(m, vector<t>(n,a)) ));
 
typedef long long ll;
const int INF = 2000000000;
const ll INF64 = 9223372036854775806ll;
const int mod = 1000000007ll;
const ll  MOD = 1000000007LL;
//-0.4620981203755741
int main(){
    int a,b;
    std::cin >> a>>b;
    rrep(i,1,100000){
        int aa=i*0.08,bb=i*0.10;
        if(aa==a&&bb==b){
            std::cout << i << std::endl;
            exit(0);
        }
    }
    std::cout << -1 << std::endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h> 
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define max(a,b) (a>b?a:b)
#define min(a,b) (a<b?a:b)
#define forn(i,o,n) for(int i=o;i<n;i++)
#define int long long
#define endl "\n"
#define mod 1000000007
#define double long double
#define pb push_back
#define swap(x,y) (x^=y^=x^=y)
using namespace std;
int gcd(int a, int b){
    if (b == 0)
        return a;
    return gcd(b, a % b); 
}
bool isPrime(int n){
    if(n < 2)
        return 0;
    if(n < 4)
        return 1;
    if(n % 2 == 0 or n % 3 == 0)
        return 0;
    for(int i = 5; i*i <= n; i += 6)
        if(n % i == 0 or n % (i+2) == 0)
            return 0;
    return 1;
}
int modexpo(int x,int p){
    int res = 1;
    x = x%mod;
    while(p){
        if(p%2)
            res = res * x;
        p >>= 1;
        x = x*x % mod;
        res %= mod;
    }
    return res;
}
int32_t main(){
    IOS
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout); 
    int t=1;
    // cin>>t;
    while(t--){
        int n,m;
        cin>>n>>m;
        int ans=(n)*(n-1);
        ans/=2;
        int x=m*(m-1);
        cout<<x/2+ans;
        cout<<endl;
    }
}

Measured memory_bytes: 384
# include <bits/stdc++.h>
# define rep(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
# define reps(i, n) for(int i=1, i##_len=(n); i<=i##_len; ++i)
# define rrep(i, n) for(int i=((int)(n)-1); i>=0; --i)
# define rreps(i, n) for(int i=((int)(n)); i>0; --i)
# define ALL(x) (x).begin(), (x).end()
# define SZ(x) ((int)(x).size())
# define pb push_back
# define optimize_cin() cin.tie(0); ios::sync_with_stdio(false)
using namespace std;
using lint = long long;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

int main()
{
    string S; cin >> S;
    int cnt = 0;
    char buf = S[0];
    rep (i, SZ(S))
    {
        if (buf != S[i])
        {
            cnt++;
            buf = S[i];
        }
    }

    cout << cnt << "\n";

    return 0;
}


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

#define INIT_CAP 10
#define INF 1000000000

#define min(a, b) (((a) < (b)) ? (a) : (b))

const int di[4] = {-1, 0, 1, 0};
const int dj[4] = {0, 1, 0, -1};

typedef struct {
	int to, w;
} Edge;

typedef struct {
	Edge *elem;
	int cap, size;
} VecEdge;

typedef struct {
	int num;
	int d;
} PNumDis;

VecEdge adj[30 * 30 * 4];
PNumDis heap[30 * 30 * 4];
int hsize;
int d[30 * 30 * 4], idx[30 * 30 * 4];

void init(int n) {
	while (n--)
		adj[n] = (VecEdge){malloc(sizeof(Edge) * INIT_CAP), INIT_CAP, 0};
}

inline void add(int from, int to, int w) {
	if (adj[from].size == adj[from].cap) {
		adj[from].cap <<= 1;
		adj[from].elem = realloc(adj[from].elem, sizeof(Edge) * adj[from].cap);
	}
	adj[from].elem[adj[from].size++] = (Edge){to, w};
}

inline int calcNextIdx(int i) {
	return i * 2 + 1 + (i * 2 + 2 < hsize && heap[i * 2 + 1].d > heap[i * 2 + 2].d);
}

inline PNumDis delete(void) {
	int i;
	int nextIdx;
	const PNumDis root = heap[0], last = heap[--hsize];

	for (i = 0; i * 2 + 1 < hsize && last.d > heap[nextIdx = calcNextIdx(i)].d; i = nextIdx) {
		heap[i] = heap[nextIdx];
		idx[heap[i].num] = i;
	}
	heap[i] = last;
	idx[last.num] = i;

	return root;
}

inline void decreaseKey(int num, int d) {
	int i;

	for (i = idx[num]; i > 0 && d < heap[i - 1 >> 1].d; i = i - 1 >> 1) {
		heap[i] = heap[i - 1 >> 1];
		idx[heap[i].num] = i;
	}
	heap[i] = (PNumDis){num, d};
	idx[num] = i;
}

void dijkstra(int n, int s) {
	int i;

	for (i = 0; i < n; i++) {
		heap[i] = (PNumDis){i, INF};
		d[i] = INF;
		idx[i] = i;
	}
	hsize = n;

	d[s] = 0;
	decreaseKey(s, 0);
	while (hsize > 0) {
		const PNumDis fromP = delete();
		for (i = 0; i < adj[fromP.num].size; i++) {
			const Edge e = adj[fromP.num].elem[i];
			if (fromP.d + e.w < d[e.to]) {
				d[e.to] = fromP.d + e.w;
				decreaseKey(e.to, d[e.to]);
			}
		}
	}
}

int main(void) {
	int i, j, k, l;
	int w, h;

	while (scanf("%d %d", &w, &h), w) {
		int s[30][30];
		int c[4];

		for (i = 0; i < h; i++)
			for (j = 0; j < w; j++)
				scanf("%d", s[i] + j);

		for (i = 0; i < 4; i++)
			scanf("%d", c + i);

		init(h * w * 4);

		for (i = 0; i < h; i++)
			for (j = 0; j < w; j++)
				for (k = 0; k < 4; k++)
					for (l = 0; l < 4; l++) {
						int nd = k + l & 3;
						int ni = i + di[nd], nj = j + dj[nd];
						if (ni >= 0 && ni < h && nj >= 0 && nj < w)
							add(i * w * 4 + j * 4 + k, ni * w * 4 + nj * 4 + nd, l == s[i][j] ? 0 : c[l]);
					}

		dijkstra(h * w * 4, 1);

		printf("%d\n", min(d[(h - 1) * w * 4 + (w - 1) * 4 + 1], d[(h - 1) * w * 4 + (w - 1) * 4 + 2]));
	}

	return 0;
}

Measured memory_bytes: 8904
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;

import java.util.*;
import java.util.stream.Collectors;


class Main{
  public static void main(String[] args){
    FastScanner fs = new FastScanner();
    List<Long> list = new ArrayList<Long>();
    long num1 = fs.nextLong();
    long num2 = fs.nextLong();
    long count=0;
    for(int i=0;i<num1;i++){
      list.add(fs.nextLong());
    }
    List<Long> newList = list.stream().sorted(Comparator.reverseOrder()).collect(Collectors.toList());
    for(int j=0;j<num2;j++){
      count += newList.get(j);
    }
    System.out.println(count);
  }
}
class FastScanner {
		BufferedReader br;
		StringTokenizer st;

		public FastScanner(String s) {
			try {
				br = new BufferedReader(new FileReader(s));
			} catch (FileNotFoundException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}

		public FastScanner() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		String nextToken() {
			while (st == null || !st.hasMoreElements()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}

		String nextLine(){
			String line = "";
			try{
				line = br.readLine();
			}catch(IOException e){
				e.printStackTrace();
			}
			return line;
		}

		int nextInt() {
			return Integer.parseInt(nextToken());
		}

		long nextLong() {
			return Long.parseLong(nextToken());
		}

		double nextDouble() {
			return Double.parseDouble(nextToken());
		}
	}


Measured memory_bytes: 27988
#include<iostream>
#include<vector>
#include<queue>

using namespace std;
int main(){
	while(1){
		int r0,w,c,r; cin >> r0 >> w >> c >> r;
		if (r0 + w + c + r == 0) break;
		int x = 0;
		while((r0 + x * r)/w < c){
			x++;
		}
		cout << x << endl;
	}
return 0;
}

Measured memory_bytes: 3072
#include<stdio.h>
#include<string.h>

int main()
{
    char s[10];

    scanf("%s",s);
    if(s[2]==s[3]&&s[4]==s[5])
    {
        printf("Yes\n");
    }

    else
    {
        printf("No\n");
    }
    return 0;

}


Measured memory_bytes: 1568
N, M, X = map(int, input().split())
A_li = list(map(int, input().split()))
front = 0
for i in range(X):
    if i in A_li:
        front += 1
back = 0
for j in range(X, N + 1):
    if j in A_li:
        back += 1
print(min(front, back))


Measured memory_bytes: 3064
import numpy as np
import scipy.sparse as sps
import scipy.misc as spm
import collections as col
import functools as func
import itertools as ite
import fractions as frac
import math as ma
import cmath as cma
import copy as cp
import sys
def sinput(): return sys.stdin.readline()
def iinput(): return int(sinput())
def imap(): return map(int, sinput().split())
def fmap(): return map(float, sinput().split())
def iarr(n=0):
    if n: return [0 for _ in range(n)]
    else: return list(imap())
def farr(): return list(fmap())
def sarr(n=0):
    if n: return ["" for _ in range(n)]
    else: return sinput().split()
def barr(n): return [False for _ in range(n)]
sys.setrecursionlimit(10**7)
MOD = 10**9 + 7; EPS = sys.float_info.epsilon
PI = np.pi; EXP = np.e; INF = np.inf

k,n = imap()
a = iarr()
dist = []
for i in range(n):
    tmp = a[i] - a[i-1]
    if tmp<0: tmp += k
    dist.append(tmp)
ans = k - max(dist)
print(ans)


Measured memory_bytes: 38076
import java.util.*;

class Main {
	static Scanner sc = new Scanner(System.in);
	public static void main(String[] args) {
		
		while (true) {
			int n = sc.nextInt(); int x = sc.nextInt();
			if (n==0 && x==0) return;
			int sum = 0;
			for (int i=1; i<=n-2; i++) {
				for (int j=i+1; j<=n-1; j++) {
					for (int k=j+1; k<=n; k++) {
						if (i+j+k == x) sum++;
					}
				}
			}
			System.out.println(sum);
		}
		
		
	}
}


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

#define mp make_pair
#define fst first
#define snd second
#define forn(i,n) for (int i = 0; i < int(n); i++)
#define forn1(i,n) for (int i = 1; i <= int(n); i++)
#define popcnt __builtin_popcount

using namespace std;

typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,int> pli;
typedef pair<int,ll> pil;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;

template <typename T> T id(T b) {return b;};
template <class It> bool all(It f,It l){return std::all_of(f,l,id<bool>);}
template <class It> bool any(It f,It l){return std::any_of(f,l,id<bool>);}
template <typename T> void chmax(T &x, T y) {if (x < y) x = y;}
template <typename T> void chmin(T &x, T y) {if (x > y) x = y;}

const int MAX_N = 100;
int n,k;
bool g[MAX_N][MAX_N];

int main()
{
#define FASTIO
#ifdef FASTIO
  ios_base::sync_with_stdio(false); cin.tie(nullptr);
#endif

  cin >> n >> k;
  if ((n-1)*(n-2)/2 < k) {
    cout << -1 << endl;
    return 0;
  }

  forn1(i,n-1) {
    g[0][i] = g[i][0] = true;
  }

  int c = (n-1)*(n-2)/2 - k;
  for (int i = 1; i < n && c > 0; i++) {
    for (int j = i+1; j < n && c > 0; j++) {
      g[i][j] = g[j][i] = true;
      c--;
    }
  }

  vector<pii> ans;
  for (int i = 0; i < n; i++)
    for (int j = i+1; j < n; j++)
      if (g[i][j]) ans.push_back(mp(i,j));

  cout << ans.size() << "\n";
  for (pii p : ans)
    cout << p.fst+1 << " " << p.snd+1 << "\n";

  return 0;
}


Measured memory_bytes: 384
from collections import Counter
n = int(input())
S = [input() for _ in range(n)]
C = Counter(S)

print("AC x %d"%(C["AC"]))
print("WA x %d"%(C["WA"]))
print("TLE x %d"%(C["TLE"]))
print("RE x %d"%(C["RE"]))

Measured memory_bytes: 16428
n = int(input())
a = list(map(int, input().split()))

c = {}

for i in a:
    c[i] = c.get(i, 0) + 1

ways = 0
for i in c:
    ways += c[i]*(c[i]-1)//2

d = {}
for k in a:
    if d.get(k, "hello") == "hello":
        ans = ways-c[k]+1
        d[k] = ans
    else:
        ans = d[k]
    print(ans)


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

int n;
double v[55], s;

int main(){
	cin >> n;
	for (int i = 0; i < n; ++i) cin >> v[i];
	sort(v, v+n);
	s = (v[0] + v[1])/2;
	for (int i = 2; i < n; ++i){
		s = (s + v[i])/2;
	}
	cout << s;
}

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

using namespace std;

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

	vector<long long int> vec(n);

	for(int i = 0; i < n; i++){
		long long int a;
		cin >> a;

		if(a == 0){
			cout << 0;
			return 0;
		}

		vec[i] = a;
	}

	long long int ans = vec[0];

	for(int i = 1; i < n; i++){
		if(vec[i] <= 1000000000000000000 / ans){
			ans *= vec[i];
		}
		else{
			cout << -1;
			return 0;
		}
	}

	cout << ans;

	return 0;
}

Measured memory_bytes: 3984
N = int(input())
H = list(map(int, input().split()))
t = 0
ans = 0
for i in range(N-1):
    if H[i] >= H[i+1]:
        t += 1
    else:
        if t > ans:
            ans = t
        t = 0
    if i == N-2:
        if t > ans:
            ans = t
print(ans)


Measured memory_bytes: 14252
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll gcd(ll a, ll b)
{
if(a==0)
return b;
else
return gcd(b%a, a);
}
const int N=105;
ll arr[N];
int main()
{
ll n, a;
cin>>n;
for(a=0; a<n; a++)
cin>>arr[a];
sort(arr, arr+n);
ll curr=1;
for(a=0; a<n; a++)
{
ll b=gcd(curr, arr[a]);
curr=(curr/b)*arr[a]; 
}
cout<<curr;
return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <string>
#include <vector>
#include <math.h>
#include <queue>
#include <deque>
#include <map>
const int MOD = 1e9+7;
typedef long long ll;
using namespace std;

int main(){
	int a, b, t;
	cin >> a >> b >> t;
	cout << b*(t/a) << endl;
 	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<set>
#include<map>
#include<queue>
#define REP(i,a) for (int i = 0;i < (a);++i)
#define FOR(i,a,b) for (int i = (a);i < (b); ++i)
#define FORR(i,a,b) for (int i = (a);i >= (b); --i)
#define ALL(obj) (obj).begin(),(obj).end()
#define SORT(list) sort(ALL((list)));
#define MOD 1000000007
using namespace std;
using ll = long long;
int main(){
    ll n;
    cin >> n;
    vector<ll> a(n);
    REP(i,n){
        cin >> a[i];
    }
    sort(ALL(a));
    ll diff=1000000000;
    ll num;
    if(a[n-1]%2){
        REP(i,n-1){
            if(llabs((a[n-1]/2)-a[i]) < diff){
                diff = llabs((a[n-1]/2)-a[i]);
                num = a[i];
            }
        }
        REP(i,n-1){
            if(llabs((a[n-1]/2)+1-a[i]) < diff){
                diff = llabs((a[n-1]/2)+1-a[i]);
                num = a[i];
            }
        }
    }
    else{
        REP(i,n-1){
            if(llabs((a[n-1]/2)-a[i]) < diff){
                diff = llabs((a[n-1]/2)-a[i]);
                num = a[i];
            }
        }
    }
    cout << a[n-1] << " " << num << endl;
    return 0;
}

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

const int MAXW = 10004;
int N;
int b[2][MAXW];

bool tri(int a[MAXW]) {
  for(int i = 0; i < MAXW && a[i] != 0; ++i) {
    if(a[i] != i+1) return false;
  }
  return true;
}

int solve() {
  if(tri(b[0])) return 0;
  for(int t = 0; t < 10000; ++t) {
    int p = t%2;
    int q = 1-p;
    fill(b[q], b[q]+MAXW, 0);
    int h = 0;
    int j = 0;
    for(int i = 0; i < MAXW && b[p][i] != 0; ++i, ++j) {
      ++h;
      if(b[p][i] - 1 == 0) --j;
      else b[q][j] = b[p][i] - 1;
    }
    b[q][j] = h;
    if(tri(b[q])) return t+1;
  }
  return -1;
}

int main() {
  while(cin >> N && N) {
    fill(b[0], b[2], 0);
    for(int i = 0; i < N; ++i) {
      cin >> b[0][i];
    }
    cout << solve() << endl;
  }
  return 0;
}

Measured memory_bytes: 1240
def m(L,R):
 T=[]
 for l in L[::-1]:
  while R and R[-1]>l:T+=[R.pop()]
  T+=[l]
 return R+T[::-1]
def d(A):
 l=len(A);global c;c+=l
 s=l//2;return m(d(A[:s]),d(A[s:]))if l>1 else A
c=0
n=int(input())
print(*d(list(map(int,input().split()))))
print(c-n)


Measured memory_bytes: 61652
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
using vll = vector<vl>;
using Pll = pair<ll, ll>;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(v) v.begin(), v.end()
#define sz(x) ((int) x.size())
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define F first
#define S second
const int MOD = 1e9+7;
const int INF = 2e9;
template<class T> void print(const T& t){ cout << t << endl; }
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 gcd(int a,int b){return b?gcd(b,a%b):a;}

int main(){
  ll x, n;
  cin >> x >> n;
  vl p(n);
  rep(i,n){
    cin >> p[i];
  }
  ll a1, a2;
  for (ll i = x; i <= x; i--){
    bool z = true;
    rep(j,n){
      if(p[j]==i){
        z = false;
      }
    }
    if(z){
      a1 = i;
      break;
    }
  }
  for (ll i = x; i >= x; i++){
    bool z = true;
    rep(j,n){
      if(p[j]==i){
        z = false;
      }
    }
    if(z){
      a2 = i;
      break;
    }
  }
  ll ans;
  if(x-a1<=a2-x){
    ans = a1;
  }
  else{
    ans = a2;
  }
  print(ans);
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
int main ()
{
long long  arr [5];
cin >>arr [0]>> arr [1]>>arr [2]>>arr [3];
long long  brr [5];
brr [0] = arr [0]*arr[2];
brr [1] = arr [0]*arr[3];
brr [2] = arr [1]*arr[2];
brr [3] = arr [1]*arr[3];
sort (brr,brr + 4);
cout <<brr [3]<<'\n';
}


Measured memory_bytes: 3628
import qualified Data.ByteString.Char8 as B
import           Data.Maybe            (fromJust)

readInts :: B.ByteString -> [Int]
readInts = map (fst . fromJust . B.readInt) . B.words

getInts :: IO [Int]
getInts = readInts <$> B.getLine

main :: IO ()
main = do
  [h, n] <- getInts
  as <- getInts
  putStrLn $ if solve h n as then "Yes" else "No"

solve :: Int -> Int -> [Int] -> Bool
solve h _ as = h <= sum as


Measured memory_bytes: 2172
n, m = map(int, input().split())
X = list(map(int, input().split()))
Y = list(map(int, input().split()))
MOD = 10**9+7
sx, sy = 0, 0
for i in range(n):
  t = 2*i+1-n
  t *= X[i]
  t %= MOD
  sx += t
  sx %= MOD
for j in range(m):
  t = 2*j+1-m
  t *= Y[j]
  t %= MOD
  sy += t
  sy %= MOD
print(sx*sy%MOD)

Measured memory_bytes: 18576
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<functional>
#include<cmath>
#include<map>
using namespace std;
#define int long long
#define inf   1000000009
#define minf -1000000009
int a[28];
bool isk(string s) {
	string sa = s;
	reverse(sa.begin(), sa.end());
	return s == sa;
}
signed main() {
	string s;
	cin >> s;
	for (int i = 0; i < s.size(); i++) {
		a[s[i] - 'a']++;
	}
	int k = 0;
	for (int i = 0; i < 26; i++) { if ((i != 23) && (a[i] & 1))k++; } 
	if (k > 1) {
		cout << -1 << endl;
		return 0;
	}
	string n;
	for (int i = 0; i < s.size(); i++) {
		if (s[i] != 'x')n.push_back(s[i]);
	}
	if (!isk(n)) {
		cout << -1 << endl;
		return 0;
	}
	int fi = s.size();

	int l = 0, r = s.size() - 1;
	int p = 0;
	for (int i = 0; i < s.size(); i++) {
		if (l > r)break;
		if (s[l] == s[r]) {
			l++;
			r--;
		}
		else if (s[l] == 'x') {
			l++;
			p++;
		}
		else if (s[r] == 'x') {
			r--;
			p++;
		}
	}
	cout << p << endl;
}

Measured memory_bytes: 640
a,b = map(int, input().split(' '))
c = []
for i in range(a):
    d = list(map(int, input().split(' ')))
    ty = 0
    for j in d:
        ty = ty + j
    d.append(ty)
    c.append(d)
tt = 0
e = []
for i in range(b + 1):
    for j in range(a):
        tt = tt + c[j][i]
    e.append(tt)
    tt = 0
c.append(e)
for i in range(a + 1):
    print(' ' .join(map(str,c[i])))


Measured memory_bytes: 5700
T=int(input())
ABCD=[list(map(int,input().split())) for i in range(T)]
from collections import deque
for N,a,b,c,d in ABCD:
    dic={N:0}
    q=deque([N])
    while q:
        n=q.popleft()
        x=dic[n]
        if n%2:
            if (n-1)//2 not in dic or min(x+a+d,x+(n-(n-1)//2)*d)<dic[(n-1)//2]:
                dic[(n-1)//2]=min(x+a+d,x+(n-(n-1)//2)*d)
                q.append((n-1)//2)
            if (n+1)//2 not in dic or x+a+d<dic[(n+1)//2]:
                dic[(n+1)//2]=x+a+d
                q.append((n+1)//2)
            if n-1==0:
                dic[0]=min(dic[0],x+d)
        else:
            if n//2 not in dic or x+a<dic[n//2]:
                dic[n//2]=x+a
                q.append(n//2)
        if n%3:
            y=n-n//3*3
            if (n-y)//3 not in dic or min(x+b+d*y,x+(n-(n-y)//3)*d)<dic[(n-y)//3]:
                dic[(n-y)//3]=min(x+b+d*y,x+(n-(n-y)//3)*d)
                q.append((n-y)//3)
            if (n+3-y)//3 not in dic or x+b+d*(3-y)<dic[(n+3-y)//3]:
                dic[(n+3-y)//3]=x+b+d*(3-y)
                q.append((n+3-y)//3)
            if n-y==0:
                dic[0]=min(dic[0],x+d*y)
        else:
            if n//3 not in dic or x+b<dic[n//3]:
                dic[n//3]=x+b
                q.append(n//3)
        if n%5:
            y=n-n//5*5
            if (n-y)//5 not in dic or min(x+c+d*y,x+(n-(n-y)//5)*d)<dic[(n-y)//5]:
                dic[(n-y)//5]=min(x+c+d*y,x+(n-(n-y)//5)*d)
                q.append((n-y)//5)
            if (n+5-y)//5 not in dic or x+c+d*(5-y)<dic[(n+5-y)//5]:
                dic[(n+5-y)//5]=x+c+d*(5-y)
                q.append((n+5-y)//5)
            if n-y==0:
                dic[0]=min(dic[0],x+d*y)
        else:
            if n//5 not in dic or x+c<dic[n//5]:
                dic[n//5]=x+c
                q.append(n//5)
    print(dic[0])

Measured memory_bytes: 11328
use proconio::{input, fastout};
use proconio::marker::{Chars};
use proconio::marker::Usize1;
use std::cmp::*;

macro_rules! debug {
      ($($a:expr),*) => {
          eprintln!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
    }
}

#[fastout]
fn main() {
    input!{
        mut p: [usize;3],
    }

    p.sort();
    if p[0]==p[1] {
        if p[1]==p[2] {
            println!("1");
        } else {
            println!("2");
        }
    } else if p[1]==p[2] {
        println!("2");
    } else {
        println!("3");
    }

}


Measured memory_bytes: 2204
n,m,x = map(int, input().split())
c = []
a = []
for i in range(n):
    t = list(map(int, input().split()))
    c.append(t[0])
    a.append(t[1:])

ans = -1

for i in range(1<<n):
    csum = 0
    mlst = [0]*m
    for j in range(n):
        if (i>>j)&1==1:
            csum += c[j]
            for k in range(m):
                mlst[k]+=a[j][k]
    if all(X >= x for X in mlst):
        if ans == -1:
            ans = csum
        else:
            ans = min(ans,csum)

print(ans)

Measured memory_bytes: 9232
#include <iostream>
using std::cin;
using std::cout;
using std::endl;

int main()
{
	int h, w, i, j;
	while (true)
	{
		cin >> h >> w;
		if (h == 0 && w == 0) break;
		for (i = 0; i < h; i++ )
		{
			for (j = 0; j < w; j++)
			{
				if ((i % 2 == 0 && j % 2 == 0) || (i % 2 == 1 && j % 2 == 1) )
					cout << '#';
				else cout << '.';
			}
			cout << endl;
		}
		cout << endl;
	}
	return 0;
}

Measured memory_bytes: 1152
#include <bits/stdc++.h>
using namespace std;
int main() {
	int n;
	string a, b, c;
	cin >> n >> a >> b >> c;
	int ans = 0;
	for (int i = 0; i < n; i++) {
		if (a[i] == b[i] || a[i] == c[i] || b[i] == c[i]) {
			ans++;
			if (a[i] == b[i] && b[i] == c[i]) ans--;
		}
		else {
			ans += 2;
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <limits>
#include <unordered_map>

using namespace std;
using str = string;

#define rep(a,l,r) for(int a=(l);a<(r);a++)
#define get cin>>
#define put cout<<

void run() {

	int x; get x;

	if (x == 1) {
		put 1;return;
	}

	int maxCnt = 0;
	rep(i,2,x + 1){
		int cnt = 0;
		for (int j = 2; true; j++){
			cnt = pow(i,j);
			if (x < cnt) break;
			if (maxCnt < cnt) maxCnt = cnt;
		}
	}

	put maxCnt;

}

int main() {ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);run();return 0;}


Measured memory_bytes: 256
#include <bits/stdc++.h>   
using namespace std;
#define N 50   
#define REP(i, n) for(int i=0; i<n; i++)
int a,b,c,d;
int ti[101];
int ans=0;
int main(void){
    cin>>a>>b>>c>>d;
    for(int i=a;i<b;i++){
        ti[i]++;    
    }
    for(int i=c;i<d;i++){
        ti[i]++;    
    }
    for(int i=0;i<=100;i++){
        if(ti[i]==2)ans++;   
    }
    printf("%d",ans);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define MOD 1000000007LL
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
int a,b;

int main(void){
	scanf("%d%d",&a,&b);
	if(a==1)a+=13;
	if(b==1)b+=13;
	if(a==b)puts("Draw");
	else printf("%s\n",a>b?"Alice":"Bob");
	return 0;
}

Measured memory_bytes: 256
process.stdin.resume();
process.stdin.setEncoding('utf8');
process.stdin.on('data', function(chunk){


 array = (chunk.trim()).split("\n")


for (var i = 0; i < array.length; i++) {
  var x = array[i].split(" ");
  var xa = Number(x[0]) + Number(x[1]);
  console.log(String(xa).length);
}



  })

Measured memory_bytes: 16448
//Created Time:2020年01月11日 星期六 14时51分50秒
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#define N 200005
#define oo 9999999999999
#define ll long long

using namespace std;

//{{{Segment_Tree
struct Segment_Tree{
#define ls pos << 1
#define rs pos << 1 | 1
	ll val[N << 3], tag[N << 3];
	
	void push_down(int pos){
		if(!tag[pos]) return ;
		ll w = tag[pos]; tag[pos] = 0;
		val[ls] += w; val[rs] += w;
		tag[ls] += w; tag[rs] += w;
	}

	void push_up(int pos){
		val[pos] = min(val[ls], val[rs]);
		return ;
	}

	void build(int pos, int l, int r){
		if(l == r) return val[pos] = oo, void();
		int mid = (l + r) >> 1;
		build(ls, l, mid); build(rs, mid + 1, r);
		push_up(pos); return ;
	}

	void modify(int pos, int l, int r, int p, ll w){
		if(l == r) return val[pos] = w, void();
		int mid = (l + r) >> 1; push_down(pos);
		if(mid >= p) modify(ls, l, mid, p, w);
		else modify(rs, mid + 1, r, p, w);
		push_up(pos); return ;
	}

	void update(int pos, int l, int r, int nl, int nr, ll w){
		if(nl > nr) return ;
		if(l >= nl && r <= nr) return val[pos] += w, tag[pos] += w, void();
		int mid = (l + r) >> 1; push_down(pos);
		if(mid >= nl) update(ls, l, mid, nl, nr, w);
		if(mid < nr) update(rs, mid + 1, r, nl, nr, w);
		push_up(pos); return ;
	}

	ll query(int pos, int l, int r, int nl, int nr){
		if(nl > nr) return oo;
		if(l >= nl && r <= nr) return val[pos];
		int mid = (l + r) >> 1; ll ans = oo; push_down(pos);
		if(mid >= nl) ans = min(ans, query(ls, l, mid, nl, nr));
		if(mid < nr) ans = min(ans, query(rs, mid + 1, r, nl, nr));
		return ans;
	}

	ll get_ans(int pos, int l, int r){
		if(l == r) return val[pos] + l;
		ll ans = oo; int mid = (l + r) >> 1; push_down(pos);
		ans = min(ans, get_ans(ls, l, mid));
		ans = min(ans, get_ans(rs, mid + 1, r));
		return ans;
	}
}T1, T2;
//}}}

int n, q, x, y, p, lst;

int main(){
	scanf("%d%d%d%d%d", &n, &q, &x, &y, &p); --q; lst = p;
	T1.build(1, 1, n); T2.build(1, 1, n);
	T1.modify(1, 1, n, x, abs(p - y) - x);
	T2.modify(1, 1, n, x, abs(p - y) + x);
	T1.modify(1, 1, n, y, abs(p - x) - y);
	T2.modify(1, 1, n, y, abs(p - x) + y);
	while(q--){
		scanf("%d", &p);
		ll f1 = T1.query(1, 1, n, 1, p) + p;
		ll f2 = T2.query(1, 1, n, p + 1, n) - p;
		ll tmp = abs(p - lst);
		T1.modify(1, 1, n, lst, min(f1, f2) - lst);
		T2.modify(1, 1, n, lst, min(f1, f2) + lst);
		T1.update(1, 1, n, 1, lst - 1, tmp);
		T1.update(1, 1, n, lst + 1, n, tmp);
		T2.update(1, 1, n, 1, lst - 1, tmp);
		T2.update(1, 1, n, lst + 1, n, tmp);
		lst = p;
	}
	cout << T1.get_ans(1, 1, n) << endl;
	return 0;
}

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

using namespace std;

int main() {
	int x, y, z;
	cin >> x >> y >> z;
	x -= z;
	int ans = x / (y + z);
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define sz(x) int(x.size())
#define pb push_back
#define eb emplace_back
using ll=long long;
using P = pair<ll,int>;
#define chmax(x,y) x = max(x,y)
#define chmin(x,y) x = min(x,y)
const ll MOD=1000000007,MOD2=998244353;



int main() {
    string S;
    cin>>S;
    string ans="AC?";
    int L=sz(S);
    rep(i,L){
        if(i==0 && S.at(i)!='A'){ans="WA";}
        if(i==1){
            if(S.at(i)-'a'<0 || S.at(i)-'a'>25){ans="WA";}
        }
        if(i>=2){
            if(ans=="AC"){
                if(S.at(i)-'a'<0 || S.at(i)-'a'>25){ans="WA";}
            }
            else if(ans=="AC?"){
                if(S.at(i)-'a'<0 || S.at(i)-'a'>25){
                    if(i<L-1 && S.at(i)=='C'){ans="AC";}
                    else{ans="WA";}
                }
            }
        }
    }
    if(ans=="AC?")ans="WA";
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define rep(i,l,r) for(int (i)=(l);(i)<(r);(i)++)
#define erep(i,l,r) for(int (i)=(l);(i)<=(r);(i)++)
#define MOD 1000000007
using namespace std;
#define ll long long
ll inv(ll a){
  ll t=1;
  while (a>1){
    t=t*(MOD-MOD/a)%MOD;
    a=MOD%a;
  }
  return t;
}
ll comb(ll n,ll k){
  if (k>n-k) k=n-k;
  ll nu=1,de=1;
  rep(i,1,k+1){
    nu=nu*(n+1-i)%MOD;
    de=de*i%MOD;
  }
  return nu*inv(de)%MOD;
}
int main(){
    ll x,y,i=-1,j=-1;
    cin>>x>>y;
    if((2*x-y)%3==0)i=(2*x-y)/3;
    if((2*y-x)%3==0)j=(2*y-x)/3;
    if(i<0||j<0)cout<< "0" <<endl;
    else cout<< comb(i+j,j) <<endl;
}

Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define FOR(i, a, b) for(ll i = a; i < b; i++)
#define rep(i, n) FOR(i, 0, n)
#define rFOR(i, a, b) for(ll i = a - 1; i >= b; i--)
#define rrep(i, a) rFOR(i, a, 0)
#define pb push_back
using namespace std;
using ll = long long;
using ld = long double;
typedef pair<ll,ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<P> vP;
typedef vector<char> vc;
typedef vector<vc> vvc;
const ll MOD = 1000000007;
const ll MOD2 = 998244353;
const ld PI = acos(-1);
const ll INF = 1e18;
struct edge{ll to, cost;};

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

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

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int N, K;
    cin >> N >> K;
    vP x;
    ll res=0;
    FOR(i,1,sqrt(N)+1){
        if(N/i-N/(i+1)>0){
            x.pb({i,N/i-N/(i+1)});
            res+=N/i-N/(i+1);
        }
    }
    rFOR(i,sqrt(N)+2,1){
        if(N/i>=sqrt(N)+1){
            x.pb({N/i,1});
            res+=1;
        }
    }
    rep(i,x.size()){
        //cout << x[i].first << ' ' << x[i].second << '\n';
    }
    vvl dp(K,vl(x.size()));
    rep(i,x.size()){
        if(i==0){
            dp[0][i]=1;
        }
        else{
            dp[0][i]=x[i].first-x[i-1].first;
        }
    }
    rep(i,K-1){
        vl acc(x.size(),0),dp_(x.size(),0);//accは以前の次にx[i].firstがきていい組み合わせの数
        rep(j,x.size()){
            acc[j]=dp[i][j];
        }
        rep(j,x.size()-1){
            acc[j+1]+=acc[j];
            acc[j+1]%=MOD;
        }
        //reverse(acc.begin(),acc.end());
        rep(j,x.size()){
            //cout << j << ' ' << acc[j] << '\n';
        }
        ll sum=0;
        rep(j,x.size()){
            if(j==0){
                dp_[j]=acc[x.size()-1];
            }
            else{
                dp_[j]=acc[x.size()-1-j]*(x[j].first-x[j-1].first)%MOD;
            }
            dp_[j]%=MOD;
        }
        rep(j,x.size()){
            dp[i+1][j]=dp_[j];
        }
    }
    ll ans=0;
    rep(i,x.size()){
        ans+=dp[K-1][i];
        ans%=MOD;
    }
    //cout << x.size() << '\n';
    rep(i,x.size()){
        //cout << i << ' ' << dp[K-1][i] << '\n';
    }
    cout << ans << '\n';
}
/*
overflow checked?
corner case checked?
boundary checked?
not TLE in worst case checked?
*/

Measured memory_bytes: 54544
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Kyoto2016_A
{
    class Program
    {
        static int N, A, B;
        static void Main(string[] args)
        {
            var m = scan;
            N = m[0]; A = m[1]; B = m[2];
            int cnt = 0;
            for (int i = 0; i < N; i++)
            {
                var t = scan[0];
                if (A <= t && t < B) continue;
                cnt++;
            }
            Console.WriteLine(cnt);
        }

        static int[] scan { get { return Array.ConvertAll(Console.ReadLine().Split(), int.Parse); } }
    }
}


Measured memory_bytes: 2648
#include <bits/stdc++.h>
using namespace std;
const int dx[]={1,0,-1,0,1,-1,-1,1,0};
const int dy[]={0,1,0,-1,1,1,-1,-1,0};
const int INF = 1e9;
const long long LINF = 1e18;
const double EPS = 1e-8;
#define pb push_back
#define mk make_pair
#define fr first
#define sc second
#define reps(i,j,k) for(ll i = (j); i < (k); ++i)
#define rep(i,j) reps(i,0,j)
#define all(a) (a).begin(),(a).end()
#define MOD 1000000007
typedef long long ll;
typedef pair<ll,ll> Pii;
typedef pair<Pii,int> P;
typedef vector<int> vi;
typedef vector<ll> vll;
template<class T>
ostream& operator<<(ostream &out, const vector<T> &v){
	out << "{";
	rep(i,v.size()){
		out << v[i] <<", ";
	}
	return out << "}" << endl;
}
int main() {
    ll n;
    cin >> n;
    if(n % 2 == 0){
        cout << n << endl;
    }
    else{
        cout << n * 2 << endl;
    }

    return 0;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-


def main():
    from collections import Counter

    n, k = map(int, input().split())
    a = list(map(int, input().split()))
    ans = 0

    for index, (key, value) in enumerate(sorted(Counter(a).items(), key=lambda x: x[1], reverse=True), 1):
        if index > k:
            ans += value

    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 39324
#include <bits/stdc++.h>
using namespace std;
const int N = 1e5+1;

vector<int> v(N, 0);
vector<int> memo(N, -1);

int cost(int pos, int n){
    if (memo[pos]!=-1) return memo[pos];
    else if (pos == n) return 0;
    else if (pos == n-1) return (abs(v[n-1] - v[n]));
    else {
        memo[pos] = min(abs(v[pos] - v[pos + 1]) + cost(pos+1, n), abs(v[pos]-v[pos + 2]) + cost(pos+2, n));
        return memo[pos];
    }
}

int main(){
    int n; cin >> n;
    
    for (int i = 1; i!=n+1; i++) cin >> v[i];
    cout << cost(1, n) << endl;

    return 0;
}

Measured memory_bytes: 7968
#include <bits/stdc++.h>
using intl = long long;
using ld = long double;
using namespace std;
#define rep(i, n) for(intl i = 0; i < (intl)(n); i++)
#define repd(i, n) for(intl i = (intl)(n); i >= 0; i--)
#define repi(i, a, b) for(intl i = (intl)(a); i < (intl)(b); i++)
#define repid(i, a, b) for(intl i = (intl)(a); i >= (intl)(b); i--)
#define max(a, b) ((a) > (b) ? (a) : (b))
#define min(a, b) ((a) < (b) ? (a) : (b))
#define all(x) (x).begin,(x).end()
#define m0(x) memset(x,0,sizeof(x))
#define m1(x) memset(x,1,sizeof(x))
#define fill(x,y) memset(x,y,sizeof(x))
#define alength(a) (sizeof(a) / sizeof(a[0]))
#define cin(i, a) rep(i, alength(a))cin >> a[i]
#define ccin(i, j, a) rep(i, alength(a))rep(j, alength(a[i]))cin >> a[i][j]
#define debug(x) cout << #x << ":" << x << endl
#define rdebug(i,x) rep(i, alength(x))cout << #x << "[" << i << "]:" << x[i] << endl
#define sqrt sqrtl
#define int intl
#define itn intl
#define double ld
#define pb push_back
#define mp make_pair
const intl INF = 1e9;
const intl MOD = 1e9+7;
const ld eps = 1.0e-14;//-9
void fp(bool f){cout << (f ? "Yes" : "No") << endl;}
void fp(bool f, string s, string t){cout << (f ? s : t) << endl;}
intl kai(intl k){
    intl a = 1;
    for(int i = 2; i <= k; i++){
        a *= i;
    }
    return a;
}
intl gcd(intl a, intl b){
    if(!b)return a;
    return gcd(b, a % b);
}
intl digit10(intl a){
    if(!a)return 1;
    intl b = 0;
    while(a){
        a /= 10;
        b++;
    }
    return b;
}
signed main(){
    cout << fixed << setprecision(10);
    string s,t;
    cin >> s;
    t = s;
    reverse(t.begin(),t.end());
    fp(s ==  t);
    return 0;
}

Measured memory_bytes: 256
import java.io.PrintWriter;
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = Integer.parseInt(sc.next());
        int b = Integer.parseInt(sc.next());
        int c = Integer.parseInt(sc.next());

        Set<Integer> colors = new HashSet<Integer>();
        colors.add(a);
        colors.add(b);
        colors.add(c);

        PrintWriter out = new PrintWriter(System.out);
        out.println(colors.size());
        out.flush();
        sc.close();
    }
}

Measured memory_bytes: 35696
#include <iostream>
#include <bits/stdc++.h>
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL)
#define ll long long
#define li long ll
#define pp pair<ll, ll> 
#define lb lower_bound
#define ub upper_bound
#define mk make_pair
#define pb push_back
#define llp(i, x, n) for (ll i = x; i < n; i++)
#define yes cout << "YES" << endl
#define no cout << "NO" << endl
#define fr first
#define ss second
using namespace std;
int mod=1e9+7;
int main()
{
	fast;
    int n,m;
    cin>>n>>m;
    vector<int> adj[n+1];
    while(m--)
    {
    	int u,v;
    	cin>>u>>v;
    	adj[u].pb(v);
    	adj[v].pb(u);
    }
    int c=0;
    bool vis[n+1];
    memset(vis,false,sizeof(vis));
    for(int i=1;i<=n;i++)
    {
    	if(vis[i]==false)
    	{
    		c++;
    		vis[i]=true;
    		queue<int> q;
    		q.push(i);
    		while(!q.empty())
    		{
    			int x=q.front();
    			q.pop();
    			for(auto it:adj[x])
    			{
    				if(vis[it]==false)
    				{
    					vis[it]=true;
    					q.push(it);
    				}
    			}
    		}
    	}
    }
    cout<<c-1<<endl;
}

Measured memory_bytes: 8920
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        final Scanner scanner = new Scanner(System.in);
        final int i = scanner.nextInt();
        final int i1 = scanner.nextInt();
        final int i2 = scanner.nextInt();

        System.out.println(i1 * (i2 / i));
    }

}

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

int main() {
  vector<int> a(4);
  vector<int> b(4);

  vector<int> n(4, 0);
  for (int i = 0; i < 3; i++) {
    cin >> a.at(i) >> b.at(i);
    
    n.at(a.at(i) - 1)++;
    n.at(b.at(i) - 1)++;
  }

  bool x = false;
  for (int i = 0; i < 3; i++) {
    if (n.at(i) > 2 || n.at(i) == 0) {
      cout << "NO" << endl;
      return 0;
    } else if (n.at(i) == 2) x = true;
  }
  if (x) cout << "YES" << endl;
  else cout << "NO" << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N;
  vector<string> S(N);  
  for(int i=0;i<N-1;i++){
  	cin >> S.at(i); 
  }
  for(int i=0;i<N;i++){
  	if(S[i]=="Y"){
      cout << "Four" << endl;
      break;
    }else if(i == N-1){
      cout << "Three" << endl;
      break;
    }
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
  int w, h;
    cin >> h >> w;
    char g[h*2][w], x;
      for(int i=0; i<h; i++){
        for(int j=0; j<w; j++){
           cin >> x;
           g[2*i][j] = x;
           g[2*i+1][j] = x;
         }
       }
      for(int i=0; i<2*h; i++){
        for(int j=0; j<w; j++) cout << g[i][j];
        cout << endl;
      }
}

Measured memory_bytes: 256