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

#define sz(v) ((int)(v).size())
#define all(v) (v).begin(), (v).end()

using namespace std;

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

const int N = 6e5 + 5;

int s[4 * N];
void update(int i, int l, int r, int p, int v) {
  if (l > p || r < p) {
    return;
  }
  if (l == p && l == r) {
    s[i] = max(s[i], v);
    return;
  }
  int m = (l + r) / 2;
  update(i * 2, l, m, p, v);
  update(i * 2 + 1, m + 1, r, p, v);
  s[i] = max(s[i * 2], s[i * 2 + 1]);
}

int get_max(int i, int l, int r, int L, int R) {
  if (l > r || l > R || L > r) {
    return 0;
  }
  if (L <= l && r <= R) {
    return s[i];
  }
  int m = (l + r) / 2;
  return max(get_max(i * 2, l, m, L, R), get_max(i * 2 + 1, m + 1, r, L, R));
}

int n, k, a[N], f[N];

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  int mn = 3e5 + 1;
  cin >> n >> k;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    a[i] ++ ;
  }
  int ans = 0;

  for (int i = 1; i <= n; i++) {
    int cur = get_max(1, 1, mn, max(1, a[i] - k), min(mn, a[i] + k)) + 1;
    ans = max(ans, cur);
    update(1, 1, mn, a[i], cur);
  }

  cout << ans << "\n";

  // int tmp = 0;
  // for (int i = 1; i <= n; i++) {
  //   int cur = 0;
  //   for (int j = max(1, a[i] - k); j <= min(mn, a[i] + k); j++) {
  //     cur = max(cur, f[j]);
  //   }
  //   f[a[i]] = cur + 1;
  //   tmp = max(tmp, f[a[i]]);
  // }
  // assert(tmp == ans);
}


Measured memory_bytes: 8920
#pragma comment (linker, "/STACK:256000000")
#define  _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream>
#include <random>
#include<map>
#include <iomanip>
#include <time.h>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include<fstream>
#include <unordered_map>
#include <cstdlib>
#include <complex>
#include <cctype>
#include <bitset>
using namespace std;
typedef string::const_iterator State;
#define Ma_PI 3.141592653589793
#define eps 1e-5
#define LONG_INF 2000000000000000000LL
#define GOLD 1.61803398874989484820458
#define MAX_MOD 1000000007LL
#define GYAKU 500000004LL

#define MOD 998244353LL
#define seg_size 262144*2
#define pb push_back
#define mp make_pair
typedef long long ll;
#define REP(a,b) for(long long a = 0;a < b;++a)
#define ALL(x) (x).begin(),(x).end()
void init() {
    iostream::sync_with_stdio(false);
    cout << fixed << setprecision(20);
}
unsigned long xor128() {
    static unsigned long x = 123456789, y = 362436069, z = 521288629, w = 88675123;
    unsigned long t = (x ^ (x << 11));
    x = y; y = z; z = w;
    return (w = (w ^ (w >> 19)) ^ (t ^ (t >> 8)));
}
#define int ll
void solve(){
    int x;
    cin >> x;
    for (int i = x;; ++i) {
        int ok = 1;
        for (int q = 2; q <= sqrt(i); ++q) {
            if (i % q == 0) ok = 0;
        }
        if (ok == 1) {
            cout << i << endl;
            return;
        }
    }
}
#undef int
int main() {
    init();
    solve();
}


Measured memory_bytes: 256
#include<iostream>
#include <algorithm>
#include<string>
#include <bitset>
#include <vector>
#include <functional>
#include <climits>
#include <iomanip>
#include <utility>
#include <stack>
#include <queue>
#include <math.h>
#include <iomanip>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <numeric>
#include <stack>
typedef std::stack<int> IntStack;
typedef std::stack<char> charStack;

using namespace std;
using ll = long long;
typedef pair <int, int> pii;
int main()
{
	ll a = 0, b = 0, c = 0, d = 0, e = 0, f = 0, g = 0, h = 0, ans = 0;
	ll n, m;
	char tmp;
	ll memo[1003][1003] = { {} };
	ll memox[1003] = {};
	ll memoy[1003] = {};
	ll x[1000006] = {};
	ll y[100005] = {};
	ll z[100005] = {};
	string s;
	//IntStack yStack;
	//charStack Stack;
	cin >> a;
	for (int i = 0; i < a; i++)
	{
		cin >> x[i];
	}
	for (int i = 0; i < a; i++)
	{
		while (true)
		{
			if (y[i]<x[i])
			{
				for (int k = i; k < a; k++)
				{

					if (y[k]>=x[k])
					{
						break;
					}
					y[k]++;
				}
				ans++;
			}
			else
			{
				break;
			}
		}
	}


	cout << ans  << endl;

	////std::cout << std::fixed;
	//cout << std::setprecision(20) << << endl;
	//cout << d+1 << endl;
	//cout << "" << endl;

	return 0;
}
//char型の文字数字は、-'0'で数値に変換できる
//accumulate(x, x + a, 0);//int型までの配列の合計
//memcpy(x, visited, sizeof(ll)*n);
//void kansuu(ll num, ll visited[10]) {}
//kansuu(1, zz);
//cout << setprecision(15) << v << endl;
//cout << char(z - 'a');
//log10(i) + 1 //10進数の桁数を取得

//int temp;
//for (int i = 0; i < n - 1; i++) {
//	for (int j = n - 1; j > i; j--) {
//		if (w[j - 1] < w[j]) {  /* 前の要素の方が大きかったら */
//			temp = w[j];        /* 交換する */
//			w[j] = w[j - 1];
//			w[j - 1] = temp;
//		}
//	}
//}

//最小公倍数
//ll x = a * b;
//ll tmp;
///* 自然数 a > b を確認・入替 */
//if (a<b) {
//	tmp = a;
//	a = b;
//	b = tmp;
//}
///* ユークリッドの互除法 */
//ll r = a % b;
//while (r != 0) {
//	a = b;
//	b = r;
//	r = a % b;
//}
//a = x / b;//答え

Measured memory_bytes: 8832
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <climits>
#include <random>
#include <iomanip>

using namespace std;
using P = pair<int, int>;

typedef long long int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

#define fillInt(xs, x)        \
  for (int i = 0; i < (x); i++) \
    scanf("%d", &xs[i]);
#define fillLong(xs, x)       \
  for (int i = 0; i < (x); i++) \
    scanf("%ld", &xs[i]);
#define fillString(xs, x)       \
  for (int i = 0; i < (x); i++) \
    cin >> xs[i];
#define sortv(xs) sort(xs.begin(), xs.end())
#define sortvdi(xs) sort(xs.begin(), xs.end(), std::greater<long>())
#define lbv(xs, x) lower_bound(xs.begin(), xs.end(), x) - xs.begin()
#define ubv(xs, x) upper_bound(xs.begin(), xs.end(), x) - xs.begin()
#define bs(xs, x) binary_search(xs.begin(), xs.end(), x)

