akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdio>
#include <cmath>

int main()
{
	long double x1, y1, x2, y2, xq, yq;
	
	while (scanf("%Lf,%Lf,%Lf,%Lf,%Lf,%Lf", &x1, &y1, &x2, &y2, &xq, &yq)==6) {
		long double theta = atan2(y2-y1, x2-x1);
		long double theta_q = atan2( (yq-y1), (xq-x1) );
		long double alpha = 2.0 * (theta - theta_q);
		long double x = cos(alpha) * (xq-x1) - sin(alpha) * (yq-y1) + x1;
		long double y = sin(alpha) * (xq-x1) + cos(alpha) * (yq-y1) + y1;
		std::cout << std::fixed << x << " " << y << std::endl;
	}
	return 0;
}



Measured memory_bytes: 3668
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define pb push_back
#define pp pop_back
#define mp make_pair
#define ff first
#define ss second
#define maxn 1000000007
#define PI 3.14159265358979323846
#define MAX 1000007 
using namespace std; 

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); 
    //cout<<fixed<<setprecision(20);
    ll n,d;
    cin>>n>>d;
    ll a[n][d];
    for (int i = 0; i < n; ++i)
    {
        for (int j = 0; j < d; ++j)
        {
            cin>>a[i][j];
        }
    }
    ll c=0;
    for (int i = 0; i < n; ++i)
    {
        for (int j = i+1; j < n; ++j)
        {
            ld dist=0;
            for (int k = 0; k < d; k++)
            {
                dist+=(pow(a[i][k]-a[j][k],2));
            }
            dist=sqrt(dist);
            //cout<<dist<<endl;
            if(dist==floor(dist))
            {
                c++;
            }
        }
    }
    cout<<c<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void){
    int i,j;
    char a[8][8]={0},ans;
    while(scanf(" %s",&a[0])!=EOF){
        i=1;
        while(i<8){
            scanf(" %s",a[i]);
            i++;
        }
        for(i=0;i<8;i++){
            for(j=0;j<8;j++){
                if(a[i][j]=='1'){
                    if(a[i][j+1]=='1' && a[i+1][j+1]=='1' && a[i+1][j]=='1')ans='A';
                    else if(a[i+3][j]=='1')ans='B';
                    else if(a[i][j+3]=='1')ans='C';
                    else if(a[i+2][j-1]=='1')ans='D';
                    else if(a[i][j+1]=='1' && a[i+1][j+2]=='1')ans='E';
                    else if(a[i+2][j+1]=='1')ans='F';
                    else if(a[i][j+1]=='1' && a[i+1][j-1]=='1')ans='G';
                    goto ANS;
                }
            }
        }
        ANS:
        printf("%c\n",ans);
    }
    END:
    return 0;
}

Measured memory_bytes: 540
using System;
using System.Collections.Generic;
using System.Linq;
class ilds1_6_b{
  public static void Main(){
    int n = int.Parse(Console.ReadLine());
    int[] num = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();
    int begin = 0;
    int end = 0;
    int comp = num[n-1];
    for(int i=0; i<n-1; i++){
      if(num[i] <= comp){
        int t = num[i];
        num[i] = num[begin];
        num[begin] = t;
        begin++;
        end++;
      }
      else{
        end++;
      }
    }
    int te = num[begin];
    num[begin] = num[n-1];
    num[n-1] = te;
    for(int i=0; i<n; i++){
      if(i == n-1){
        if(i == begin){
          Console.WriteLine("[{0}]",num[i]);
        }
        else{
          Console.WriteLine(num[i]);
        }
      }
      else{
        if(i == begin){
          Console.Write("[{0}] ",num[i]);
        }
        else{
          Console.Write("{0} ",num[i]);
        }
      }
    }
  }
}



Measured memory_bytes: 31744
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define pii pair<int,int>
#define pb push_back
#define fi first
#define se second
#define UP(a,b,c) for(ll (a)=(b);(a)<(c);(a)++)
#define UU(a,b,c) for(ll (a)=(b);(a)<=(c);(a)++)
#define DN(a,b,c) for(ll (a)=(b);(a)>(c);(a)--)
#define DU(a,b,c) for(ll (a)=(b);(a)>=(c);(a)--)
int DP[20005];
int main()
{
	int H,N,maximum=0;
	pii spell[1005];
	cin>>H>>N;
	UP(j,0,20005)
	{
		DP[j]=INT_MAX;
	}
	UP(i,0,N)
	{
		cin>>spell[i].fi>>spell[i].se;
		maximum=max(spell[i].fi,maximum);
	}
	DP[0]=0;
	UU(j,0,H+maximum)
	{
		UP(i,0,N)
		{
			if(spell[i].fi<=j&&DP[j-spell[i].fi]!=INT_MAX)
			{
				DP[j]=min(DP[j],DP[j-spell[i].fi]+spell[i].se);
			}
		}
	}
	int res=INT_MAX;
	UU(j,H,H+maximum)
	{
		res=min(res,DP[j]);
	}
	cout<<res<<endl;
	return 0;
}


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

long long N, K;
vector<long long> sumV(100001);

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout << setprecision(20) << fixed;

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


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

typedef ostringstream OSS;
typedef istringstream ISS;

typedef long long LL;
typedef pair<int, int> PII;

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
typedef vector<string> VS;
typedef vector<VS> VVS;
typedef vector<bool> VB;
typedef vector<VB> VVB;
typedef vector<PII> VPII;

#define fst first
#define snd second
#define MP make_pair
#define PB push_back
#define EB emplace_back 
#define ALL(x) (x).begin(),(x).end()
#define RANGE(x,y,maxX,maxY) (0 <= (x) && 0 <= (y) && (x) < (maxX) && (y) < (maxY))
#define DUMP( x ) cerr << #x << " = " << ( x ) << endl

template < typename T > inline T fromString(const string &s) { T res; ISS iss(s); iss >> res; return res; };
template < typename T > inline string toString(const T &a) { OSS oss; oss << a; return oss.str(); };

const int INF = 0x3f3f3f3f;
const LL INFL = 0x3f3f3f3f3f3f3f3fLL;
const int DX[]={1,0,-1,0},DY[]={0,-1,0,1};

