akhauriyash/Code-Regression huggingface dataset:
N = int(input())

for i in range(1,3500+1):
    for j in range(1,3500+1):
        h = i
        n = j
        
        low = 1
        high = 3500
        
        if N*n+N*h-4*h*n == 0:
            continue
        if N*h*n % (N*n+N*h-4*h*n) == 0:
            w = -N*h*n // (N*n+N*h-4*h*n)
            if w > 0:
                print(h,n,w)
                exit()
        


Measured memory_bytes: 41964
import java.util.*;
import static java.lang.System.*;

class Main {
  public static final int MOD = 1000000007;
  public static final int INF = 1000000000;
  public static void main(String[] args) {
    Scanner sc = new Scanner(in);
    int N = sc.nextInt();
    Integer A[] = new Integer[N];
    Integer B[][] = new Integer[N][2];
    Integer C[] = new Integer[N];
    for(int i=0; i<N; i++) A[i] = sc.nextInt();
    for(int i=0; i<N; i++) B[i][0] = sc.nextInt();
    for(int i=0; i<N; i++) C[i] = sc.nextInt();
    int number = 0;
    Arrays.sort(A, Comparator.reverseOrder());
    Arrays.sort(B, (a,b) -> Integer.compare(b[0], a[0]));
    Arrays.sort(C, Comparator.reverseOrder());
    for(int i=0; i<N; i++){
      while(number < N && C[number] > B[i][0]) number++;
      B[i][1] = number;
    }
    long ans = 0;
    number = 0;
    long tmp = 0;
    for(int i=0; i<N; i++){
      while(number < N && B[number][0] > A[i]){
        tmp += B[number][1];
        number++;
      }
      ans += tmp;
    }
    out.println(ans);
  }

  public static int gcd(int a, int b){
    if(b == 0) return a;
    return gcd(b, a%b);
  }
}

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

int main()
{
	int n, k, p[1000],sum=0;
	cin >> n >> k;
	for (int i = 0; i < n; i++) {
		cin >> p[i];
	}
	sort(p, p + n);
	for (int i = 0; i < k; i++) {
		sum += p[i];
	}
	cout << sum << endl;
}

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

int main() {
    int K, N;
    cin >> K >> N;
    vector<int> A(N+1, 0);
    for (int i = 0; i < N; i++) cin >> A[i];
    A[N] = A[0]+K;
    int ans = K;
    for (int i = 0; i < N; i++) ans = min(ans, K-(A[i+1]-A[i]));
    cout << ans << endl;
    return 0;
}

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

int main() {
    
  long n,i,x,max=0;
  cin >> n ;
  vector<int> s(n);
  map<int, long> ma;
  
  for (i =0;i< n; i++) {
    cin >> s[i];
    ma[s[i]]++;
  }
        
    for (auto y : ma)
        max += (y.second)*(y.second-1)/2;

    for(i=0;i<n;i++){
        x=(ma[s[i]]);
      cout << (max-(x*(x-1)/2)+((x-1)*(x-2)/2)) << endl;
    }
  return 0;
}

Measured memory_bytes: 10240
while 1:
	n, k, s = map(int,raw_input().split())
	if (n, k, s) == (0, 0, 0):
		break
	dp = [[0 for i in range(s)] for j in range(k)]
	ub = min(n+1,s+1)
	for x in range(1,ub):
		for j in range(k-1):
			for i in range(s-x):
				if dp[j+1][i] >= 1:
					dp[j][i+x] += dp[j+1][i]
		dp[k-1][x-1] = 1
	print dp[0][s-1]

Measured memory_bytes: 4248
#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<int,int>;
using LP=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;

const int INF=1e7;

int main() {
    int N;
    cin>>N;
    vector<vector<int>> S(N,vector<int>(N));
    rep(i,N)rep(j,N){
        char c;
        cin>>c;
        S.at(i).at(j)=c-'0';
    }
    vector<int> num(N);
    vector<vector<int>> to(N);
    rep(i,N){
        for(int j=i;j<N;j++){
            if(S.at(i).at(j)){
                to[i].pb(j);
                to[j].pb(i);
            }
        }
    }
    
    int pointa=0;
    int count=1;
    queue<int> q;
    while(pointa<N){
        if(num.at(pointa)){
            pointa++;
            continue;
        }
        num.at(pointa)=count;
        count++;
        q.push(pointa);
        while(!q.empty()){
            int v=q.front();q.pop();
            int x=num.at(v);
            x*=-1;
            for(int u:to[v]){
                if(num.at(u)==0){
                    num.at(u)=x;
                    q.push(u);
                }
                if(num.at(u)!=x){
                    cout<<-1<<endl;
                    return 0;
                }
            }
        }
        pointa++;
    }
    vector<vector<int>> group(count);//0はない
    rep(i,N){
        group.at(abs(num.at(i))).pb(i);
    }
    
    vector<vector<int>> dist(N,vector<int>(N));
    rep(i,N)rep(j,N){
        if(S.at(i).at(j)){
            dist.at(i).at(j)=1;
        }
        else dist.at(i).at(j)=INF;
    }
    rep(i,N){dist.at(i).at(i)=0;}
    int ans=0;
    for(int gr=1;gr<count;gr++){
        int grnum=group.at(gr).size();
        for(int i=0;i<grnum;i++){
            for(int j=0;j<grnum;j++){
                for(int k=0;k<grnum;k++){
                    int a=group.at(gr).at(i),b=group.at(gr).at(j),c=group.at(gr).at(k);
                    chmin(dist[b][c],dist[b][a]+dist[a][c]);
                }
            }
        }
        int siz=0;
        for(int i=0;i<grnum;i++){
            for(int j=0;j<grnum;j++){
                int a=group.at(gr).at(i),b=group.at(gr).at(j);
                chmax(siz,dist[a][b]);
            }
        }
        ans+=1+siz;
    }
    cout<<ans<<endl;
}

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

#define rep(i, n) for (int i = 0; i < n; ++i)
#define ALL(a) (a).begin(), (a).end()
#define rALL(a) (a).rbegin(), (a).rend()
#define SZ(x) ((int)(x).size())
using ll = long long;
using P = pair<int, int>;
using llP = pair<ll, ll>;
using DoP = pair<double, double>;
const int di[] = {0, 1, 0, -1, 1, 1, -1, -1};
const int dj[] = {1, 0, -1, 0, 1, -1, 1, -1};
const int INF = 1 << 29;
const ll INF64 = 1ll << 45;
const int mod = 1000000007;
//const int mod = 998244353;