#define rep(i,n) for(auto i=0; i<(n); i++)

const int mod = 1000000007;


struct UnionFind {
    vector<ll> par;

    UnionFind(ll N) : par(N) {
        for(int i = 0; i < N; i++) par[i] = i;
    }

    ll root(ll x) {
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(ll x, ll y) {
        ll rx = root(x);
        ll ry = root(y);
        if (rx == ry) return;
        par[rx] = ry;
    }

    bool same(ll x, ll y) {
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};

const int MAX_C = 30;
const int MAX_N = 500;

int d[MAX_C][MAX_C];
int C[MAX_N][MAX_N];

int cnts[3][MAX_C];

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

  int n, c;
  cin >> n >> c;

  rep(i, c) {
    rep(j, c) {
      cin >> d[i][j];
    }
  }

  rep(i, n) {
    rep(j, n) {
      cin >> C[i][j];
      C[i][j]--;
    }
  }

  long res = INF*INF;

  rep(x, n) {
    rep(y, n) {
      cnts[(x+y)%3][C[x][y]]++;
    }
  }

  rep(i, c) {
    rep(j, c) {
      if (i == j) continue; 
      rep(k, c) {
        if(i == k || j == k) continue;
        long tmp = 0;
        rep(x, c) {
          tmp += d[x][i] * cnts[0][x];
        }
        rep(x, c) {
          tmp += d[x][j] * cnts[1][x];
        }
        rep(x, c) {
          tmp += d[x][k] * cnts[2][x];
        }
        res = min(res, tmp);
      }
    }
  }

  cout << res << endl;
}


Measured memory_bytes: 1912
#include <iostream>
#include <vector>
#include <set>
#include <queue>
#include <stack>
#include <map>
#include <limits>
#include <string>
#include <algorithm>
#include <bitset>
#include <unordered_set>
#include <unordered_map>
#include <map>
#include "math.h"
#include "assert.h"

using namespace std;

int inf = std::numeric_limits<int>().max();

#define BUFF ios::sync_with_stdio(false)
#define epsilon 1e-07
#define pi 2 * acos(0.0);
#define mod 1000000007   // 1e9+7
#define ll long long
#define cerr if(false)cerr
#define watch(x) cerr << #x << " = " << x << endl;

int main() {

	int n;
	cin >> n;
	vector<vector<int>> cp(n, vector<int>(n, 0));
	for(int i=0; i<n; i++) {
		for(int j=0; j<n; j++) {
			cin >> cp[i][j]; 
		}
	}

	vector<int> dp( 1<<n, 0);
	for(int s=1; s < 1<<n; s++) {
		bitset<30> b = s;
		int w = b.count() - 1;
		for(int k=0; k < n; k++) {

			if ((s & (1 << k))) {  

				int sl = s - (1 << k);

				if (cp[w][k]) {
					if (w == 0) dp[s] = 1;
					else {
						dp[s] += dp[sl];
						dp[s] %= mod;
					}

				}

				//bitset<10> b = s;
				//cout << " f(" << b << "->  " << w << "--" << k << ") " << dp[s] << endl;

			}
		}
	}

	cout << dp[(1<<n)-1] << endl;

}


Measured memory_bytes: 8448
#include <bits/stdc++.h>
#include <numeric>
#define rep(i,n) for (int i = 0; i < n; ++i)
#define rep1(i,n) for (int i = 1; i <= n; ++i)
template<typename T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<typename T> inline T intceil(T a, T b) { return (a + (b - 1)) / b; }
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
const long long MOD = 1e9+7;
#define precout() cout << std::fixed << std::setprecision(20);
const string alphabet = "abcdefghijklmnopqrstuvwxyz";
const int dy[4] = { 0, 1, 0, -1 };
const int dx[4] = { 1, 0, -1, 0 };
typedef complex<double> cd;
static const double pi = 3.141592653589793;

int gcd(int a, int b) {
  if(b > a) swap(a, b);
  if(a % b == 0) return b;
  return gcd(b, a % b);
}

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

  int n,k; cin >> n >> k;
  int curGcd; cin >> curGcd;
  int maxA = curGcd;
  rep(i, n - 1) {
    int tmp; cin >> tmp;
    chmax(maxA, tmp);
    curGcd = gcd(curGcd, tmp);
  }

  if(k <= maxA && k % curGcd == 0) {
    cout << "POSSIBLE" << endl;
  } else {
    cout << "IMPOSSIBLE" << endl;
  }
}


Measured memory_bytes: 256
#include<cstdio>
#include<cmath>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
int a,b,c;
int main()
{
	scanf("%d%d%d",&a,&b,&c);
	printf("%d\n",max(0,c-(a-b)));
	return 0;
}


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

namespace AizuOnlineJudge
{
    class Program
    {
        static void Main(string[] args)
        {
            var queue = new Queue<AOJProcess>();

            var nq = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            for(var i = 0; i < nq[0]; ++i)
            {
                queue.Enqueue(new AOJProcess(Console.ReadLine().Split(' ')));
            }
            var elapsed = 0;
            while(queue.Any())
            {
                var proc = queue.Dequeue();
                if(proc.IsWorkComplete(nq[1], ref elapsed))
                {
                    Console.WriteLine($"{proc.Name} {elapsed}");
                }
                else
                {
                    queue.Enqueue(proc);
                }
            }
        }

        private class AOJProcess
        {
            public string Name { private set; get; }
            public int Left { set; get; }

            public AOJProcess(string[] v)
            {
                Name = v[0];
                Left = int.Parse(v[1]);
            }

            public bool IsWorkComplete(int quantum, ref int elapsed)
            {
                elapsed += Left < quantum ? Left : quantum;
                Left -= quantum;
                return Left <= 0;
            }
        }
    }
}


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

#define o(output) cout << output << endl
#define priolity_queue pq
#define push p
#define top t

using namespace std;

string s;
int a,b,c,d;
char A,B;

int main(){
  cin >> a >> b >> c;
  if(abs(b-a)>abs(c-a))o("B");
  else o("A");
}

Measured memory_bytes: 256
import math
from collections import deque
from collections import defaultdict

def readInt():
	return int(input())
def readInts():
	return list(map(int, input().split()))
def readChar():
	return input()
def readChars():
	return input().split()