int main(void) {
	int n;
	while (cin >> n, n) {
		VS qs(n);
		for (auto &q : qs) cin >> q;

		bool l = false, r = false, before = false;
		int cnt = 0;

		for (auto q : qs) {
			(q[0] == 'l' ? l : r) = q[1] == 'u' ? true : false;

			if (!l ^ r && l != before) {
				++cnt;
				before = l;
			}
		}

		cout << cnt << endl;
	}

	return 0;
}

Measured memory_bytes: 1220
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<cmath>
#include<cstdlib>
using namespace std;
#define ll long long
const int INF = 0x7fffffff;
const int N =1e9;

int main()
{
    ll i, j, k;
    ll n, m, t,s;
    ll count = 0;
    cin >> n>>k>>s;
    for (i = 0; i < k; i++)
        cout << s << " ";
    for (i = 0; i < n - k; i++)
    {
        if (s == N)cout << N - 1 << endl;
        else cout << N << endl;
    }
 
}

Measured memory_bytes: 1280
#include<iostream>
#include<algorithm>
#include<vector>
#include<set>
#define int long long
#define mod 1000000007
using namespace std;
int n, m;
int pt[123456], a[123456], ans;
set<int>s; vector<int>v[123456], v1;
void f() {
	for (int i = 0; i < n; i++)pt[i] = i;
	return;
}
int root(int i) {
	if (pt[i] == i)return i;
	else return pt[i] = root(pt[i]);
}
void unite(int a, int b) {
	pt[root(b)] = root(a);
	root(b);
	return;
}
signed main() {
	cin >> n >> m;
	if ((n - 1 - m) * 2 > n) {
		cout << "Impossible\n";
		return 0;
	}
	if (n - 1 == m) {
		cout << "0\n";
		return 0;
	}
	f();
	for (int i = 0; i < n; i++)cin >> a[i];
	for (int i = 0; i < m; i++) {
		int x, y; cin >> x >> y;
		unite(x, y);
	}
	for (int i = 0; i < n; i++) {
		s.insert(root(i));
		v[pt[i]].push_back(a[i]);
	}
	for (auto i = s.begin(); i != s.end(); i++) {
		sort(v[*i].begin(), v[*i].end());
		ans += v[*i][0];
		for (int j = 1; j < v[*i].size(); j++)v1.push_back(v[*i][j]);
	}
	sort(v1.begin(), v1.end());
	for (int i = 0; i < max((int)0, (int)((n - 1 - m) * 2 - s.size())); i++)ans += v1[i];
	cout << ans << endl;
}

Measured memory_bytes: 9856
n = int(input())
ls = list(map(int, input().split()))
ans = 0
while True:
    flag = False
    for i in range(n):
        if ls[i] % 2 != 0:
            flag = True
        else:
            ls[i] //= 2
    if flag:
        break
    ans += 1
print(ans)

Measured memory_bytes: 3060
#include <vector>
#include <iostream>
#include <set>
#include <unordered_map>


using namespace std;

class Graph {
    public:
        int N;
        int K;
        vector< vector<int> > edges;
        set<int> visited;
        vector<int> color_map;
        unordered_map<string, int> edge_map;


        Graph(int _N, vector< pair<int, int> >& inpairs){
            N = _N;

            edges.resize(N);
            for(int i = 0; i < N; i++) {
                edges[i] = vector<int>();
            }
            // cout << ("here") << endl;

            for(int i = 0; i < inpairs.size(); i++) {
                string key = to_string(inpairs[i].first) + "_" + to_string(inpairs[i].second);
                edge_map[key] = i;
                string key1 = to_string(inpairs[i].second) + "_" + to_string(inpairs[i].first);
                edge_map[key1] = i;
                edges[inpairs[i].first].push_back(inpairs[i].second);
                edges[inpairs[i].second].push_back(inpairs[i].first);
            }

            color_map.resize(N - 1, 0);
        }

        int get_order(){
            int K = 0;
            for(int i = 0; i < N; i++){
                if(K < edges[i].size()){
                    K = edges[i].size();
                }
            }

            return K;
        }


        void paint(){
            K = get_order();
            cout << K << endl;
            visit(0, 0);
            for(int i = 0; i < color_map.size(); i++){
                cout << color_map[i] << endl;
            }
        }


        void visit(int node, int from_color) {
            if (visited.find(node) != visited.end()) {
                return;
            }

            visited.insert(node);
            int color = 1;
            for(int i = 0; i < edges[node].size(); i++) {
                int child = edges[node][i];
                if (visited.find(child) != visited.end()) {
                    continue;
                }

                if (color == from_color){
                    color++;
                }
                string key = to_string(node) + "_" + to_string(child);
                int edge_id = edge_map[key];
                color_map[edge_id] = color;
                visit(child, color);
                color++;
            }
        }

};


int main(int argc, char** argv){
    int N;
    int a, b;
    cin >> N;
    vector< pair<int, int> > pairs;
    for(int i = 0; i < N - 1; i++){
        cin >> a >> b;
        pairs.push_back(make_pair<int, int>(a - 1, b - 1));
    }
    // cout << edges.size() << endl;

    Graph g = Graph(N, pairs);
    g.paint();

}


Measured memory_bytes: 27712
import java.util.*;
 
 
import java.io.*;
 
 
 
public class Main 
{   
	
	
	public static void main(String[] args) throws IOException 
	{ 
		 
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		PrintWriter pw=new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
		
		StringTokenizer s=new StringTokenizer(br.readLine());
		int n=Integer.parseInt(s.nextToken());
		s=new StringTokenizer(br.readLine());
		long ar[]=new long[n];
		for(int i=0;i<n;i++) {
			ar[i]=Integer.parseInt(s.nextToken());
		}
		
		long sum[][]=new long[n][n];
		sum[0][0]=ar[0];
		for(int i=1;i<n;i++) {
			sum[0][i]=sum[0][i-1]+ar[i];
		}
		for(int i=1;i<n;i++) {
			for(int j=i;j<n;j++) {
				sum[i][j]=sum[i-1][j]-sum[i-1][i-1];
			}
		}
		
//		for(int i=0;i<n;i++) {
//			for(int j=0;j<n;j++)
//				pw.print(sum[i][j]+" ");
//			pw.println();
//		}
			
		long dp[][]=new long[n][n];
		for(int d=1;d<n;d++) {
			
			int i=0;int j=d;
			while(j<n) {
				long ans=(long) 1e18;
				 for(int k = i;k<j;k++){ // Pivot
		                ans =  Math.min(ans,dp[i][k]+dp[k+1][j]+sum[i][j]);
		            }
		            dp[i][j] = ans;
		            i++;j++;	
			}
			
		}
		
		pw.print(dp[0][n-1]);
		
		pw.close();
		
	}
	
	
	
}