template <class T>inline bool chmin(T &a, const T b)
{
  if (a > b)
  {
    a = b;
    return true;
  }
  return false;
}
template <class T>inline bool chmax(T &a, const T b)
{
  if (a < b)
  {
    a = b;
    return true;
  }
  return false;
}
template <class T>inline void line_out(const vector<T> vec) {
  int n = SZ(vec);
  rep(i, n) {
    cout << vec[i];
    if(i < n-1) cout << " ";
  }
  cout << endl;
  return;
}

struct mint
{
  ll x; // typedef long long ll;
  mint(ll x = 0) : x((x % mod + mod) % mod) {}
  mint operator-() const { return mint(-x); }
  mint &operator+=(const mint a)
  {
    if ((x += a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator-=(const mint a)
  {
    if ((x += mod - a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator*=(const mint a)
  {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const
  {
    mint res(*this);
    return res += a;
  }
  mint operator-(const mint a) const
  {
    mint res(*this);
    return res -= a;
  }
  mint &operator++()
  {
    if ((x += 1) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator--()
  {
    if ((x += mod - 1) >= mod)
      x -= mod;
    return *this;
  }
  mint operator*(const mint a) const
  {
    mint res(*this);
    return res *= a;
  }
  mint pow(ll t) const
  {
    if (!t)
      return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1)
      a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const
  {
    return pow(mod - 2);
  }
  mint &operator/=(const mint a)
  {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const
  {
    mint res(*this);
    return res /= a;
  }
};

int main()
{
  int n;
  string s;
  cin >> n >> s;
  int ans = 0;
  rep(q, n) {
    string t = s.substr(q, n-q);
    vector<int> a(SZ(t), 0);
    a[0] = SZ(t);
    int i = 1, j = 0;
    while(i < t.size()) {
      while(i+j < t.size() && t[j] == t[i+j]) ++j;
      a[i] = j;
      if(j == 0) {++i; continue;}
      int k = 1;
      while(i+k < t.size() && k+a[k] < j) a[i+k] = a[k], ++k;
      i += k; j -= k;
    }
    rep(k, t.size()) {
      chmax(ans, min(k, a[k]));
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 384
#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;

#define MAX 10000
#define INFTY (1 << 29)

//??????????´????????????????
class DisjoinSet {
public:
	vector<int> rank, p;

	DisjoinSet() {}

	//n????????????????´?????????????????????????
	DisjoinSet(int size) {
		rank.resize(size, 0);
		p.resize(size, 0);
		for (int i = 0; i < size; i++) {
			makeSet(i);
		}
	}

	void makeSet(int x) {
		p[x] = x;
		rank[x] = 0;
	}

	//?????????????´??????????????????????ture ??§???????????°false
	bool same(int x, int y) {
		return findSet(x) == findSet(y);
	}


	//x?????????????????¨y??????????????????????????????
	void unite(int x, int y) {
		link(findSet(x), findSet(y));
	}


	//??£??¨x?????¨??¨??£??¨y?????¨???????????????
	void link(int x, int y) {
		if (rank[x] > rank[y]) {
			p[y] = x;
		}
		else {
			p[x] = y;
			if (rank[x] == rank[y]) {
				rank[y]++;
			}
		}
	}


	//??¨(??????)?????£??¨?????????????????????????????§?????????????????????????????´??\??£??¨???????????????????????????
	int findSet(int x) {
		if (x != p[x]) {
			p[x] = findSet(p[x]);
		}

		return p[x];
	}

};

class Edge
{
public:
	int source, target, cost;//?§??????????????????????
	Edge(int source = 0,int target = 0,int cost = 0):
		source(source),target(target),cost(cost){}

	bool operator < (const Edge &e) const 
	{
		return cost < e.cost;
	}

};

//????????????????????¢?????´???????????§????°???¨?????¨????±????????????????????????????
int kruskal(int N, vector<Edge> edges)
{
	int totalCost = 0;
	sort(edges.begin(), edges.end());

	DisjoinSet dset = DisjoinSet(N + 1);

	for (int i = 0; i < N; i++) {
		dset.makeSet(i);
	}



	for (int i = 0; i < edges.size(); i++) {
		Edge e = edges[i];

		if (!dset.same(e.source, e.target)) {
			totalCost += e.cost;
			dset.unite(e.source,e.target);
		}

	}

	return totalCost;

}

int main(void)
{
	int N, M, cost;
	int source, target;

	cin >> N >> M;

	vector<Edge> edges;

	for (int i = 0; i < M; i++) {
		cin >> source >> target >> cost;
		edges.push_back(Edge(source, target, cost));
	}

	cout << kruskal(N, edges) << endl;
}

Measured memory_bytes: 5088
<?php

while ($stdin = fgets(STDIN)) {
    $line[] = trim($stdin);
}
foreach ($line as $key => $value) {
    $data[] = explode(' ', $value);
}

foreach ($data as &$line) {
    $line = array_map(function($val) { return (int)$val; }, $line);
}


$N = $data[0][0];
$C = $data[0][1];
$K = $data[0][2];

for ($i = 1; $i <= $N; $i++) {
    $T[$i] = $data[$i][0];
}
sort($T);

$bus = 0;
$startTime = null;
$tmpPeople = 0;
foreach ($T as $key => $time) {
    if (is_null($startTime)) {
        $startTime = $time;
    }
    $tmpPeople++;

    $nextKey = $key + 1;
    if ($tmpPeople === $C || !array_key_exists($nextKey, $T) || $T[$nextKey] - $startTime > $K) {
        $bus++;
        $startTime = null;
        $tmpPeople = 0;
    }
}

$ans = $bus;

printf('%d', $ans);


Measured memory_bytes: 58224
def main():
    n, height = getInputs()

    cost = [0] * n
    cost[1] = abs(height[0] - height[1])

    for i in range(2, n):
        cost[i] = min(
            cost[i - 1] + abs(height[i] - height[i - 1]),
            cost[i - 2] + abs(height[i] - height[i - 2])
        )

    print(cost[-1])

def getInputs():
    return int(input()), tuple(map(lambda x: int(x), input().split()))

main()


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

#define int long long
#define fastio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

using namespace std;

signed main(){
	fastio
	int n;
	cin >> n;
	int h[n];
	for(auto &x : h) cin >> x;
	int dp[n];
	memset(dp,0x3f3f3f,sizeof dp);
	dp[0] = 0;
	for(int i = 0;i < n;i++){
		if(i-1 >= 0) dp[i] = min(dp[i],dp[i-1]+abs(h[i]-h[i-1]));
		if(i-2 >= 0) dp[i] = min(dp[i],dp[i-2]+abs(h[i]-h[i-2]));
	}
	cout << dp[n-1] << "\n";
}

Measured memory_bytes: 5180
#include <iostream>
using namespace std ;
int main()
{
  int num ;
  
  cin >> num ;
  
  if(num == 100000){
    
   cout << 90909 << endl ;
  }
  else if(10000<= num && num<=99999){
    cout << num -10000 +1 +909 <<endl ;
  }
  else if(1000<=num && num<=9999){
    cout << 909 <<endl ;
  }
  else if(100<=num && num<=999){
    cout << num-100+1+9 <<endl ;
  }
  else if(10<=num && num<=99){
    cout << 9 <<endl ;
  }
  else if(1<=num && num<=9){
    cout << num <<endl ;
  }
  return 0 ;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<vector>
#define MAXN 100000
const int INF=1e9;
using namespace std;
vector<int> G[MAXN+5];
int d[MAXN+5],val[MAXN+5];
int L[MAXN+5],R[MAXN+5];
bool vis[MAXN+5];
void Init()
{
	memset(vis,0,sizeof(vis));
	for(int i=0;i<=MAXN+3;i++)
		L[i]=-INF,R[i]=INF;
}
bool DFS(int u,int fa,bool typ)
{
	if(vis[u]==true&&typ!=val[u]%2)
		return false;
	for(int i=0;i<G[u].size();i++)
	{
		int v=G[u][i];
		if(v==fa)
			continue;
		if(DFS(v,u,!typ)==false)
			return false;
	}
	return true;
}
bool DFS2(int u,int fa)
{
	if(vis[u]==true)
		L[u]=R[u]=val[u];
	for(int i=0;i<G[u].size();i++)
	{
		int v=G[u][i];
		if(v==fa)
			continue;
		if(DFS2(v,u)==false)
			return false;
		L[u]=max(L[v]-1,L[u]);
		R[u]=min(R[v]+1,R[u]);
	}
	if(L[u]>R[u])
		return false;
	return true;
}
void DFS3(int u,int fa,int vn)
{
	val[u]=vn;
	for(int i=0;i<G[u].size();i++)
	{
		int v=G[u][i];
		if(v==fa)
			continue;
		if(L[v]<=vn-1&&vn-1<=R[v])
			DFS3(v,u,vn-1);
		else 
			DFS3(v,u,vn+1);
	}
}
int main()
{
	Init();
	int n,u,v;
	scanf("%d",&n);
	for(int i=1;i<n;i++)
	{
		scanf("%d %d",&u,&v);
		G[u].push_back(v);
		G[v].push_back(u);
		d[u]++,d[v]++;
	}
	int mind=MAXN,rt,k;
	scanf("%d",&k);
	for(int i=1;i<=k;i++)
	{
		scanf("%d %d",&u,&v);
		val[u]=v;
		vis[u]=true;
		if(d[u]<mind)
			mind=d[u],rt=u;
	}
	if(DFS(rt,-1,val[rt]%2)==false)
		printf("No\n");
	else if(DFS2(rt,-1)==false)
		printf("No\n");
	else
	{
		DFS3(rt,-1,val[rt]);
		printf("Yes\n");
		for(int i=1;i<=n;i++)
			printf("%d\n",val[i]);
	}
	return 0;
}
/*
5
1 2
3 1
4 3
3 5
2
2 6
5 7

*/

Measured memory_bytes: 15872
S,c=map(int,input().split())
ans=0
if(c<=S*2):
    ans=c//2
elif(c>S*2):
    if(c-(2*S)<4):
        ans=S
    elif(c-(2*S)>=4):
        ans=S+((c-(S*2))//4)
print(ans)

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

#define DEBUG
#define int long long

int n;
bool s[123456];
bool o[123456];

bool test(){
    for(int i=2;i<n;i++){
        s[i] = s[i-1] ^ o[i-1] ^ s[i-2];
    }
    for(int i=0;i<n;i++){
        if((s[i]^o[i])!=(s[(n+i-1)%n]^s[(i+1)%n]))return 0;
    }
    return 1;
}

signed main(){
    cin>>n;
    for(int i=0;i<n;i++){
        char c;
        cin>>c;
        o[i]=(c=='o');
    }
    for(int k=3;k>=0;k--){
        s[0]=bool(k>>1);
        s[1]=bool(k&1);
        if(test()){
            for(int i=0;i<n;i++){
                cout<<(s[i]?'S':'W');
            }
            cout<<endl;
            return 0;
        }
    }
    cout<<(-1)<<endl;
    return 0;
}


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

int main(){
  vector<int> vec(3);
  for (int i = 0; i < vec.size(); i++){
    cin >> vec.at(i);
  }

  int five = 0;
  int seven = 0;

  for (int e : vec){
    if (e == 5) five += 1;
    if (e == 7) seven += 1;
  }

  cout << (five == 2 && seven == 1 ? "YES" : "NO") << endl;
}

Measured memory_bytes: 3628
fun main(args: Array<String>) {
  val N = readLine()!!.toInt()
  val L = readLine()!!.split(" ").map{it.toInt()}.toIntArray().sortedArray()
  if(L.last() < L.sum() - L.last() ) {
    println("Yes")
    return 
  }
    println("No")
}

Measured memory_bytes: 37868
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AtCoder
{
    class Program
    {
        private const int MODULO = 1000000007;
        private static string Read() { return Console.ReadLine(); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }

        static int Solve(string s)
        {
            int min = int.MaxValue;
            for (char c = 'a'; c <= 'z'; ++c)
            {
                int cnt;
                char[] S = s.ToArray();
                for (cnt = 0; S.Any(x => x != S[0]); ++cnt)
                {
                    char[] T = new char[S.Length - 1];
                    for (int i = 0; i < T.Length; ++i)
                    {
                        T[i] = (S[i] == c || S[i + 1] == c) ? c : S[i];
                    }
                    S = T;
                }
                min = Math.Min(cnt, min);
            }
            return min;
        }
        static void Main(string[] args)
        {
            Console.WriteLine(Solve(Read()));
        }
    }
}


Measured memory_bytes: 13268
n=int(input())

def f(x):
  m=int(x**(1/2))
  ret=set()
  for i in range(1,m+1):
    if x%i==0:
      ret.add(i)
      ret.add(x//i)
  return ret


ans=set()
for i in f(n):
  if i==1:
    continue
  g=n
  while g%i==0:
    g=g//i
  if g%i==1:
    ans.add(i)

for j in f(n-1):
  if j==1:
    continue
  if j in ans:
    continue
  ans.add(j)
  
print(len(ans))

Measured memory_bytes: 66280
#include <iostream>
#include<vector>
#include<algorithm>
#include<cstring>
#include<string>
#include <set>
#include <cassert>
#include<cmath>
#include<climits>
using namespace std;
#define MOD 1000000007
class UnionFind {
	vector<int> data;
public:
	UnionFind(int size) : data(size, -1) { }
	bool unionSet(int x, int y) {
		x = root(x); y = root(y);
		if (x != y) {
			if (data[y] < data[x]) swap(x, y);
			data[x] += data[y]; data[y] = x;
		}
		return x != y;
	}
	bool findSet(int x, int y) {
		return root(x) == root(y);
	}
	int root(int x) {
		return data[x] < 0 ? x : data[x] = root(data[x]);
	}
	int size(int x) {
		return -data[root(x)];
	}
};


int find(vector<long long> &arr, long long obj) {
	if (arr[arr.size() - 1] < obj)return arr.size()-1;
	if (arr[0] > obj)return -1;

	int min = 0; int max = arr.size() - 1;
	for (int i = 0; i < arr.size(); i++) {
		if (arr[min+(max-min) / 2] > obj) {
			max = min + (max - min) / 2;
		}
		else {
			min = min + (max - min) / 2;
		}
		if (max - min == 1) {
			return min;
		}
	}


}


int main() {
	int x, y;
	cin >> x >> y;
	cout << x + y / 2;



	return 0;
}


Measured memory_bytes: 256
/*
　　　　　　 ＿＿
　　　　　／＞　　 フ
　　　　　|   _　 _l
　 　　　／` ミ＿x ノ   Zzz..
　　 　 /　 　 　 |   コード見ちゃだめ！！
　　　 /　 ヽ　　  ﾉ
　 　 │　　|　|  |
　／￣|　　 |　|  |
　| (￣ヽ＿_ヽ_)_ _)
　＼二つ
*/

#include <bits/stdc++.h>
using namespace std;
#define SORT(a) sort((a).begin(), (a).end())
#define RSORT(a) reverse((a).begin(), (a).end())
#define REP(i, n) for (int i = 0; i < n; i++)
const int MOD = 1e9 + 7;
typedef long long ll;
const long long INF = 1LL << 60;
using Graph = vector<vector<int>>;

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

  // エラトステネスのふるい
  int MAX = 101010;
  vector<ll> is_prime(MAX, 1);
  is_prime[0] = 0, is_prime[1] = 0;
  for (int i = 2; i < MAX; ++i) {
    if (!is_prime[i]) continue;
    for (int j = i * 2; j < MAX; j += i) is_prime[j] = 0;
  }
  for (ll i = x; i <= 101010; i++) {
    if (is_prime[i]) {
      cout << i << endl;
      break;
    }
  }
}

Measured memory_bytes: 1024
#include<cstdio>
#include<iostream>
#include<string>
#include<vector>

using namespace std;

int main(void) {
	vector<string> s(3);

	int turn = 0;

	bool jud = false;

	for (int num = 0; num < 3; num++)
	{
		cin >> s.at(num);
	}

	/*for (int num = 0; num < 3; num++)
	{
		cout << s[num]<<"\n";
	}*/

	while (1) {
		if (jud == true)break;
		for (int num = 0; num < 3; num++)
		{
			if (turn == num) {
				//cout <<num<< char('A' + num) << "\n";
				if (s[num].size() == 0) {
					cout << char('A' + num) << "\n";
					jud = true;
					break;
				}

				for (int k = 0; k < 3; k++)
				{
					if (s[num][0] == 'a'+k) {
						turn = k;
						//printf("nextturn==%d\n", k);
					}
				}

				s[num].erase(s[num].begin());
				break;
			}
		}
	}

	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#define ROOP(N) for(int i=0; i<N; i++)
using namespace std;

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

	int* a;
	a = (int*)malloc(sizeof(int)*N);
	
	int max = 0;
	int min = 1000;
	ROOP(N){
		cin >> a[i];
		if (a[i] > max) max = a[i];
		if (a[i] < min) min = a[i];
	}

	cout << max - min;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
long long  ai[100005];
long long  bi[100005];
int main()
{
    int n;
    scanf("%d",&n);
    int su,j=0;
    long long sum=0;
    for(int i=0; i<n; i++)
    {
        int w;
        scanf("%lld",&ai[i]);
        if(i!=0)
            bi[i-1]=ai[i]-su;
        if(bi[i-1]<0) bi[i-1]=-bi[i-1];
        su=ai[i];
        sum+=bi[i-1];
    }
    int flag=0,flag1=0;
    for(int i=0; i<n; i++)
    {
        flag=0;flag1=0;
        if(i!=0&&i!=n-1)
        {
            int e=ai[i+1]-ai[i-1];
            if(ai[i+1]-ai[i-1]<0)  e=ai[i-1]-ai[i+1];
            if(ai[n-1]<0) {ai[n-1]=-ai[n-1];flag=1;}
            if(ai[0]<0) {ai[0]=-ai[0];flag1=1;}
            printf("%lld\n",sum-bi[i-1]-bi[i]+e+ai[n-1]+ai[0]);
             if(flag==1) ai[n-1]=-ai[n-1];flag=0;
            if(flag1==1) ai[0]=-ai[0];flag1=0;
        }
        if(i==0)
        {
            if(ai[n-1]<0) {ai[n-1]=-ai[n-1],flag=1;}
            if(ai[1]<0) {ai[1]=-ai[1],flag1=1;}
            printf("%lld\n",sum-bi[0]+ai[n-1]+ai[1]);
            if(flag==1) ai[n-1]=-ai[n-1];flag=0;
            if(flag1==1) ai[1]=-ai[1];flag1=0;
        }
        if(i==n-1)
        {
            if(ai[n-2]<0) {ai[n-2]=-ai[n-2],flag=1;}
            if(ai[0]<0) {ai[0]=-ai[0],flag1=1;}
            printf("%lld\n",sum-bi[n-2]+ai[n-2]+ai[0]);
            if(flag==1) ai[n-2]=-ai[n-2];flag=0;
            if(flag1==1) ai[0]=-ai[0];flag1=0;
        }
    }
    return 0;
}


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

int main() {
	long long N, a;
	int total = 0;
	cin >> N;
	for (int i = 0; i < N; i++) {
		cin >> a;
		while (a % 2 != 1) {
			a = a / 2;
			total++;
		}
	}
	cout << total << endl;
}

Measured memory_bytes: 3568
#!/usr/bin/env python3

(N, K) = map(lambda x: int(x), input().split(' '))
AL = [False for i in range(int(N))]
#print(AL)

for i in range(K):
    d = int(input())
    A = [i for i in map(lambda x: int(x) -1, input().split(' '))]
    for i in A:
        AL[i] = True
#print(AL)
print(len([1 for x in AL if x==False]))




Measured memory_bytes: 9220
#include<stdio.h>
int search(int [],int ,int);
int main(){
  int i,n,a[10000+1],q,judge,count=0;
  scanf("%d",&n);
  for(i=0;i<n;i++) scanf("%d",&a[i]);
  scanf("%d",&q);
  for(i=0;i<q;i++) {
    scanf("%d",&judge);
    if(search(a,n,judge))count++;
  }  
  printf("%d\n",count);
  return 0;
}

int search(int b[],int n,int key){
  int i=0;
  b[n]=key;
  while(b[i]!=key)i++;
  return i!=n;
}



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

int main() {

    int N;
    cin >> N;
    
    vector<tuple<string, int, int>> sp(N);
    
    for (int i=0; i<N; i++) {
        int p;
        cin >> get<0>(sp.at(i)) >> p;
        get<1>(sp.at(i)) = 100-p;
        get<2>(sp.at(i)) = i+1 ;
    }
    
    
    stable_sort(sp.begin(), sp.end()) ;
    
    
    cout <<endl;
    for (tuple<string, int, int> t : sp) {
        string x;
        int y, z;
        tie(x, y, z) = t;
        cout << z << endl;
    }

}


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

using namespace std;

int main  ()
{

 int a;
 int b;

 cin >> a;
 cin >> b;

 if(a*b%2==1)
 {
  cout<< "Odd" <<endl;
 }

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


return 0;

}


Measured memory_bytes: 256
#-*-coding:utf-8-*-
import sys
input=sys.stdin.readline

def main():
    n,a,b = map(int,input().split())
    a_count=0
    d,r=divmod(n,a+b)
    a_count+=a*d
    if r > a:
        a_count+=a
    else:
        a_count+=r
    print(a_count)

if __name__=="__main__":
    main()

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

int main() {
  char card[201], temp[201];
  int m, h;

  do {
    scanf("%s", card);
    if (strcmp(card, "-") != 0) {
      scanf("%d", &m);
      
      int k = 0;
      for (int i = 0; i < m; i++) {
        scanf("%d", &h);
        k = k + h;   
      }      

      int n = strlen(card);
      for (int i = 0; i < n; i++) {
        printf("%c", card[(k+i) % n]);
      }
      printf("\n");  
    }
  } while (strcmp(card, "-") != 0);

  return 0;
}


Measured memory_bytes: 2148
#include <cstdio>
#include <cstring>
#include <iostream>
using namespace std;
#define DEBUG(X) cerr<<__LINE__<<" "<<#X<<": "<<X<<endl;
#define sci(x) int x;scanf("%d",&x);
#define scii(x, y) int x,y;scanf("%d%d",&x,&y);
#define REP(i,y) for(int i=0;i<(int)(y);i++)
#define REPP(i,y) for(int i=1;i<=(int)(y);i++)

int main() {
  sci(N);
  sci(cr)
  bool up=0;
  bool dn=0;
  int ans=1;
  int A;
  REP(i,N-1) {
    scanf("%d",&A);
    if (A>cr) up=1;
    if (A<cr) dn=1;
    if(up && dn) up=dn=0, ans++;
    cr = A;
  }
  printf("%d\n", ans);
}

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

public class Main {
    private static final int MOD = (int) Math.pow(10, 9);

    public static void main(String[] args) {
        FastReader sc = new FastReader();
        int n = sc.nextInt();
        int m = sc.nextInt();
        int[] ac = new int[100001];
        int[] wa = new int[100001];

        for (int i = 0; i < m; i++) {
            int p = sc.nextInt();
            String s = sc.next();

            if (s.equals("AC")) {
                ac[p] = 1;
            } else {
                if (ac[p] == 0) {
                    wa[p]++;
                }
            }
        }

        int acCnt = 0;
        int waCnt = 0;
        for (int i = 1; i <= 100000; i++) {
            acCnt += ac[i];
            if (ac[i] == 1) {waCnt += wa[i];}
        }

        System.out.println(acCnt + " " + waCnt);

        System.exit(0);
    }

    static private long gcd(long m, long n) {
        if (m < n) { return gcd(n, m); }
        if (m % n == 0) { return n; }
        return gcd(n, m%n);
    }

    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

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

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

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

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

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

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


Measured memory_bytes: 45372
#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
int main() {
	ll N, A, B;
	cin >> N >> A >> B;
	ll X[N + 1];
	for (ll i = 0; i < N; i++) {
		cin >> X[i];
	}
	ll sum = 0;
	for (ll i = 1; i < N; i++) {
		ll K = (X[i] - X[i - 1])*A;
		if (K > B)sum += B;
		else sum += K;
	}
	cout << sum << endl;
}

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

int main(){
    int64_t i, j, k;
    int N;
    cin >> N;
    const int MAX = 100000;
    int64_t L[MAX], R[MAX];
    for(i=0; i<N; i++) cin >> L[i] >> R[i];

    int64_t ans = 0, loffset = 0, roffset = 0;
    multiset<int64_t> lpt, rpt;
    lpt.insert(L[0]);
    rpt.insert(L[0]);

    for(i=1; i<N; i++){
        loffset -= R[i] - L[i];
        roffset += R[i-1] - L[i-1];
        int64_t ledge = *prev(lpt.end()) + loffset;
        int64_t redge = *rpt.begin() + roffset;
        if(L[i] < ledge){
            ans += ledge - L[i];
            lpt.erase(prev(lpt.end()));
            rpt.insert(ledge - roffset);
            for(k=0; k<2; k++) lpt.insert(L[i] - loffset);
        }else if(redge < L[i]){
            ans += L[i] - redge;
            rpt.erase(rpt.begin());
            lpt.insert(redge - loffset);
            for(k=0; k<2; k++) rpt.insert(L[i] - roffset);
        }else{
            lpt.insert(L[i] - loffset);
            rpt.insert(L[i] - roffset);
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 11136
#include <iostream>
#define M_NUM 10000
using namespace std;

int main() {
	int A, B, K;
	cin >> A >> B >> K;

	for (int i=A;i<=B;i++) {
		if (A + K > i || B - K < i) {
			cout << i << endl;
		}
	}
	
	
	return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long int
#define pb push_back
#define pob pop_back
#define vl vector<ll>
#define mp make_pair
#define sz size()
#define fast ios::sync_with_stdio(0)
#define maxx 100005
#define edge pair<ll,ll>
using namespace std;


int main()
{
	string s;
	cin>>s;
	ll i;
	ll flag=0;
	for(i=0;i<2;i++)
	{
		if(s[i]!=s[i+1])
		{
			flag++;
		}
	}
	if(flag>0)
	cout<<"Yes";
	else
	cout<<"No";
}

Measured memory_bytes: 256
//code by lynmisakura.wish to be accepted!
/****************************/
#include<iostream>
#include<iomanip>
#include<math.h>
#include<vector>
#include<string>
#include<stack>
#include<queue>
#include<map>
#include<algorithm>
#include<bitset>
#include <climits>
#include<set>
#include<bitset>
using namespace std;
/***************************/
typedef long long ll;
typedef vector<int> vi;
typedef vector<long long> vl;
typedef pair<int, int> pi;
typedef vector<pair<int, int>> vpi;

const long long INF = 1LL << 55;

#define itn int
#define endl '\n'
#define pb push_back
#define mp make_pair
#define ss second
#define ff first
#define dup(x,y) ((x) + (y) - 1)/(y)
#define mins(x,y) x = min(x,y)
#define maxs(x,y) x = max(x,y)
#define all(x) (x).begin(),(x).end()
#define Rep(n) for(int i = 0;i < n;i++)
#define rep(i,n) for(int i = 0;i < n;i++)
#define rrep(i,n) for(int i = n - 1;i >= 0;i--)
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() )

ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
ll qp(ll a, ll b) { ll ans = 1; do { if (b & 1)ans = 1ll * ans*a; a = 1ll * a*a; } while (b >>= 1); return ans; }
ll qp(ll a, ll b, int mo) { ll ans = 1; do { if (b & 1)ans = 1ll * ans*a%mo; a = 1ll * a*a%mo; } while (b >>= 1); return ans; }

#define _GLIBCXX_DEBUG
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

int main(void){
   int n,k;cin >> n >> k;
   int c = 0;
   rep(i,n){
      int h;cin >> h;
      if(h >= k)c++;
   }
   cout << c << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i = a; i<b; i++)
#define dep(i,a,b) for(int i = a; i>b; i--)
#define makeUnique(vec) sort(all(vec)); vec.resize(unique(all(vec)) - vec.begin())
#define LOG_vec(vec, sep) for (int fl = 0; fl < vec.size(); fl++) { std::cout << vec[fl]<< sep; } std::cout << "\n"
#define LOG_ints(vec, sep) for (int fl = 0; fl < MAXSIZE; fl++) { std::cout << vec[fl]<< sep; } std::cout << "\n"
#define all(x) (x).begin(), (x).end()
#define ll long long
#define LSB(i) ((i) & -(i))
#define MAXSIZE 30

using namespace std;

int main() {
	int q, w;
	cin >> q >> w;
	vector<int> e;
	vector<int> r;
	rep(i, 0, w) {
		int tmp;
		cin >> tmp;
		e.push_back(tmp);
	}
	sort(all(e));
	rep(i, 0, w-1) {
		r.push_back(e[i + 1] - e[i]);
	}
	r.push_back(q - (e[w - 1]) + e[0]);
	sort(all(r));
	cout << q-r[w - 1];

	return 0;
}

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

using ll = long long;

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

    ll w,h;cin>>w>>h;
    ll x,y;cin>>x>>y;

    double s=w*h/2.0;
    int m=0;
    if(x*2==w&&y*2==h)m=1;

    printf("%.10lf %d",s,m);

    return 0;
}


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

int main(){
    int H, W;
    cin >> H >> W;
    while(1){
        if(H==0&&W==0) break;
        for(int i = 0; i < H; i++){
            if(i%2==0){
                for(int j = 0; j < W; j++){
                    if(j%2==0){
                        cout << "#";
                    }
                    else if(j%2==1){
                        cout << ".";
                    }
                }
            }
            else if(i%2==1){
                 for(int j = 0; j < W; j++){
                    if(j%2==1){
                        cout << "#";
                    }
                    else if(j%2==0){
                        cout << ".";
                    }
                }
            }
            cout << endl;
        }
        cout << endl;
        cin >> H >> W;
    }
    return 0;
}


Measured memory_bytes: 3092
#include<bits/stdc++.h>
#define ULL unsigned long long
#define LL long long
#define Max 15
#define mem(a,b) memset(a,(int)b,sizeof(a));
#define pb push_back
#define mp make_pair
const LL mod=1e9+7;
const ULL base=131;
const LL LL_MAX=9223372036854775807;
using namespace std;
int n,m;
int p[Max],c[Max],on[Max];
map<pair<int,int>,int>mm;
bool check(){
    mem(on,0);
    for(int i=n;i>=1;i--){
        if(c[i]){
            for(int j=1;j<=m;j++)
                if(mm[mp(j,i)]==1)
                    on[j]++;
        }
    }
    for(int i=1;i<=m;i++){
       // printf("%d %d %d\n",i,on[i],p[i]);
         if((on[i]%2)!=p[i])
            return 0;
    }

    return 1;
}
int fun(){
    int len=pow(2,n)-1,now,op,ans=0;
    for(int i=0;i<=len;i++){
        now=i;
        for(int j=n;j>=1;j--){
            op=now%2;
            now/=2;
            c[j]=op;
        }
       /* for(int i=n;i>=1;i--)
            printf("%d ",c[i]);
        printf("\n");*/
        if(check())
            ans++;
    }
    return ans;
}
int main()
{
    scanf("%d%d",&n,&m);
    int t,sw;
    for(int i=1;i<=m;i++){
        scanf("%d",&t);
        for(int j=0;j<t;j++){
            scanf("%d",&sw);
            mm[mp(i,sw)]=1;
        }
    }
    for(int i=1;i<=m;i++)
        scanf("%d",&p[i]);
    printf("%d\n",fun());
    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <stack>
#include <stdio.h>
#include <string>
#include <utility>
#include <vector>
using namespace std;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  FOR(i,0,n)
const double EPS = 1e-10;
const double PI  = acos(-1.0);
#define CLR(a) memset((a), 0 ,sizeof(a))
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << 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; }
bool compare_by_b(pair<LL, LL> a, pair<LL, LL> b) {
    if(a.second != b.second) return a.second < b.second;
    else return a.first < b.first;
}
std::uint32_t euclidean_gcd(std::uint32_t a, std::uint32_t b){return b != 0 ? euclidean_gcd(b, a % b) : a;}
void solve(long long a){
    cout<<a+a*a+a*a*a<<endl;
}
int main(){
    long long a;
    scanf("%lld",&a);
    solve(a);
    return 0;
}


Measured memory_bytes: 3720
#include<bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i) 
#define PI acos(-1)
#define pcnt __builtin_popcountll
#define rng(a) a.begin(), a.end()
#define sz(x) (int)(x).size()
#define v(T) vector<T>
#define vv(T) v(v(T))
#define fi first
#define se second

using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;

template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) {if (a > b) { a = b; return true; } return false; }

ll INF = 1001001001;
ll LINF = 1001001001001001001ll;

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

    ll n, d, a;
    cin>>n>>d>>a;
    vector<LP> xh(n);
    rep(i, n) cin>>xh[i].fi>>xh[i].se;
    sort(rng(xh));

    vl ds(n + 10);
    ll s = 0;
    ll ans = 0;
    rep(i, n) {
        s += ds[i];
        if (xh[i].se > s) {
            ll r = xh[i].se - s;
            ll c = r / a;
            if (r % a) c++;
            s += a * c;

            ll it = upper_bound(rng(xh), LP(xh[i].fi + 2 * d, LINF)) - xh.begin();
            ds[it] -= a * c;
            ans += c;
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 4992
def get_rank(s):
  if s < 400:
    return 0
  elif s < 800:
    return 1
  elif s < 1200:
    return 2
  elif s < 1600:
    return 3
  elif s < 2000:
    return 4
  elif s < 2400:
    return 5
  elif s < 2800:
    return 6
  elif s < 3200:
    return 7
  else:
    return 8

def resolve():
  n = int(input())
  a = list(map(int, input().split()))
  s = set()
  free = 0
  for score in a:
    rank = get_rank(score)
    if (rank == 8):
      free += 1
    else:
      s.add(rank)
  print(max(1, len(s)), len(s) + free)
  return

if __name__ == "__main__":
  resolve()


Measured memory_bytes: 3064
//============================================================================
// Name        : template.cpp
// Author      : 
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <bits/stdc++.h>
using namespace std;
#define _CRT_SECURE_NO_DEPRECATE // suppress some compilation warning messages (for VC++ users)
// Shortcuts for "common" data types in contests
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef set<int> si;
typedef map<string, int> msi;
// To simplify repetitions/loops, Note: define your loop style and stick with it!
#define x first
#define y second
#define pb push_back
#define mp make_pair
#define REP(i, a, b) \
for (int i = int(a); i <= int(b); i++) // a to b, and variable i is local!
#define forn(i,n) \
for (int i =0; i<(n); i++)
#define TRvi(c, it) \
for (vi::iterator it = (c).begin(); it != (c).end(); it++)
#define TRvii(c, it) \
for (vii::iterator it = (c).begin(); it != (c).end(); it++)
#define TRmsi(c, it) \
for (msi::iterator it = (c).begin(); it != (c).end(); it++)
#define INF 2000000000 // 2 billion
// If you need to recall how to use memset:
#define MEMSET_INF 127 // about 2B
#define MEMSET_HALF_INF 63 // about 1B
//memset(dist, MEMSET_INF, sizeof dist); // useful to initialize shortest path distances
//memset(dp_memo, -1, sizeof dp_memo); // useful to initialize DP memoization table
//memset(arr, 0, sizeof arr); // useful to clear array of integers

int main() {
	ios::sync_with_stdio(false);
 cin.tie(0);
 int n; 
 cin >> n;
 if(n >= 30) cout <<"Yes\n";
 else cout << "No\n";
return 0;
}


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

int main(){
	int n, k;
	cin >> n >> k;
	vector<int> v(n);
	for(int i = 0; i < n; i++)cin >> v[i];
	sort(v.rbegin(), v.rend());

	int ans = 0;
	for(int i = 0; i < k; i++)ans += v[i];

	cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <math.h>
#include <complex>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <unordered_map>
#include <set>
#include <bitset>
#include <functional>
#include <assert.h>
#define int long
#define ll long long
#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define eb emplace_back
#define all(x) x.begin(),x.end()
#define SZ(x) x.size()
#define fi first
#define se second
const int INF = 1e9;
using namespace std;

template<class t> using vc=vector<t>;
template<class t> using vvc=vc<vc<t>>;

using pi=pair<int,int>;
using vi=vc<int>;

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


int f(int b,int n){
    if(n<b) return n;
    else return f(b,n/b)+n%b;
}
signed main() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout<<fixed<<setprecision(20);

    string S; cin >> S;
    int N=SZ(S);
    if(N==1){
        cout << "YES" << endl;
    }
    else if(N==2){
        if(S[0]!=S[1]) cout << "YES" << endl;
        else cout << "NO" << endl;
    }
    else {
        map<char,int> m;
        rep(i,N){
            m[S[i]]++;
        }
        bool frag=true;
        if(m.size()<3) frag=false;
        for(auto a:m){
            if(a.se!=N/3 && a.se!=N/3+1){
                frag=false;
            }
        }
        if(frag) cout << "YES" << endl;
        else cout << "NO" << endl;
    }

    
}


Measured memory_bytes: 512
import java.math.BigInteger;
import java.util.Scanner;

public class Main {
	void run(){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		while(n-- != 0){
			BigInteger a = sc.nextBigInteger();
			BigInteger b = sc.nextBigInteger();
			BigInteger c = a.add(b);
			if(c.toString().length() > 80){
				System.out.println("overflow");
			}
			else{
				System.out.println(c);
			}
		}
	}
	public static void main(String[] args) {
		new Main().run();	
	}
}

Measured memory_bytes: 18436
import java.util.*;

public class Main {
 public static void main(String[] args) {
  Scanner scanner = new Scanner(System.in);
   int i = 1;
   while (true) {
            int x = scanner.nextInt();
            if (x == 0) {
             break;
            }
            System.out.println("Case " + i + ": " + x);
            i++;
   }
 }
}



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

int main() {
 int n;
 cin >> n;
 
if(n == 1) {
 cout << 0;
 } else {
  cout << 1;
  }


}

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

signed main(){
  int n;cin>>n;
  vector<int> v(n);
  for(int i=0;i<n;i++)cin>>v[i];
  map<int,int> m;
  for(int i=0;i<n;i++)m[v[i]];
  int cnt=0;
  for(auto &p:m)p.second=cnt++;
  for(int i=0;i<n;i++)v[i]=m[v[i]];
  int ans=0;
  for(int i=0;i<n;i++)if((v[i]+i)&1)ans++;
  cout<<ans/2<<endl;
}


Measured memory_bytes: 5376
#include<stdio.h>

int main(){
    int W, H, x, y, r;
    scanf("%d", &W);
    scanf("%d", &H);
    scanf("%d", &x);
    scanf("%d", &y);
    scanf("%d", &r);
    if (0 <= x-r && x+r <= W && 0 <= y-r && y+r <= H) {
        printf("Yes\n");
    } else {
        printf("No\n");
    }
    return 0;
}


Measured memory_bytes: 2084
x=int(input())
#n,m=map(int,input().split())
#pl=list(map(int,input().split()))
#l=[list(map(int,input().split())) for i in range(n)]
import math

while True:
    flag=True
    for i in range(2,int(math.sqrt(x))+1):
        if x%i==0:
            flag=False
            break    
    if flag:
        break
    else:
        x+=1
print(x)



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

int A[100], N;

int bubbleSort();
void trace();

int main() {
  cin >> N;
  for (int i = 0; i < N; ++i) { cin >> A[i]; }
  
  int count = bubbleSort();
  trace();
  cout << count << "\n";
  
  return 0;
}

// sort
int bubbleSort() {
  unsigned char flag = 1;
  int count = 0;
  while (flag) {
    flag = 0;
    for (int j = N - 1; j > 0; --j) {
      if (A[j] < A[j - 1]) {
        flag = 1; count++;
        int t = A[j];
        A[j] = A[j - 1];
        A[j - 1] = t;
      }
    }
  }
  return count;
}

// print
void trace() {
  for (int i = 0; i < N; ++i) {
    if (i) { cout << " "; }
    cout << A[i];
  }
  cout << "\n";
}

Measured memory_bytes: 1164
package main

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

var sc, wr = bufio.NewScanner(os.Stdin), bufio.NewWriter(os.Stdout)

func scanString() string   { sc.Scan(); return sc.Text() }
func scanRunes() []rune    { return []rune(scanString()) }
func scanInt() int         { a, _ := strconv.Atoi(scanString()); return a }
func scanInt64() int64     { a, _ := strconv.ParseInt(scanString(), 10, 64); return a }
func scanFloat64() float64 { a, _ := strconv.ParseFloat(scanString(), 64); return a }

func scanInts(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = scanInt()
	} 
	return res
}

func debug(a ...interface{}) { fmt.Fprintln(os.Stderr, a...) }

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}
func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

//•*¨*•.¸¸♪main•*¨*•.¸¸♪(　-ω-)ノ　(　・ω・)
func main() {
	defer wr.Flush()
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 10000), 1001001)

	n := scanInt()
	m := scanInt()
	as := scanInts(n)

	sum := 0
	for i := 0; i < n; i++ {
		sum += as[i]
	}

	t := float64(sum)/float64(4*m)
	c := 0

	for i := 0; i < n; i++ {
		if t <= float64(as[i]) {
			c++
		}
	}

	if c < m {
		fmt.Fprintln(wr, "No")
	} else {
		fmt.Fprintln(wr, "Yes")
	}
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep_range(i, s, e) for (int i = (s); i < (int)(e); i++)
#define rep_rev(i, s, e) for (int i = (s)-1; i >= (int)(e); i--)
#define sort_vec(v) sort((v).begin(),(v).end())
typedef int64_t lint;
// lint mod = 998244353;
template< typename T1, typename T2 >
inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template< typename T1, typename T2 >
inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

int app() {
  int n,m,x;
  cin>>n>>m>>x;

  vector<int> c(n);
  vector<vector<int>> a(n,vector<int>(m));
  rep(i,n){
    cin>>c[i];
    rep(j,m){
      cin>>a[i][j];
    }
  }

  int pmax=1<<n;
  vector<int> score(m);
  int cost;
  int mincost=1e9;
  rep(p,pmax){
    rep(j,m) score[j]=0;
    cost=0;
    rep(i,n){
      if((1<<i)&p){
        cost+=c[i];
        rep(j,m) score[j]+=a[i][j];
      }
    }

    bool flag=true;
    rep(j,m){
      if(score[j]<x) flag=false;
    }
    if(flag){
      chmin(mincost, cost);
    }
  }

  return (mincost<1e9) ? mincost : -1;
}

int main(){cout<<app()<<endl;return 0;}


Measured memory_bytes: 3636
N = int(input())
A = list(map(int,input().split()))

ans = 0

dic = {}
for i in range(N):
    temp = i + A[i]
    if temp in dic:
        dic[temp] += 1
    else:
        dic[temp] = 1
        
for i in range(N):
    temp = i - A[i]
    if temp in dic:
        ans += dic[temp]

print(ans)

Measured memory_bytes: 118780