def factorization(n):
	res = []
	if n%2==0:
		res.append(2)
	for i in range(3,math.floor(n//2)+1,2):
		if n%i==0:
			c = 0
			for j in res:
				if i%j==0:
					c=1
			if c==0:
				res.append(i)
	return res
def fact2(n):
	p = factorization(n)
	res = []
	for i in p:
		c=0
		z=n
		while 1:
			if z%i==0:
				c+=1
				z/=i
			else:
				break
		res.append([i,c])
	return res
def fact(n):#階乗
	ans = 1
	m=n
	for _i in range(n-1):
		ans*=m
		m-=1
	return ans
def comb(n,r):#コンビネーション
	if n<r:
		return 0
	l = min(r,n-r)
	m=n
	u=1
	for _i in range(l):
		u*=m
		m-=1
	return u//fact(l)
def combmod(n,r,mod):
	return (fact(n)/fact(n-r)*pow(fact(r),mod-2,mod))%mod
def printQueue(q):
	r=copyQueue(q)
	ans=[0]*r.qsize()
	for i in range(r.qsize()-1,-1,-1):
		ans[i] = r.get()
	print(ans)
class UnionFind():
	def __init__(self, n):
		self.n = n
		self.parents = [-1]*n

	def find(self, x): # root
		if self.parents[x]<0:
			return x
		else:
			self.parents[x] = self.find(self.parents[x])
			return self.parents[x]

	def union(self,x,y):
		x = self.find(x)
		y = self.find(y)

		if x==y:
			return

		if self.parents[x]>self.parents[y]:
			x,y = y,x

		self.parents[x]+=self.parents[y]
		self.parents[y]=x

	def size(self,x):
		return -1*self.parents[self.find(x)]

	def same(self,x,y):
		return self.find(x)==self.find(y)

	def members(self,x): # much time
		root = self.find(x)
		return [i for i in range(self.n) if self.find(i)==root]

	def roots(self):
		return [i for i,x in enumerate(self.parents) if x<0]

	def group_count(self):
		return len(self.roots())

	def all_group_members(self):
		return {r: self.members(r) for r in self.roots()} # 1~n
def bitArr(n):#ビット全探索
	x = 1
	zero = "0"*n
	ans = []
	ans.append([0]*n)
	for i in range(2**n-1):
		ans.append(list(map(lambda x:int(x),list((zero+bin(x)[2:])[-1*n:]))))
		x+=1
	return ans;
def arrsSum(a1,a2):
	for i in range(len(a1)):
		a1[i]+=a2[i]
	return a1
def maxValue(a,b,v):
	v2 = v
	for i in range(v2,-1,-1):
		for j in range(v2//a+1): #j:aの個数
			k = i-a*j
			if k%b==0:
				return i
	return -1
def copyQueue(q):
	nq = queue.Queue()
	n = q.qsize()
	for i in range(n):
		x = q.get()
		q.put(x)
		nq.put(x)
	return nq

h,w = readInts()
ans = 0
if h%2:
	ans+=(h-1)*w//2+(w+1)//2
else:
	ans+=h*w//2
if h==1 or w==1:
	ans=1
print(ans)

Measured memory_bytes: 3572
while True:
    input_cmd = list(input().split())
    
    a = int(input_cmd[0])
    b = int(input_cmd[2])
    cmd = input_cmd[1]
    
    if cmd == '?':
        break
    elif cmd == '+':
        print(a + b)
    elif cmd == '-':
        print(a - b)
    elif cmd == '*':
        print(a * b)
    else:
        print(a // b)


Measured memory_bytes: 5592
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
#define rep(i,n) for (ll i=0;i<(n);++i)
#define rep2(i,a,b) for (ll i=(a);i<(b);++i)
#define debug(x) cout << #x << '=' << x << endl
#define all(v) (v).begin(),(v).end()
const ll MOD=1e9+7;
//const ll MOD=998244353;
const ll INF=1e9;
const ll IINF=1e18;
const double EPS=1e-8;
const double pi=acos(-1);

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

const int MAX_N=100010;

int N,K,ans=0;
vector<vector<int>> G(MAX_N);
vector<int> md(MAX_N,0);
map<int,int> par;

void dfs(int v){
    md[v]=1;
    for (auto nv:G[v]){
        dfs(nv);
        chmax(md[v],md[nv]+1);
    }
    if (md[v]==K&&par[v]!=0) ++ans,md[v]=0;
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> N >> K;
    rep(i,N){
        int a; cin >> a; --a;
        if (i==0&&a!=0) ++ans,a=0;
        if (i!=0) G[a].push_back(i);
        par[i]=a;
    }
    dfs(0);
    cout << ans << endl;
}

Measured memory_bytes: 18688
#import <Foundation/Foundation.h>
#import <stdarg.h>

@interface StdIO : NSObject
+(NSMutableString*)stringFromStdIn; // 標準入力から NSString を得る
+(void)printf:(NSString*)format, ...; // 標準出力へ出力
@end

@implementation StdIO
+(NSMutableString*)stringFromStdIn
{
    NSFileHandle *handle = [NSFileHandle fileHandleWithStandardInput];
    NSMutableString *result = [NSMutableString string];
    NSData *data = [handle availableData];
    while ([data length] > 0) {
        [result appendString:[[[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding] autorelease]];
        data = [handle availableData];
    }
    NSUInteger length = [result length];
    if (length >= 1 && [result characterAtIndex:length-1] == '\n') { // 入力末尾に改行文字があれば削除
        [result deleteCharactersInRange:NSMakeRange(length-1,1)];
    }
    return result;
}
+(void)printf:(NSString*)format, ...
{
    va_list arguments;
    va_start(arguments, format);
    NSString *string = [[[NSString alloc] initWithFormat:format arguments:arguments] autorelease];
    NSFileHandle *fileHandle = [NSFileHandle fileHandleWithStandardOutput];
    [fileHandle writeData:[string dataUsingEncoding:NSUTF8StringEncoding]];
    va_end(arguments);
}
@end


int main() {
    @autoreleasepool {
        NSArray *numbers = [[StdIO stringFromStdIn] componentsSeparatedByString:@" "];
        NSInteger N = [[numbers objectAtIndex:0] integerValue];
        NSInteger Y = [[numbers objectAtIndex:1] integerValue] / 1000;
        
        for (NSInteger x=0; x <= MIN(N,Y/10); x++) {
            NSInteger y = Y-N-9*x;
            NSInteger z = 5*N-Y+5*x;
            if (y>=0 && z>=0 && y%4==0 && z%4==0) {
                [StdIO printf:@"%ld %ld %ld", x, y/4, z/4];
                return 0;
            }
        }
        [StdIO printf:@"-1 -1 -1"];
    }
    return 0;
}

Measured memory_bytes: 9628
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i = (a); i <= (b); i++)
#define rng(a) a.begin(), a.end()
#define ina(n,a) cin >> n; for(int i = 1; i <= n; i++) cin >> a[i]
#define sz(x) (int)(x).size()
#define se second
#define fi first
#define prev            coyhhhhhhyoc    
#define next          sdNNNmNNNNNNNmds  
#define y0           hNNNNy_yNNNNNN_sNh
#define y1          mNNNNNdtdNNNNNNtsNNm
#define yn          mNNNNNNNNy___smNNNms
#define tm            oooooosyysooooot 
#define read               tyhyt        
#define rank              ytmNmo         
#define index              yyy
#define pb push_back
#define pcnt __builtin_popcountll
#define rrep(i,a,b) for(int i = (b); i >= (a); i--)
#define rall(x,a) for(auto x : a)
#define MOD 1000000007
#define endl "\n"
typedef long long ll;
using namespace std;

const int N = 111111;
pair<int, int> a[N];
int n;

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cin >> n;
    rep(i, 1, n) {
        cin >> a[i].fi;
        a[i].se = i;
    }
    sort(a + 1, a + n + 1);
    rep(i, 1, n) {
        cout << a[i].se << " ";
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 1664
from collections import deque

n = int(input())
a = deque(map(int, input().split()))
a.appendleft(0)
a.append(0)

sum = sum([abs(a[i + 1] - a[i]) for i in range(len(a) - 1)])
ans = 0

for i in range(n):
    ans = sum
    ans = ans - abs(a[i + 1] - a[i]) - abs(a[i + 2] - a[i + 1]) + abs(a[i + 2] - a[i])
    print(ans)

Measured memory_bytes: 13536
#include<stdio.h>
int main()
{
long long int n,i,sum,temp;
  sum=0;
  scanf("%lld",&n);
long long int sw1[n],sw2[n],a[n];
  
  for(i=0;i<n;++i)
  {sw1[i]=0;
  }
  
  for(i=0;i<n;++i)
  {
  scanf("%lld",&a[i]);
  sw1[a[i]-1]++;
  }
  
  for(i=0;i<n;++i)
  {if(sw1[i]>=1) sw2[i]=((sw1[i]-1)*(sw1[i]-2))/2;
   else sw2[i]=0;
  sw1[i]=(sw1[i]*(sw1[i]-1))/2;
  sum=sum+sw1[i];
  }

  for(i=0;i<n;++i)
  {
  temp=sum;
  sum=sum-sw1[a[i]-1]+sw2[a[i]-1];
  printf("%lld\n",sum);
  sum=temp;
  }

return 0;}

Measured memory_bytes: 7416
import math
def prime(x):
    if x == 2: return True
    elif x % 2 == 0: return False
    else:
        for j in xrange(3,int(math.sqrt(x))+1,2):
            if x % j == 0: return False
        else:
            return True 
n = input()
count = 0
for i in xrange(n):
    if prime(input()): count += 1
print count

Measured memory_bytes: 4364
#include<stdio.h>
int a[109];
int main(){
	int n;
	scanf("%d",&n);
	int s1=0,s2=0,s3=0,s4=0,s5=0,s6=0,s7=0,s8=0,s9=0;
	for(int i = 0;i<n;i++){
		scanf("%d",&a[i]);
		if(a[i]>=1&&a[i]<400){
			s1 = 1;
		}
		else if(a[i]>=400&&a[i]<800){
			s2 = 1;
		}
		else if(a[i]>=800&&a[i]<1200){
			s3 = 1;
		}
		else if(a[i]>=1200&&a[i]<1600){
			s4 = 1;
		}
		else if(a[i]>=1600&&a[i]<2000){
			s5 = 1;
		}
		else if(a[i]>=2000&&a[i]<2400){
			s6 = 1;
		}
		else if(a[i]>=2400&&a[i]<2800){
			s7 = 1;
		}
		else if(a[i]>=2800&&a[i]<3200){
			s8 = 1;
		}
		else if(a[i]>=3200&&a[i]<=4800){
			s9++;
		}
	}
	int max = 0;
	int min = 0;
	int t = s1+s2+s3+s4+s5+s6+s7+s8;
	if(t<1){
		min = 1;
	}
	else min = t;
	max = t+s9;
	printf("%d %d\n",min,max);
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 1000000000000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;



int main(){

	bool check[101];

	for(int i = 1; i <= 100; i++){

		check[i] = false;
	}

	for(int i = 1; i <= 9; i++){
		for(int k = 1; k <= 9; k++){
			check[i*k] = true;
		}
	}

	int N;

	scanf("%d",&N);

	if(check[N]){

		printf("Yes\n");

	}else{

		printf("No\n");
	}

	return 0;
}


Measured memory_bytes: 256
import java.util.HashSet;
import java.util.Scanner;

public class Main {
	private static final int MAX_WIDTH = 1000;

	public static void main(String[] args) {
		var sc = new Scanner(System.in);
		var h = sc.nextInt();
		var w = sc.nextInt();
		var ch = sc.nextInt();
		var cw = sc.nextInt();
		var dh = sc.nextInt();
		var dw = sc.nextInt();
		var s = new int[h][w];
		for (var i = 0; i < h; i++) {
			var rs = sc.next();
			for (var j = 0; j < w; j++) {
				s[i][j] = rs.substring(j, j + 1).equals(".") ? 0 : -1;
			}
		}
		sc.close();

		var number = 1;
		var set = new HashSet<Integer>();
		set.add(getPosition(ch - 1, cw - 1));
		while (!set.isEmpty()) {
			var set2 = new HashSet<Integer>();
			for (var p : set) {
				s[getH(p)][getW(p)] = number;
			}
			for (var p : set) {
				check(s, p, number, set2);
			}
			number++;
			set = set2;
		}

		var result = s[dh - 1][dw - 1] < 0 ? -1 : s[dh - 1][dw - 1] - 1;
		System.out.println(result);
	}

	private static void check(int[][] s, int p, int number, HashSet<Integer> set) {
		var h = s.length;
		var w = s[0].length;
		var ph = getH(p);
		var pw = getW(p);
		for (var i = ph - 2; i <= ph + 2; i++) {
			for (var j = pw - 2; j <= pw + 2; j++) {
				if (i >= 0 && i < h && j >= 0 && j < w) {
					var d = Math.abs(i - ph) + Math.abs(j - pw);
					if (d == 1 && s[i][j] == 0) {
						s[i][j] = number;
						set.remove(getPosition(i, j));
						check(s, getPosition(i, j), number, set);
					} else if (d > 1 && s[i][j] == 0) {
						set.add(getPosition(i, j));
					}
				}
			}
		}
	}

	private static int getPosition(int h, int w) {
		return h * MAX_WIDTH + w;
	}

	private static int getH(int p) {
		return p / MAX_WIDTH;
	}

	private static int getW(int p) {
		return p % MAX_WIDTH;
	}
}


Measured memory_bytes: 64564
#include "bits/stdc++.h"
using namespace std;

typedef long long ll;

int main() {
	ll N, K; cin >> N >> K;

	if (K == 0) {
		cout << N*N << endl;
		return 0;
	}

	ll sum=0;
	for (ll b = 1; b <= N; b++) {
		ll c = (N+1)/b, d = (N+1)%b;
		//cout << c <<" "<< d << endl;
		if(b-K >= 0) sum += (b-K)*c;
		if(d-K >= 0) sum += d-K;
	}

	cout << sum << endl;
}


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

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

        while(true) {
            int n = Integer.parseInt(sc.next());
            if (n == 0) {
                break;
            }
            double[] s = new double[n];
            double sum = 0.0;
            for (int i = 0; i < n; i++) {
                s[i] = Double.parseDouble(sc.next());
                sum += s[i];
            }

            double m = sum / n;
            double v = 0.0;
            for (int i = 0; i < n; i++) {
                v += (s[i] - m) * (s[i] - m);
            }
            v /= n;
            double a = Math.sqrt(v);
            out.printf("%.10f\n", a);
        }
        out.flush();
    }
}


Measured memory_bytes: 32100
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
#include <iomanip>
#include <set>
#include <tuple>
#define mkp make_pair
#define mkt make_tuple
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
const ll MOD=1e9+7;

#include <functional>
#include <climits>

//SegmentTree<int> seg(N,[](int a,int b){return min(a,b);},INT_MAX);
template< typename T>
class SegmentTree{
public:

  using F = function<T(T,T)>;

  int n;
  vector<T> tree;
  const F operation;
  const T def;

  SegmentTree(int size,F _operation,T _def):operation(_operation),def(_def){
    n=1;
    while(n<size) n*=2;
    tree.resize(2*n-1,def);
  }

  void initialize(vector<T> v){
    int vSize=v.size();
    n=1;
    while(n<vSize) n*=2;
    tree.resize(2*n-1,def);

    for(int i=0;i<vSize;i++) tree[i+n-1]=v[i];
    for(int i=n-2;i>=0;i--) tree[i]=operation(tree[2*i+1],tree[2*i+2]);
  }

  void update(int index,T value){
    index+=n-1;

    tree[index]=value;
    while(index>0){
      index=(index-1)/2;
      tree[index]=operation(tree[2*index+1],tree[2*index+2]);
    }
  }

  T query(int a,int b,int k=0,int l=0,int r=-1){//[a,b),getMin(a,b,0,0,-1)
    if(r<0) r=n;

    if(r<=a||b<=l) return def;
    else if(a<=l&&r<=b) return tree[k];
    else{
      T lval=query(a,b,2*k+1,l,(l+r)/2);
      T rval=query(a,b,2*k+2,(l+r)/2,r);
      return operation(lval,rval);
    }
  }
};


int N,K;
vector<int> P;

int main(){
  cin>>N>>K;
  P.resize(N);
  rep(i,N) cin>>P[i];

  vector<int> B(N,0);
  SegmentTree<int> seg(N,[](int a,int b){return min(a,b);},N);
  for(int i=1;i<N;i++) seg.update(i,P[i]-P[i-1]);

  bool iot=false;
  for(int i=0;i+K-1<N;i++){
    int a=seg.query(i+1,i+K);
    if(a>=0){
      B[i]=1;
      iot=true;
    }
  }

  set<int> se;
  for(int i=0;i<K;i++) se.insert(P[i]);

  int ans=0;
  if(iot){
    if(B[0]==1) ans=1;
    else ans=2;
  }else{
    ans=1;
  }

  for(int i=1;i+K-1<N;i++){
    auto mir=se.begin();
    int mi=*mir;
    se.erase(P[i-1]);
    se.insert(P[i+K-1]);
    auto itr=se.end();
    itr--;
    int ma=*itr;

    if(B[i]) continue;

    if(mi==P[i-1]&&ma==P[i+K-1]);
    else ans++;
    //cout<<i<<" "<<ans<<endl;
  }
  cout<<ans<<endl;

  return 0;
}


Measured memory_bytes: 13184
use std::io::prelude::*;
use std::io::stdin;
use std::str::FromStr;

fn main() {
    let n: usize = read();
    let a: Vec<f64> = (0..n).map(|_| read()).collect();

    let mut sum = 0.0;
    for &a_i in a.iter() {
        sum += 1.0 / a_i;
    }

    println!("{}", 1.0 / sum);
}

#[allow(dead_code)]
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let token: String = stdin
        .lock()
        .bytes()
        .map(|b| b.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().unwrap()
}


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

using namespace std;

#define ll long long
#define mod 1000000007

int diff(string a,string b){
	int c = 0;
	for(int i = 0;i<a.size();i++){
		if(a[i] == b[i])c++;
	}
	return c;
}
void solve(){
	string s,t;
	cin>>s>>t;
	int match = 0;
	for(int i = 0;i<=s.size()-t.size();i++){
		match = max(match,diff(t,s.substr(i,t.size())));
	}
	cout<<t.size()-match;
}

int main(){
	int t = 1;
	while(t--){
		solve();
	}
	return 0;
}

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

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

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

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

signed main()
{
    ll N;
    cin >> N;
    double ans = 0;
    REP(i, N) {
        double x;
        string u;
        cin >> x >> u;
        if(u == "JPY") { ans += x; }
        else { ans += x * 380000.0; }
    }
    printf("%.5f\n", ans);
    return 0;
}


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

#define F first
#define S second
#define pb push_back
#define endl '\n'

using namespace std;
using ll = long long;

const int MOD = 1e9 + 7;
const int N = 1e3 + 10;

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

    int n;
    cin >> n;
    int ans = 8;
    for (int i = 599; i <= 1999; i += 200) {
    	if (n <= i) {
    		cout << ans << endl;
    		return 0;
    	}
    	--ans;
    }
}

Measured memory_bytes: 3652
import java.io.*;
public class Main{
    public static void main(String[] args) throws IOException{
        Reader r = new Reader();  
        int[] a = r.ii();
        print(a[0] <= a[2] && a[2] <= a[0]+a[1]  ? "YES" : "NO");
    }

    static void print(Object o){
        System.out.println(o.toString());
    }
    static class Reader extends BufferedReader{
        Reader(){
            super(new InputStreamReader(System.in));
        }

        String s() throws IOException{
            return readLine();
        }

        String[] ss() throws IOException{
            return s().split(" ");
        }

        int Int(String s){
            return Integer.parseInt(s);
        }

        int i() throws IOException{
            return Int(s());
        }

        int[] ii() throws IOException{
            String[] ss = ss();
            int size = ss.length;
            int[] ii = new int[size];
            for(int j = 0; j < size; j++) ii[j] = Int(ss[j]);
            return ii;
        }
    }
}

Measured memory_bytes: 20564
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <string.h>
#include <string>
#include <queue>
#include <map>
#include <vector>
using namespace std;

int main(){
	int M,K;
	scanf("%d%d", &M, &K);
	if((1<<M)<=K){
		printf("-1\n");
	}
	else{
		if(M==1){
			if(K==0) printf("0 0 1 1\n");
			else printf("-1\n");
		}
		else{
			printf("%d ", K);
			for(int i=0;i<(1<<M);++i){
				if(i!=K) printf("%d ", i);
			}
			printf("%d", K);
			for(int i=(1<<M)-1;i>=0;--i){
				if(i!=K) printf(" %d", i);
			}
			printf("\n");
		}
	}
	return 0;
}


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

int main() {
  int N, a;
  cin >> N;
  a = N%10;
  if(a == 3) {
    cout << "bon" << endl;
  }
  else if((a == 0)||(a == 1)||(a == 6)||(a == 8)) {
    cout << "pon" << endl;
  }
  else{
    cout << "hon" <<endl;
  }
}

Measured memory_bytes: 3636
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <memory.h>
#include <math.h>
#include <assert.h>
#include <queue>
#include <map>
#include <set>
#include <string>
#include <algorithm>
#include <iostream>
#include <functional>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <bitset>

using namespace std;
typedef pair<int, int> pii;
typedef long long ll;
#define Fi first
#define Se second
#define pb(x) push_back(x)
#define sz(x) ((int)(x).size())
#define rep(i, n) for(int i=0;i<n;i++)
#define all(x) (x).begin(), (x).end()
typedef tuple<int, int, int> t3;
typedef pair<ll, ll> pll;
typedef long double ldouble;
typedef pair<double, double> pdd;

vector<int> E[100010];
int n, m;
int color[100010];

void dfs(int x, int c) {
	color[x] = c;
	for(int e : E[x]) if(color[e] == 0) dfs(e, 3 - c);
}

void solve() {
	scanf("%d%d", &n, &m);
	rep(i, m) {
		int x, y; scanf("%d%d", &x, &y);
		E[x].pb(y);
		E[y].pb(x);
	}
	dfs(1, 1);
	int ok = 1;
	for(int i=1;i<=n;i++) { for(int e : E[i]) if(color[i] + color[e] != 3) ok = 0; }
	if(ok == 1) {
		int a[3] = {};
		for(int i=1;i<=n;i++) a[color[i]]++;
		printf("%lld\n", (ll)a[1] * a[2] - m);
	}
	else printf("%lld\n", (ll)n * (n-1) / 2 - m);
}

int main(){
	int Tc = 1; //scanf("%d\n", &Tc);
	for(int tc=1;tc<=Tc;tc++){
		// printf("Case #%d: ", tc);
		solve();
	}
	return 0;
}

Measured memory_bytes: 6528
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <math.h>
#include <numeric>
using namespace std;

int main() {
    int N;
    cin >> N;
    vector<int> nums;
    for(int i= 0; i< N; ++i)
    {
        int n;
        cin >> n;
        nums.push_back(n);
    }

    sort(nums.begin(), nums.end());

    auto it = lower_bound(nums.begin(), nums.end(), 0);
    auto i = distance(nums.begin(), it);
    
    int seg = (i == 0) ? 1
            : (i == N) ? N - 1
            : i;
    vector<int> x(N-1), y(N-1);
    for(int i = 0; i < N - seg - 1; ++i)
    {
        x[i] = nums[0];
        y[i] = nums[seg + i];
        nums[0] -= y[i];
    }
    for(int i = N - seg - 1; i < N - 1; ++i)
    {
        x[i] = nums[N - 1];
        y[i] = nums[i - (N - seg - 1)];
        nums[N - 1] -= y[i];
    }
    int result = nums[N - 1];
    cout << result << endl;
    for(int i = 0; i < N - 1; ++i)
    {
        cout << x[i] << " ";
        cout << y[i] << endl;
    }
    return 0;
}


Measured memory_bytes: 3192
{-# LANGUAGE BangPatterns      #-} --引数に!

import Data.Bits
import Data.Foldable (foldlM,foldrM)
import Data.Maybe (fromJust)
import Data.List
import qualified Data.Vector.Unboxed.Mutable as V
import Control.Monad
import qualified Data.ByteString.Lazy.Char8 as BS

cnt :: [[Int]] -> [Int] -> Int -> Bool
cnt [] _ _ = True
cnt ((k:ss):ls) (p:ps) switches =
  if (==) p $ (`mod`2).sum $ map (\i -> if testBit switches (i-1) then 1 else 0) ss
    then True && (cnt ls ps switches)
    else False

main :: IO ()
main = do
  [n,m] <- map read.words <$> getLine :: IO [Int]
  list <- replicateM m $ map read.words <$> getLine :: IO [[Int]]
  ps <- map read.words <$> getLine :: IO [Int]
  let maxint = 2^n-1
  ans <- forM [0..maxint] $ \switches -> do
    return $ cnt list ps switches
  print $ length $ filter (==True) ans


Measured memory_bytes: 1020
#include<iostream>
using namespace std;
int main()
{
    long long n,i;
    cin>>n;
    long long m[n];
    for(i=0;i<n;i++)
    {
        cin>>m[i];
    }
    long long dp[n];
    dp[0]=0;
    dp[1]=abs(m[1]-m[0]);
    for(i=2;i<n;i++)
    {
        dp[i]=min(dp[i-1]+abs(m[i]-m[i-1]),dp[i-2]+abs(m[i]-m[i-2]));
    }
    cout<<dp[n-1]<<endl;
    return 0;
}


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

using VI = vector<int>;
using VVI = vector<VI>;
using PII = pair<int, int>;
using LL = long long;
using VL = vector<LL>;
using VVL = vector<VL>;
using PLL = pair<LL, LL>;
using VS = vector<string>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))

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

#define FF first
#define SS second
template<class S, class T>
istream& operator>>(istream& is, pair<S,T>& p){
  return is >> p.FF >> p.SS;
}
template<class S, class T>
ostream& operator<<(ostream& os, const pair<S,T>& p){
  return os << p.FF << " " << p.SS;
}
template<class T>
void maxi(T& x, T y){
  if(x < y) x = y;
}
template<class T>
void mini(T& x, T y){
  if(x > y) x = y;
}


const double EPS = 1e-10;
const double PI  = acos(-1.0);
const LL MOD = 1e9+7;
const int INF = 1e9;

class UnionFind{
private:
  vector<int> par, rank;
public:
  VI sz, dd;
  UnionFind(int n){
	par.assign(n, 0);
	rank.assign(n, 0);
	sz.assign(n, 1);
	for(int i=0;i<n;++i)
	  par[i] = i;
  }

  //find root of x
  int find(int x){
	if(par[x] == x)
	  return x;
	return (par[x] = find(par[x]));
  }

  void unite(int x, int y){
	x = find(x);
	y = find(y);
	if(x == y) return;

	if(rank[x] < rank[y])
	  par[x] = y;
	else{
	  par[y] = x;
	  if(rank[x] == rank[y])
		++rank[x];
	}
	int tmp = sz[x] + sz[y];
	sz[x] = sz[y] = tmp;
	dd[x] = dd[y] = min(dd[x], dd[y]);
  }

  bool same(int x, int y){
	return find(x) == find(y);
  }
};

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

  LL N, M, T;
  cin >> N >> M >> T;
  vector<vector<PII>> es(T+1);
  vector<vector<PII>> G(N);
  REP(i,M){
	int a, b, t;
	cin >> a >> b >> t;
	--a;
	--b;
	es[t].EB(a,b);
	G[a].EB(b,t);
	G[b].EB(a,t);
  }
  VI dist(N, INF);
  dist[0] = 0;
  queue<int> q;
  q.push(0);
  while(!q.empty()){
	int u = q.front();
	q.pop();
	for(auto&& e: G[u]){
	  if(dist[e.FF] == INF && dist[u] < e.SS){
		dist[e.FF] = dist[u] + 1;
		q.push(e.FF);
	  }
	}
  }

  UnionFind uf(N);
  uf.dd = dist;
  VL prv(N, T);
  for(auto&& e: es[T]){
	uf.unite(e.FF, e.SS);
  }

  VL ans(N, 0);
  for(int t=T-1;t>0;--t){
	map<PII,LL> buf;
	for(auto&& e: es[t]){
	  if(uf.same(e.FF, e.SS)) continue;
	  int r1 = uf.find(e.FF);
	  int r2 = uf.find(e.SS);
	  LL s1 = uf.sz[r1];
	  LL s2 = uf.sz[r2];
	  buf[e] = max((ans[r1] + (prv[r1] - t)*s1) * (uf.dd[r1] <= t),
				   ans[r2] + (prv[r2] - t)*s2 * (uf.dd[r2] <= t));
	}

	for(auto&& p: buf){
	  auto& e = p.FF;
	  uf.unite(e.FF, e.SS);
	  int r = uf.find(e.FF);
	  maxi(ans[r], p.SS);
	  prv[r] = t;
	}
  }

  int rt = uf.find(0);
  cout << ans[rt] + prv[rt] * N << endl;

  return 0;
}

Measured memory_bytes: 18724
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repp(i, a, b) for (int i = a; i <= (b); ++i)
#define repr(i, a, b) for (int i = a; i >= (b); --i)
#define bit(n) (1LL << (n))
typedef long long ll;
const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1000000007;

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

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

int main() {
  int H, W;
  cin >> H >> W;
  int N;
  cin >> N;
  vector<int> a(N);
  rep(i, N) cin >> a[i];

  vector<vector<int>> c(H, vector<int>(W));
  int color = 0;
  int i = 0, j = 0;
  rep(x, H * W) {
    c[i][j] = color + 1;
    a[color]--;
    if (a[color] == 0)
      color++;

    if (i % 2 == 0) {
      if (j != W - 1)
        j++;
      else
        i++;
    } else {
      if (j != 0)
        j--;
      else
        i++;
    }
  }

  rep(i, H) {
    rep(j, W) {
      cout << c[i][j] << ' ';
    }
    cout << endl;
  }
}

Measured memory_bytes: 384
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <algorithm>
#include <sstream>
#include <map>
#include <set>
#include <stack>

#define REP(i,k,n) for(int i=k;i<n;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1<<30
#define pb push_back
#define mp make_pair

using namespace std;
typedef long long ll;
typedef pair<int,int> P;

struct edge {
	int from,to;
	int cost;

	edge(int t,int c) : to(t),cost(c) {}
	edge(int f,int t,int c) : from(f),to(t),cost(c) {}

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

vector<edge> G[100005];
bool visited[100005];
int prenum[100005], par[100005], low[100005], timer;

void dfs(int cur, int prev) {
	prenum[cur] = low[cur] = timer;
	timer++;

	visited[cur] = true;
	int next;

	rep(i, G[cur].size()) {
		next = G[cur][i].to;

		if(!visited[next]) {
			par[next] = cur;
			dfs(next, cur);
			low[cur] = min(low[cur], low[next]);
		} else if(next != prev) {
			low[cur] = min(low[cur], prenum[next]);
		}
	} 
}

set<int> art_points(int n) {
	rep(i, n) visited[i] = false;
	timer = 1;

	dfs(0, -1);

	set<int> ap;
	int np = 0;
	REP(i, 1, n) {
		int p = par[i];
		if(p == 0) np++;
		else if(prenum[p] <= low[i]) ap.insert(p);
	}

	if(np > 1) ap.insert(0);
	return ap;
}
int main() {
	int n, m;
	cin >> n >> m;

	rep(i, m) {
		int s, t;
		cin >> s >> t;

		G[s].push_back(edge(t, 0));
		G[t].push_back(edge(s, 0));
	}

	set<int> st = art_points(n);
	set<int>::iterator ite;
	for(ite = st.begin(); ite != st.end(); ite++) {
		cout << *ite << endl;
	}

	return 0;
}

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

int main() {
  int N;
  string S;
  cin >> N >> S;
  
  if (N%2 == 1) {
    cout << "No" << endl;
    return 0;
  }
  
  string s1 = "",
  		 s2 = "";
  for (int i = 0; i < N/2; i++) {
    s1 += S.at(i);
  }
  for (int i = N/2; i < N; i++) {
    s2 += S.at(i);
  }
  
  if (s1 == s2) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <numeric>

using namespace std;

using ll = long long;

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)

#define input(...) __VA_ARGS__; in(__VA_ARGS__)

#if __has_include("debugger.cpp")
  #include "debugger.cpp"
#else
void print() {
  std::cout << std::endl;
}

template <class Head, class... Tail>
void print(Head&& head, Tail&&... tail) {
  cout << head;
  if (sizeof...(tail) > 0) cout << " ";
  print(std::forward<Tail>(tail)...);
}
# endif

void in() { }

template <class Head, class... Tail>
void in(Head&& head, Tail&&... tail) {
  cin >> head;
  in(std::forward<Tail>(tail)...);
}

int main() {
  ll input(n);
  print((1000 - (n % 1000)) % 1000);
}


Measured memory_bytes: 3632
n, k = map(int, input().split())

ha = [0] * n
for i in range(k):
    d = int(input())
    a = list(map(int, input().split()))

    for j in range(d):
        buf = a[j]-1
        ha[buf] += 1

ans = 0
for i in range(n):
    if ha[i] == 0:
        ans += 1

print(ans)

Measured memory_bytes: 9128
import std.stdio: writefln, readln;
import std.array: split, array;
import std.string: capitalize;
import std.algorithm: map;

void main() {
	string[] s = readln.split.map!(capitalize).array;
	"%s%s%s".writefln(s[0][0], s[1][0], s[2][0]);
}


Measured memory_bytes: 256
import java.io.*;
import java.util.*;
import java.lang.*;
import java.math.*;

public class Main {
	public boolean isPrime(int n) {
		for (int i = 2; i<=Math.sqrt(n); i++) {
			if (n%i == 0) return false;
		}
		return true;
	}
	public void run() throws Exception {
		FastScanner sc = new FastScanner();
		
		int n = sc.nextInt();
		for (int i =n; i<Integer.MAX_VALUE; i++) {
			if (isPrime(i)) {
				System.out.println(i);
				return;
			}
		}
	}
	static class FastScanner {
		public BufferedReader reader;
		public StringTokenizer tokenizer;

		public FastScanner() {
			reader = new BufferedReader(new InputStreamReader(System.in), 32768);
			tokenizer = null;
		}

		public String next() {
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(reader.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return tokenizer.nextToken();
		}

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

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

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

		public String nextLine() {
			try {
				return reader.readLine();
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
		}

	}
//	public void run() throws Exception
//	{
//		System.out.println("Hi");
//	}
	public static void main (String[] args) throws Exception {
		new Main().run();
	}
}

Measured memory_bytes: 21204
s=[]
p=[]
a=i=0
for c in input():
 if"\\"==c:s+=[i]
 elif"/"==c and s:
  j=s.pop()
  t=i-j
  a+=t
  while p and p[-1][0]>j:t+=p[-1][1];p.pop()
  p+=[(j,t)]
 i+=1
print(a)
if p:print(len(p),*list(zip(*p))[1])
else:print(0)


Measured memory_bytes: 6500
#include <iostream>
#include <stdio.h>
#include <string.h>
#include <vector>
#include <map>
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

int main(){
    string s;
    cin >> s;
    vector<char> v(s.begin(),s.begin()+3);
    v.push_back('\0');
    printf("%s\n",&v[0]);
    return 0;
}


Measured memory_bytes: 3632
#include<bits/stdc++.h>
#define ll long long
#define rep(i,a,b) for(ll i=a;i<=b;i++)
#define repn(i,n) for(ll i=0;i<n;i++)
#define all(v) v.begin(),v.end()
#define bac(i,a,b) for(ll i=a;i>=b;i--)
#define sz(v) (ll)v.size()
#define vi vector<ll>
#define pi pair<ll,ll>
#define vpi vector<pair<ll,ll>>
using namespace std;

ll MOD=1e9+7;
ll g,h,l;
const ll N=100005, inf=1e9+5;

ll add(ll a,ll b); ll mul(ll a,ll b); ll binpo(ll a,ll b);
ll dis[N];
vector<ll> adj[N];
ll dfs(ll node){
    if(sz(adj[node])==0){
        return 0;
    }
    for(auto i:adj[node]){
        if(dis[i]==-1){
            dis[node] = max(dis[node],dfs(i)+1);
        }
        else{
            dis[node] = max(dis[node],dis[i]+1);
        }
    }
    return dis[node];
}

int main(){
    ios_base::sync_with_stdio(false); cin.tie(NULL);
    ll n,m;cin>>n>>m;
    
    memset(dis,-1,sizeof(dis));
    repn(i,m){
        cin>>g>>h;
        adj[g].push_back(h);
    }
    ll ans=0;
    rep(i,1,n){
        if(dis[i]==-1){
            dfs(i);
        }
        ans = max(ans,dis[i]);
    }
    cout<<ans;
}

ll add(ll a,ll b)
{
    return (a%MOD+b%MOD)%MOD ;
}
ll mul(ll a,ll b)
{
    return (a* 1ll *b)%MOD ;
}
ll binpo(ll a,ll b)
{
    int ans = 1 ;
    while(b)
    {
        if( b % 2 != 0)
        {
            ans = mul(ans,a);
        }
        a = mul(a,a);
        b = b/2;
    }
    return ans;
}

Measured memory_bytes: 7936
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
vector<ll> edge[200005];
ll a[200005]={0};
ll b[200006]={0};
ll b1[200006]={0};
vector<ll> positive;
vector<ll> negative;
int main(void)
{
	ll n;
	scanf("%lld",&n);
	for(ll i=0;i<n-1;i++)
	{
		ll from,to;
		scanf("%lld%lld",&from,&to);
		edge[from].push_back(to);
		edge[to].push_back(from);
	}
	queue<ll> que;
	que.push(1);
	a[1]=1;
	while(que.size()!=0)
	{
		ll q=que.front();
		que.pop();
		ll col=a[q];
		for(ll i=0;i<edge[q].size();i++)
		{
			if(a[edge[q][i]]==0)
			{
				a[edge[q][i]]=col*-1;
				que.push(edge[q][i]);
			}
		}
	}
	for(ll i=1;i<=n;i++)
	{
		if(a[i]==1)
		{
			positive.push_back(i);
		}
		else
		{
			negative.push_back(i);
		}
	}
	if(positive.size()>negative.size())
	{
		swap(positive,negative);
	}
	if(positive.size()<=n/3)
	{
		ll c=0;
		for(ll i=1;i<=n;i++)
		{
			if(i%3==0&&c<positive.size())
			{
				b[i]=positive[c++];
			}
		}
		c=0;
		for(ll i=1;i<=n;i++)
		{
			if(b[i]==0)
			{
				b[i]=negative[c++];
			}
		}
	}
	else
	{
		ll c=0;
		for(ll i=1;i<=n;i++)
		{
			if(i%3==1&&c<positive.size())
			{
				b[i]=positive[c++];
			}
		}
		for(ll i=1;i<=n;i++)
		{
			if(i%3==0&&c<positive.size())
			{
				b[i]=positive[c++];
			}
		}
		c=0;
		for(ll i=1;i<=n;i++)
		{
			if(b[i]==0)
			{
				b[i]=negative[c++];
			}
		}
	}
	for(ll i=1;i<=n;i++)
	{
		b1[b[i]]=i;
	}
	for(ll i=1;i<=n;i++)
	{
		printf("%lld ",b1[i]);
	}
}

Measured memory_bytes: 22888
import sys

f_i = sys.stdin

max_d = float("inf")

V, E = map(int, f_i.readline().split())

# adjacency matrix
A = [[max_d] * i + [0] + [max_d] * (V - i - 1) for i in range(V)]

for l_i in f_i:
    s, t, d = map(int, l_i.split())
    A[s][t] = d


# Warshall???Floyd Algorithm
for k in range(V):
    for i in range(V):
        for j in range(V):
            A[i][j] = min(A[i][j], A[i][k] + A[k][j])

# check whether A has negative cycle
is_negative = 0
for k in range(V):
    if A[k][k] < 0:
        is_negative = 1
        print("NEGATIVE CYCLE")
        break

# Output
import math

if not is_negative:
    for a in A:
        print(' '.join(('INF' if math.isinf(Aij) else str(Aij) for Aij in a)))

Measured memory_bytes: 8204
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long int ll;
 
int main(){
  double R;
  cin>>R;
  double ans;
  ans=2*3.1415*R;
 cout<<setprecision(6)<<ans<<endl;
}

Measured memory_bytes: 3800