Measured memory_bytes: 35908
#include<iostream>

#include<cstdio>

using namespace std;

int main(){

  int a,b,x;

  char op;

  for( ; ; ){

    cin>>a>>op>>b;

    if(op=='+'){
      x=a+b;
    }else if(op=='-'){
      x=a-b;
    }else if(op=='*'){
      x=a*b;
    }else if(op=='/'){
      x=a/b;
    }
    else break;

    cout<<x<<endl;

  }




  return 0;
}

Measured memory_bytes: 3112
#include <set>
#include <cstring>
#include <cstdio>
#include <algorithm>
#define REP(i,n) for(int i=0; i<(int)(n); i++)

inline int getInt(){ int s; scanf("%d", &s); return s; }

using namespace std;

const int mod = 1000000007;
int a[10000 + 10];
int dp[200][10000 + 10];
int w, n;

int memo;
int solve(int pos, int rest){
  if(pos == n)
    return rest < a[memo] ? 1 : 0;

  if(dp[pos][rest] != -1)
    return dp[pos][rest];

  int ret = 0;
  if(pos >= memo)
    ret = (ret + solve(pos + 1, rest)) % mod;
  if(pos != memo && rest >= a[pos])
    ret = (ret + solve(pos + 1, rest - a[pos])) % mod;

  return dp[pos][rest] = ret;
}

int main(){
  int ans = 0;
  n   = getInt();
  w   = getInt();

  REP(i,n) a[i] = getInt();

  sort(a, a + n);


  int sum = 0;
  REP(i,n){
    memset(dp, -1, sizeof(dp));
    memo = i;
    ans = (ans + solve(0, w)) % mod;
    sum += a[i];
    if(sum > w) break;
  }
  if(sum <= w) ans++;
  if(ans == 0) ans = 1;

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

  return 0;
}

Measured memory_bytes: 8548
#include <stdio.h>

int main()
{
    int a, b, c;
    scanf("%d %d %d", &a, &b, &c);
    if ((a == b && a != c) || (a == c && b != a) || (b == c && a != b))
    {
        printf("Yes");
    }
    else
    {
        printf("No");
    }
}

Measured memory_bytes: 128
def get_prime_list(max)
  list = (2..max).to_a
  prime_list = []
  sqrt = max**0.5
  while val = list.shift
    prime_list << val
    if val > sqrt
      break
    end
    list.delete_if{|n| n%val==0}
  end
  return prime_list.concat(list)
end

def is_prime(num,list)
  if list.include?(num)
    return true
  else
    flag = true
    for p in list do
      if num%p==0
        flag = false
        break
      end
    end
    return flag
  end
end

list = get_prime_list(10000)
n = gets.chomp.to_i
count = 0
for i in 1..n do
  num = gets.chomp.to_i
  if is_prime(num,list)
    count += 1
  end
end
printf("%d\n",count)


Measured memory_bytes: 7052
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = 1e16;
const ll mod = 1000000007;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

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 ctoi(char c) {
  if (c >= '0' && c <= '9') {
    return c - '0';
  }
  return 0;
}
ll factorial(ll n) {
  if (n == 1) {
    return 1;
  }
  ll ans = factorial(n-1);
  return ans*n;
}
ll gcd(ll a, ll b) {
  if (b == 0) return a;
  return gcd(b, a%b);
}
ll lcm(ll a, ll b) {
  return (a/gcd(a, b))*b;
}
bool is_prime(ll n) {
  for (ll i = 2; i*i <= n; i++) {
    if (n%i == 0) return false;
  }
  return n != 1;
}
ll mod_pow(ll x, ll n, ll mod) {
  if (n == 0) return 1;
  ll res = mod_pow(x*x%mod, n/2, mod);
  if (n & 1) res = res * x % mod;
  return res;
}

int main() {
  ll n, m, l;
  cin >> n >> m >> l;
  vector <ll> a(n);
  vector <ll> b(m);
  ll min_a = INF, min_b = INF;
  rep(i, n) {
    cin >> a.at(i);
    min_a = min(min_a, a.at(i));
  }
  rep(i, m) {
    cin >> b.at(i);
    min_b = min(min_b, b.at(i));
  }
  ll res = min_a + min_b;
  rep(i, l) {
    ll x, y, z;
    cin >> x >> y >> z;
    res = min(res, a.at(x-1)+b.at(y-1)-z);
  }
  cout << res << endl;
}

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

int main() {
	long long n,k;
	cin >> n >> k;
	vector<long long> a(n);
	for(long long i=0;i<n;i++) cin >> a[i];
	for(long long i=0;i<k;i++){
		vector<long long>b(n+1,0);
		for(long long j=0;j<n;j++){
			long long l=max(0LL,j-a[j]);
			long long r=min(n,j+a[j]+1);
			b[l]++;
			b[r]--;
		}
		for(long long j=0;j<n;j++){
			b[j+1]+=b[j];
		}
		b.pop_back();
		if(a==b) break;
		a=b;
	}
	for(long long i=0;i<n;i++) cout << a[i] << " ";
	cout << endl;
}


Measured memory_bytes: 6428
#include<iostream>

int main()
{
    int a,b,c ;
    std::cin >> a >> b >> c;
    if (a==5 && b==5 && c==7){
      std::cout << "YES" << std::endl;
    }
    else if (a==5 && b==7 && c==5){
      std::cout << "YES" << std::endl;
    }
    else if (a==7 && b==5 && c==5){
      std::cout << "YES" << std::endl;
    }
    else {
      std::cout << "NO" << std::endl;

    }
    return 0;
}

Measured memory_bytes: 256
#include<iostream>

#include <vector>
#include <list>
#include<stack>
#include<queue>
#include<array>

#include <set>
#include<map>

#include<string>
#include<stdlib.h>

#include<algorithm>
#include <functional>
#include<math.h>

#include<fstream>
#include<iomanip>

using namespace std;
using ll = long long;
using ld = long double;
using pii = pair<int,int>;

#define FOR(k,m,n) for(ll (k)=(m);(k)<(n);(k)++)
#define REP(i,n) FOR((i),0,(n))
#define WAITING(str) int str;std::cin>>str;
#define DEBUGING(str) cout<<str<<endl

constexpr int INF = (1 << 30);
constexpr ll INFL = (1ll << 60);
constexpr ll MOD = 1000000007;// 10^9+7


//変数
ll D, G;
vector<ll> p, c;





//サブ関数
//入力
void input()
{
	cin >> D >> G;
	p.resize(D);
	c.resize(D);
	REP(i, D) {
		cin >> p[i] >> c[i];
	}
}

int all(int level)
{
	return (level + 1) * 100 * p[level] + c[level];
}

int count(const vector<int>& permu)
{
	int res = 0;
	int score = 0;
	for (auto level : permu) {
		if (score + all(level) < G) {
			score += all(level);
			res += p[level];
		}
		else {
			int need = ceil(1.*(G - score) / ((level + 1) * 100));
			if (need > p[level])return p[level] + res;
			else return max(0, need) + res;
		}
	}
}


//計算
void calc()
{
	int ans = INF;
	vector<int> permu;
	REP(i, D)permu.push_back(i);

	do {
		ans = min(ans, count(permu));
	} while (next_permutation(permu.begin(), permu.end()));
	cout << ans << endl;
}


//出力
void output()
{

}


//デバッグ
void debug()
{
	int N;
	cin>>N;
}


//メイン関数
int main()
{
	input();
	calc();
	output();
	debug();
	
	return 0;
}


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

using namespace std;
using ll=long long;
using ull=unsigned long long;
using pii=pair<int,int>;

#define INF LONG_MAX
#define MOD 1000000007
#define rng(a) a.begin(),a.end()
#define rrng(a) a.end(),a.begin()
#define endl "\n"

#define int ll

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

  string s,t;
  cin>>s>>t;
  vector<map<char,int>>ms(s.size()+1);
  bool ok=true;
  ms[s.size()-1][s[s.size()-1]]=1;
  for(int i=s.size()-1;i>0;i--){
    for(auto it:ms[i])ms[i-1][it.first]=++it.second;
    ms[i-1][s[i-1]]=1;
  }
  for(auto it:t)if(ms[0][it]==0)ok=false;
  if(!ok){
    cout<<-1<<endl;
    return 0;
  }
  int ans=0;
  int now=0;
  for(auto it:t){
    if(ms[now][it]>0){
      now+=ms[now][it];
    }
    else{
      ans++;
      now=0;
      now+=ms[now][it];
    }
  }

  cout<<ans*s.size()+now<<endl;
  return 0;
}


Measured memory_bytes: 170420
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
#define PI acos(-1)
typedef  long long ll;
ll gcd(ll x,ll y){
   if(y==0) return x;
   else return gcd(y,x%y);
}
ll lcm(ll x,ll y){
   return x/gcd(x,y)*y;
}
using namespace std;

int main(){
   int c[3][3];
   rep(i,3){
      rep(j,3){
         cin>>c[i][j];
      }
   }

   int a[3];
   int b[3];

   a[0]=0;
   b[0]=c[0][0]-a[0];
   a[1]=c[1][0]-c[0][0]+a[0];
   b[1]=c[0][1]-a[0];
   a[2]=c[2][0]-c[0][0]+a[0];
   b[2]=c[0][2]-a[0];

   bool f=true;

   rep(i,3){
      rep(j,3){
         if(a[i]+b[j]!=c[i][j]) f=false;
      }
   }
   f==true? cout<<"Yes":cout<<"No";

return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef long long ll;
typedef pair<int,int> pp;
const int INF = 1e9;
const int MOD = 1000000007;

 
int main() {
  int n,m;
  cin >> n >> m;
  vector<vector<int>> light(m,vector<int>(n,0));
  rep(i,m){
    int k;
    cin >> k;
    rep(j,k){
      int p;
      cin >> p;
      --p;
      light.at(i).at(p) = 1;
    }
  }
  vector<int> p(m);
  rep(i,m) cin >> p.at(i);
  
  
  int ans = 0;
  rep(i,pow(2,n)){
    vector<int> now(m);
    rep(j,n){
      if(i >> j & 1){
        rep(k,m){
          if(light.at(k).at(j) == 1) now.at(k) ++;
        }
      }
    }
    bool ok = 1;
    rep(j,m){
      if(now.at(j)%2 != p.at(j)){
        ok = 0;
        break;
      }
    }
    if(ok) ans ++;
  }
  cout << ans << endl;
        
  return 0;
}



Measured memory_bytes: 256
import numpy as np
from collections import defaultdict
from math import gcd
import time
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines


start = time.time()
# N, K = map(int, input().split(' '))
N = int(readline())
print(N*2*3.14)


Measured memory_bytes: 27108
#include<iostream>
#include<vector>
#include<limits>
#include<algorithm>

using namespace std;

int main(){
    int n, k;
    cin >> n >> k;
    vector<int> arr(n);
    for(int i=0;i<n;i++) cin >> arr[i];
    vector<int> dp(n, INT32_MAX);
    dp[0] = 0;
    for(int i=0;i<n-1;i++){
        for(int j=1;j<=k && i+j < n;j++){
            dp[i+j] = min(abs(arr[i] - arr[i+j]) + dp[i], dp[i+j]);
        }
    }
    cout << dp[n-1] << endl;
    return 0;
}

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

// エイリアス
using  ll = long signed long;
using ull = long unsigned long;
using  ld = long double;
using   P = pair<int, int>;
using llP = pair<ll, ll>;
using DoP = pair<double, double>;

// 汎用マクロ
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define FOREACH(i,q) for (auto &i : q)
#define UNIQUE(v) do { sort((v).begin(), (v).end()); (v).erase(unique((v).begin(), (v).end()), (v).end()); } while (false)
#define SZ(x) ((int)(x).size())
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;}
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 << 28;
const ll INF64 = 1ll << 60;
const int mod = 1000000007;
//const int mod = 998244353;
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()
{
  ll n, m; cin >> n >> m;
  ll fir = min(n, m/2);
  m -= 2*fir;
  ll sec = m/4;
  cout << fir+sec << endl;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> l_l;
typedef pair<int , int> i_i;
typedef vector<ll> vel;
typedef vector<int> vei;
typedef vector<char> vec;
typedef vector<bool> veb;
typedef vector<string> ves;
typedef vector<vector<ll>> ve_vel;
typedef vector<vector<int>> ve_vei;
typedef vector<vector<char>> ve_vec;
typedef vector<vector<bool>> ve_veb;
typedef vector<vector<string>> ve_ves;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define rep2(i,n) for(int i=2;i<(int)(n);i++)
#define repk(i,k,n) for(int i=k;i<(int)(n);i++)
#define fs first
#define sc second
#define pub push_back
#define pob pop_back
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define maxel(a) *max_element(all(a))
#define minel(a) *min_element(all(a))
#define acc accumulate
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define mod (1000000007)
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 (a>b) { a=b; return 1; } return 0; }

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

    int N; cin >> N;
    vei a(N); rep(i,N) cin >> a[i];

    ll cost = INF;
    for(int i = -100; i<=100; i++) {
        ll temp = 0;
        rep(j,N) {
            temp += (a[j] - i) * (a[j] - i);
        }
        cost = min(cost, temp);
    }
    cout << cost << endl;
    return 0;
}

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

//type
#define ll long long
typedef pair<int, int> P;
//定数
#define INF 1000000000000 //10^12:∞
#define MOD 1000000007    //10^9+7:合同式の法
#define MAXR 100000       //10^5:配列の最大のrange
//略記
#define PB push_back //挿入
#define MP make_pair //pairのコンストラクタ
#define F first      //pairの一つ目の要素
#define S second     //pairの二つ目の要素
#define Z class
// OTHER
// xの二乗を返す (関数テンプレート版)
template <typename T>
T square(T x) { return x * x; }
template <class T>
T GCD(T a, T b)
{
    T r;
    while (a)
        r = b, b = a, a = r % a;
    return b;
}
template <class T>
T LCM(T a, T b) { return a / GCD(a, b) * b; }

#define chmax(x, y) (x = max(x, y))
#define chmin(x, y) (x = min(x, y))
// loop
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define repe(i, n) for (ll i = 0; i <= (n); i++)
#define repd(i, n) for (ll i = n; i >= 0; i--)
#define FOR(i, a, b) for (ll i = a; i <= (b); i++)
#define FORD(i, a, b) for (ll i = a; i >= (b); i--)
#define FORA(i, I) for (const auto &i : I)

// vector
#define ALL(x) x.begin(), x.end()
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<vi> vvi;
typedef vector<ll> vl;
#define ERASE(x) x.erase(unique(ALL(x)), x.end()); // erase same elements
#define VEC(type, c, n)     \
    std::vector<type> c(n); \
    for (auto &i : c)       \
        std::cin >> i;

// input
#define INIT                          \
    std::ios::sync_with_stdio(false); \
    std::cin.tie(0);
#define VAR(type, ...) \
    type __VA_ARGS__;  \
    MACRO_VAR_Scan(__VA_ARGS__);
template <typename T>
void MACRO_VAR_Scan(T &t)
{
    std::cin >> t;
}
template <typename First, typename... Rest>
void MACRO_VAR_Scan(First &first, Rest &... rest)
{
    std::cin >> first;
    MACRO_VAR_Scan(rest...);
}

// output
template <typename T>
void MACRO_OUT(const T t) { std::cout << t; }

#define OUT(...) MACRO_OUT(__VA_ARGS__);
#define SP std::cout << " ";
#define TAB std::cout << "\t";
#define BR std::cout << "\n";
#define ENDL std::cout << std::endl;

#define YES() printf("YES\n")
#define NO() printf("NO\n")
#define isYES(x) printf("%s\n", (x) ? "YES" : "NO")
#define Yes() printf("Yes\n")
#define No() printf("No\n")
#define yes() printf("yes\n")
#define no() printf("no\n")
#define ln cout << '\n'
template <Z A>
void pr(A a)
{
    cout << a;
    ln;
}
template <Z A, Z B>
void pr(A a, B b)
{
    cout << a << ' ';
}

bool check = 0;
bool boo = 0;
ll minn = INF, maxx = 0;
int ans = 0;
string s, t;

int n;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
// cout << (conditon ? (result:  == 1 ): (==0)) << endl; <- output result of if
// long long 型が表せる値の上限はおよそ 9 × 10＾18 です．
int main()
{
    INIT;

    cin >> n;
    vi v(n);
    rep(i, n)
    {
        cin >> v[i];
    }
    rep(i, n - 2)
    {
        if ((v[i] < v[i + 1] && v[i + 1] < v[i + 2]) || (v[i] > v[i + 1] && v[i + 1] > v[i + 2]))
            ans++;
    }
    pr(ans);

    return 0;
}


Measured memory_bytes: 3596
fn read<T: std::str::FromStr>() -> T {
  let mut s = String::new();
  std::io::stdin().read_line(&mut s).ok();
  s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
  read::<String>().split_whitespace()
    .map(|e| e.parse().ok().unwrap()).collect()
}

fn read_vec2<T: std::str::FromStr>(n: u32) -> Vec<Vec<T>> {
  (0..n).map(|_| read_vec()).collect()
}

fn main() {
  let n: usize = read();
  let mut L: Vec<usize> = read_vec();

  L.sort_by(|a, b| a.cmp(b));

  let mut ans = 0;

  for i in 0..n-2 {
    for j in i+1..n-1 {
      let ab = L[i] + L[j];
      let mut l = j;
      let mut r = n;
      while r-l > 1 {
        let m = (l+r)/2;
        if ab > L[m] {
          l = m;
        } else {
          r = m;
        }
      }
      ans += l-j;
    }
  }

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

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

#define _USE_MATH_DEFINES
#include<cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <deque>
#include <algorithm>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <iterator>
#include<iomanip>

using namespace std;

#define rep(i,a,b) for(int i=(a), i##_len=(b);i<i##_len;i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)

#define int ll
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair

//typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<int, double> pid;
typedef pair<double, int> pdi;
typedef pair<double, double> pdd;
typedef vector< vector<int> > mat;

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

const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;

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

	int a, b, c;
	cin >> a >> b >> c;

	if (a + c == 2 * b)
	{
		cout << "YES" << endl;
	}
	else
	{
		cout << "NO" << endl;
	}

	return 0;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <functional>
#include <utility>
#include <tuple>
#include <cctype>
#include <bitset>
using namespace std;
#define INF 0x3f3f3f3f
#define INFLL 0x3f3f3f3f3f3f3f3fLL
#define MOD 1000000007
#define mp make_pair
#define mt make_tuple
#define pb push_back
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pint;
typedef pair<ll,ll> pll;
typedef tuple<int,int,int> tint;
typedef vector<int> vint;
typedef vector<ll> vll;
int dx[8]={0,0,-1,1,1,1,-1,-1};
int dy[8]={-1,1,0,0,1,-1,1,-1};
const int SIZE=500;
//ここまでテンプレ
int main(){
	int N,A;
	cin>>N>>A;
	if((N%500)<=A)
		cout<<"Yes"<<endl;
	else
		cout<<"No"<<endl;
	return 0;
}

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

int main(){
    int N, M;
    cin >> N >> M;
    int WACount[N], ACCount[N];
    for (int i = 0; i < N; i++) {
        WACount[i] = 0;
        ACCount[i] = 0;
    }
    for (int i = 0; i < M; i++){
        int p;
        string S;
        cin >> p >> S;
        p -= 1;
        if (S == "AC"s){
            ACCount[p] += 1;
        }else{
            if (ACCount[p] == 0){
                WACount[p] += 1;
            }
        }
    }
    int ac_count = 0;
    int penalty = 0;
    for (int i = 0; i < N; i++){
        if (ACCount[i] > 0){
            ac_count += 1;
            penalty += WACount[i];
        }
    }
    cout << ac_count << " " << penalty << endl;
    return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
int main(){
    while(1){
        int tmas = 1;
        int N,M;
        cin >> N;
        cin >> M;
        if(N == 0 && M == 0){
            break;
        }
        vector<int> mas;
        vector<int> dice;
        for(int i = 0;i < N;i++){
            int num;
            cin >> num;
            mas.push_back(num);
        }
        for(int i = 0;i < M;i++){
            int num;
            cin >> num;
            dice.push_back(num);
        }
        for(int i = 0;i < dice.size();i++){
            tmas+=dice[i];
            tmas+=mas[tmas-1];
            if(tmas >= mas.size()){
                cout << i+1 << endl;
                break;
            }
        }
    }
    return 0;
}

Measured memory_bytes: 3148
#include <limits.h>
#include <stdio.h>
#include <string.h>

int n, i, j;
long a;
int d[60][2];

int main(void){
	scanf("%d", &n);
	for(i=0; i<n; i++){
		scanf("%ld", &a);
		for(j=0; j<60; j++){
			if((a&((long)1<<j))==0){
				d[j][0]++;
			}else{
				d[j][1]++;
			}
		}
	}
	a = 0;
	for(j=59; j>=0; j--){
		a <<= 1;
		a += (long) d[j][0] * d[j][1];
		a %= 1000000007;
	}
	printf("%ld\n", a);
}



Measured memory_bytes: 128
package main

import (
	"fmt"
	"sort"
)

func main() {
	var deck int
	fmt.Scanf("%d", &deck)
	cards := make([]int, deck)
	for i := 0; i < deck; i++ {
		fmt.Scanf("%d", &cards[i])
	}
	cards = sortDesc(cards)

	var Alice int
	var Bob int
	for i := 0; i < len(cards); i++  {
		if i % 2 == 0 {
			Alice += cards[i]
		} else {
			Bob += cards[i]
		}
	}

	fmt.Printf("%d", Alice-Bob)
}

func sortDesc(number []int) []int {
	sort.Ints(number)
	for i := 0; i < len(number) / 2; i++ {
		tmp := number[i]
		number[i] = number[len(number)-1-i]
		number[len(number)-1-i] = tmp
	}
	return number
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0,i##_len=int(n);i<i##_len;++i)
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
#define All(x) (x).begin(),(x).end()
#define rAll(x) (x).rbegin(),(x).rend()
using namespace std;
using ll = long long;

int main(){
    int N,K,S;
    cin>>N>>K>>S;
    REP(i,N){
        if(K-->0){
            cout<<S<<" ";
        }
        else cout<<(S==1000000000?1:S+1)<<" ";
    }
}

Measured memory_bytes: 1280
#include<bits/stdc++.h>
using namespace std;
long long ans[1005];
int cnt;
long long calc(long long x)
{
	long long res=0;
	while(x)
	{
		res+=x%10;
		x/=10;
	}
	return res;
}
int main()
{
	long long now=1e15;
	now--;
	ans[cnt=1]=now;
	while(now)
	{
		long long bits=calc(now);int flag=0;
		for(long long j=1;!flag;j*=10)
		{
			for(int i=1;i<=9;i++) 
			{
				long long temp=now-(long long)i*j;
				if(temp*bits<=now*calc(temp)) {flag=1;now=temp;break;}
			}
		}
		if(now) ans[++cnt]=now;
	}
	sort(ans+1,ans+cnt+1);
	long long K;
	scanf("%lld",&K);
	for(int i=1;i<=K;i++) printf("%lld\n",ans[i]);
	return 0;
}

Measured memory_bytes: 256
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE BinaryLiterals #-}
{-# LANGUAGE MultiWayIf #-}
{-# LANGUAGE NumDecimals #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TupleSections #-}

import Control.Applicative
import Control.Arrow
import Control.Monad
import Control.Monad.ST

import Data.Char
import Data.List
import Data.Maybe

import qualified Data.ByteString.Char8 as B

import Data.Array.ST.Safe
import Data.STRef

import Debug.Trace
import Text.Printf

readInt = readLn :: IO Int
readInts = map ( fst . fromJust . B.readInt ) . B.words <$> B.getLine
readNInts = readInt >>= flip replicateM readInt

which a b f = if f then a else b
mp [ a, b ] = ( a, b )

main = do
	getLine
	hs <- readInts
	let
		maxs = scanl1 max hs
	print $ length $ filter id $ zipWith (==) hs maxs

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

typedef long long ll;

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

int main() {
    ll K, S, MOD = 1e9 + 7, ans = 0;
    string s;
    cin >> K >> s;
    S = s.size();
    //cout << "S=" << S << "\n";
    vector<ll> f(2000001, 1);
    rep(i, 2000000) f[i + 1] = (f[i] * (i + 1)) % MOD;
    rep(i, K + 1) {
        ll C = f[S + i - 1] * mod_pow(f[S - 1], MOD - 2, MOD);
        C %= MOD;
        C *= mod_pow(f[i], MOD - 2, MOD);
        C %= MOD;
        C *= mod_pow(25, i, MOD);
        C %= MOD;
        C *= mod_pow(26, K - i, MOD);
        C %= MOD;
        ans = (ans + C) % MOD;
        //cout << "ans=" << ans << "\n";
    }
    cout << ans << "\n";
}

Measured memory_bytes: 20008
#include <iostream>

using namespace std;

int main()
{
    int a, b, c;
    cin >> a >> b >> c;

    bool wakeUp = true;
    size_t count = 0;
    // 一周で 1 ずつずれる場合でも 60 周すれば元に戻るはずなので，3600
    // まで調べれば良い
    for (int i = 0; i <= 3600; ++i) {
        if (wakeUp) {
            if (i % 60 == c) {
                cout << i << endl;
                return 0;
            }
            if (count >= a) {
                wakeUp = false;
                count = 0;
            }
        }
        else {
            if (count >= b) {
                wakeUp = true;
                count = 0;
            }
        }
        count += 1;
    }
    cout << -1 << endl;
}


Measured memory_bytes: 3096
local mmi = math.min
local tins = table.insert
local rshift = bit.rshift
local n = io.read("*n", "*l")
local a, b = {}, {}
local av, bv = {}, {}
local alt_a, alt_b = {}, {}
local alt_av, alt_bv = {}, {}
do
  local str = io.read()
  for v in str:gmatch("%d+") do
    tins(a, tonumber(v))
  end
  str = io.read()
  for v in str:gmatch("%d+") do
    tins(b, tonumber(v))
  end
end
for i = 1, n do
  av[i], bv[i] = 0, 0
  alt_a[i], alt_b[i] = 0, 0
  alt_av[i], alt_bv[i] = 0, 0
end
local mul = 1
local ret = 0
for _state = 1, 29 do
  local a_src = _state % 2 == 1 and a or alt_a
  local av_src = _state % 2 == 1 and av or alt_av
  local a_dst = _state % 2 == 0 and a or alt_a
  local av_dst = _state % 2 == 0 and av or alt_av
  local b_src = _state % 2 == 1 and b or alt_b
  local bv_src = _state % 2 == 1 and bv or alt_bv
  local b_dst = _state % 2 == 0 and b or alt_b
  local bv_dst = _state % 2 == 0 and bv or alt_bv
  local a0c, b0c = 0, 0
  for i = 1, n do
    if a_src[i] % 2 == 0 then a0c = a0c + 1 end
    if b_src[i] % 2 == 0 then b0c = b0c + 1 end
  end
  local cur_a0, cur_b0, cur_a1, cur_b1 = 0, 0, 0, 0
  for i = 1, n do
    if a_src[i] % 2 == 0 then
      cur_a0 = cur_a0 + 1
      a_dst[cur_a0] = rshift(a_src[i], 1)
      av_dst[cur_a0] = av_src[i]
    else
      cur_a1 = cur_a1 + 1
      a_dst[a0c + cur_a1] = rshift(a_src[i], 1)
      av_dst[a0c + cur_a1] = av_src[i] + mul
    end
    if b_src[i] % 2 == 0 then
      cur_b0 = cur_b0 + 1
      b_dst[cur_b0] = rshift(b_src[i], 1)
      bv_dst[cur_b0] = bv_src[i]
    else
      cur_b1 = cur_b1 + 1
      b_dst[b0c + cur_b1] = rshift(b_src[i], 1)
      bv_dst[b0c + cur_b1] = bv_src[i] + mul
    end
  end

  local bp1, bp2, bp3 = n + 1, n + 1, n + 1
  local c1 = n * (n + 1)
  local c2, c3 = c1, c1
  for i = 1, n do
    local iav = av_dst[i]
    local bp3lim = mmi(n, bp3)
    for ib = bp3lim, 1, -1 do
      if mul * 3 <= bv_dst[ib] + iav then
        bp3 = ib
      else break end
    end
    local bp2lim = mmi(n, mmi(bp2, bp3))
    for ib = bp2lim, 1, -1 do
      if mul * 2 <= bv_dst[ib] + iav then
        bp2 = ib
      else break end
    end
    local bp1lim = mmi(n, mmi(bp1, bp2))
    for ib = bp1lim, 1, -1 do
      if mul <= bv_dst[ib] + iav then
        bp1 = ib
      else break end
    end
    c3 = c3 - bp3
    c2 = c2 - bp2
    c1 = c1 - bp1
  end
  if (c1 - c2 + c3) % 2 == 1 then
    ret = ret + mul
  end
  mul = mul * 2
end
print(ret)


Measured memory_bytes: 31004
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdio>
#include <string>
#include <vector>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <numeric>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <functional>
  
#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
  
using namespace std;
  
typedef    long long          ll;
typedef    unsigned long long ull;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      pii;
  
const int INF=1<<29;
const double EPS=1e-9;
  
const int dx[]={1,0,-1,0,1,1,-1,-1},dy[]={0,-1,0,1,1,-1,-1,1};


int main() {
    vector<vector<int>> C(3, vector<int>(3, 0));
    for (int i = 0; i < 3; i++) {
        for (int j = 0; j < 3; j++) {
            int a;
            cin >> a;
            C[i][j] = a;
        }
    }
    for (int i = 0; i < 3; i++) {
        int mi = INF;
        for (int j = 0; j < 3; j++) {
            mi = min(mi, C[i][j]);
        }
        for (int j = 0; j < 3; j++) {
            C[i][j] -= mi;
        }
    }

    for (int j = 0; j < 3; j++) {
        int mi = INF;
        for (int i = 0; i < 3; i++) {
            mi = min(mi, C[i][j]);
        }
        for (int i = 0; i < 3; i++) {
            C[i][j] -= mi;
        }
    }
    for (int i = 0; i < 3; i++) {
        for (int j = 0; j < 3; j++) {
            if (C[i][j] != 0) {
                cout << "No" << endl;
                return 0;
            }
        }
    }
    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(void){
    // Your code here!
    int N,H[20];
    scanf("%d",&N);
    int flag = 0, count = 0; 
    for(int i = 0; i < N; i++)
    {
        scanf("%d",&H[i]);
    }
    for(int i = 0; i < N; i++)
    {
        flag = 1;
        for(int j = i-1; j >= 0 && flag == 1; j--)
        {
            if(H[j] > H[i])
            {
                //printf("%d: %d de out\n",i,j);
                flag = 0;
            }
        }
        count += flag;
    }
    printf("%d\n",count);
}


Measured memory_bytes: 128
def sums(n):
    return(sum(list(map(int,[str(n)[i] for i in range(len(str(n)))]))))


n,a,b=map(int,input().split())
ans=0
for j in range(n+1):
    if sums(j)>=a and sums(j)<=b:
        ans+=j

print(ans)


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


int main()
{
    std::ios::sync_with_stdio(false);	
	int r,g,b;
	cin>>r>>g>>b;
	int sum = r*100+g*10+b;
	if(sum%4==0)
		cout<<"YES";
	else
		cout<<"NO";
    return 0;
}

Measured memory_bytes: 256
while True:
    m, f, r = map(int, input().split())
    if m == f == r== -1:
        break
    s = m + f
    if m == -1 or f == -1:
        print("F")
    elif s >= 80:
        print("A")
    elif s >= 65:
        print("B")
    elif s >= 50:
        print("C")
    elif s >= 30:
        if r >= 50:
            print("C")
        else:
            print("D")
    else:
        print("F")


Measured memory_bytes: 5596
#include <cstdio>
bool prime[60000];

int main(int argc, const char * argv[]) {
   
    
    int n;
    int cnt = 0;
    
    for(int i=2;i<=55555;i++){
        for(int j=i+i;j<=55555;j+=i){
            if(!prime[j]) prime[j] = true;
        }
    }
    
    scanf("%d",&n);
    
   // int ans = 0;
    for(int i=2;i<=55555;i++){
        if(!prime[i] && i%10 == 1){
           printf("%d ",i);
            cnt++;
           // ans += i;
        }
        if(cnt==n) break;
    }
    
    //printf("\n%d",ans);
    
  
    return 0;
}


Measured memory_bytes: 256
/**
 *   created: 13 July 2019  09:12:11
**/
#include<bits/stdc++.h>
using namespace std;

typedef vector<int> vi;
typedef pair<int , int> pii;
typedef vector< pair<int , int> > vii;
typedef long long ll;
typedef vector<long long> vl;
typedef pair<long long , long long> pll;
typedef vector< pair<long long , long long> > vll;

#define PB push_back
#define PPB pop_back
#define all(c) c.begin(),c.end()
#define rep(i,a,b) for(int i = (int)(a); i < (int)(b); i++)
#define rrep(i,a,b) for(int i = (int)(a-1); i>=(int)(b); i--)
#define INFLL 2000000000000000007
#define INF 2000000007
#define MOD 1000000007


#define TRACE

#ifdef TRACE
#define trace1(x)                cerr << #x << ": " << x << endl;
#define trace2(x, y)             cerr << #x << ": " << x << " | " << #y << ": " << y << endl;
#define trace3(x, y, z)          cerr << #x << ": " << x << " | " << #y << ": " << y << " | " << #z << ": " << z << endl;
#define trace4(a, b, c, d)       cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << endl;
#define trace5(a, b, c, d, e)    cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << endl;
#define trace6(a, b, c, d, e, f) cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << " | " << #f << ": " << f << endl;

#else

#define trace1(x)
#define trace2(x, y)
#define trace3(x, y, z)
#define trace4(a, b, c, d)
#define trace5(a, b, c, d, e)
#define trace6(a, b, c, d, e, f)

#endif


void optimizeIO()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
}

//                                        //AUTHOR: Kaushalesh Shukla

//=========================================================================================================


int main()
{
	optimizeIO();
	int tt=1;
	//cin>>tt;
	while(tt--){
		int n;
		cin>>n;
		vi v(n);
		rep(i,0,n)
			cin>>v[i];
		multiset<int> s;
		s.insert(v[0]);
		int res=1;
		rep(i,1,n){
			if(s.lower_bound(v[i])==s.begin()){
				s.insert(v[i]);
				res++;
			}
			else{
				s.erase(--s.lower_bound(v[i]));
				s.insert(v[i]);
			}
		}
		cout<<res;
	}
	return 0;
}


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

int main(){
    string s; cin>>s;
    cout << s[0] << s.size()-2 << s[s.size()-1] << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args ) {
		Scanner input = new Scanner(System.in);

		int A = input.nextInt();
		int B = input.nextInt();
		int C = input.nextInt();

		int K = input.nextInt();

		input.close();

		int aNum = 0;
		int bNum = 0;
		int cNum = 0;


		if(A < K ) {
			aNum = A;

			if(B < K - A) {

				bNum = B;

				cNum = K - A - B;

			}else {

				bNum = K - A;

			}

		}else {

			aNum = K;

		}

		System.out.println(aNum - cNum);

	}


}

Measured memory_bytes: 35820
#n = int(input())
#l = list(map(int, input().split()))

'''
A=[]
B=[]
for i in range():
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)'''


import sys
input = sys.stdin.readline
a, b, c = list(map(int, input().split()))
def sq(x):
    x**=2
    return x
#print(a**(1/2),b**(1/2),c**(1/2))
if c-a-b>0 and 2*(a*b+b*c+c*a)<sq(a)+sq(b)+sq(c):
    print("Yes")
else:
    print("No")

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

int main()
{
    int N;
    cin>>N;
    string grid[N];
    for(int i=0; i<N; i++){
        cin>>grid[i];
    }
    int ans = 0;
    for(int i=0; i<N; i++){
        bool check = true;
        for(int a=0; a<N; a++){
            for(int b=0; b<N; b++){
                int a1 = a-i;
                int b1 = b-i;
                while(a1<0)
                    a1+=N;
                while(b1<0)
                    b1+=N;
                if(grid[a1][b] != grid[b1][a])
                    check  = false;
            }
        }
        if(check){
            ans+=N;
        }
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 512
x,n = map(int, input().split(" "))
if n == 0:
  print(x)
else:  
  plist = list(map(int, input().split(" ")))
  s = 0
  while x+s in plist and x-s in plist:
    s += 1
  if x-s in plist:
    print(x+s)
  else:
    print(x-s)

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

using namespace std;

int main(){
  long long a, b, c, k;
  cin>>a>>b>>c>>k;

  if(a>=k) cout<<k<<endl;
  else if (a<k && a+b>=k) cout<<a<<endl;
  else if (a<k && a+b<k) cout<<a-(k-a-b)<<endl;
}


Measured memory_bytes: 3592