akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define f first
#define s second
#define mp make_pair
#define inf 1000000000
#define eps (1e-11)
#define equals(a,b) (fabs((a)-(b))<eps)
using namespace std;

class Point{
public:
  double x,y;
  Point(double x=0,double y=0):x(x),y(y){}

  Point operator+(Point p){ return Point(x+p.x,y+p.y);}
  Point operator-(Point p){ return Point(x-p.x,y-p.y);}
  Point operator*(double k){ return Point(x*k,y*k);}
  Point operator/(double k){ return Point(x/k,y/k);}
  bool operator<(Point p)const{ return (x!=p.x ? x<p.x : y<p.y);}
  bool operator==(Point p)const{ return fabs(x-p.x)<eps && fabs(y-p.y)<eps;}

  double abs(){ return sqrt(norm());}
  double norm(){ return (x*x+y*y);}
};
typedef Point Vector;
typedef vector<Point> Polygon;

double norm(Vector a){ return (a.x*a.x+a.y*a.y);}
double abs(Vector a){ return sqrt(norm(a));}
double dot(Vector a,Vector b){ return (a.x*b.x+a.y*b.y);}
double cross(Vector a,Vector b){ return (a.x*b.y-a.y*b.x);}

static const int COUNTER_CLOCKWISE=1;
static const int CLOCKWISE=-1;
static const int ONLINE_BACK=2;
static const int ONLINE_FRONT=-2;
static const int ON_SEGMENT=0;

int ccw(Point p0,Point p1,Point p2){
  Vector a=p1-p0;
  Vector b=p2-p0;
  if(cross(a,b)>eps)return COUNTER_CLOCKWISE;
  if(cross(a,b)<-eps)return CLOCKWISE;
  if(dot(a,b)<-eps)return ONLINE_BACK;
  if(a.norm()<b.norm())return ONLINE_FRONT;
  return ON_SEGMENT;
}

bool PolygonalLineSearch(Polygon p1,Polygon p2){
  if(p1.size()!=p2.size())return false;
  int n=p1.size();
  for(int i=0;i<n-1;i++){
    Vector a=p1[i+1]-p1[i];
    Vector b=p2[i+1]-p2[i];
    if(a.norm()!=b.norm())return false;
  }
  for(int i=1;i<n-1;i++){
    if(ccw(p1[i-1],p1[i],p1[i+1])!=ccw(p2[i-1],p2[i],p2[i+1]))return false;
  }
  return true;
}

int main()
{
  int n,m;
  vector<Polygon> p;

  while(1){
    cin>>n;
    if(n==0)break;
    n++;
    p.resize(n);
    for(int i=0;i<n;i++){
      cin>>m;
      p[i].resize(m);
      for(int j=0;j<m;j++)cin>>p[i][j].x>>p[i][j].y;
    }
    for(int i=1;i<n;i++){
      bool x=false;
      if(PolygonalLineSearch(p[0],p[i]))x=true;
      reverse(p[i].begin(),p[i].end());
      if(PolygonalLineSearch(p[0],p[i]))x=true;
      if(x)cout<<i<<endl;
    }
    cout<<"+++++"<<endl;
  }
  return 0;
}

Measured memory_bytes: 1244
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<algorithm>
#include<cstring>
#include<map>
using namespace std;
const int N=200005;

int n,t,ans;
int f[N],a[N];
map<int,int> cnt;

int main(){
	int i,j,k;
	scanf("%d",&n);
	for (i=1;i<=n;i++) scanf("%d",&a[i]),cnt[a[i]]++;
	sort(a+1,a+1+n);
	for (i=n;i>=1;i--){
		if (!cnt[a[i]]) continue;
		cnt[a[i]]--;
		j=1;
		while(1ll*j*2<=1ll*(a[i]+a[i]))j=j*2;
		if (cnt[j-a[i]]){
			ans++;
			cnt[j-a[i]]--;
		}
	}
	printf("%d\n",ans);
	return 0;
}


Measured memory_bytes: 19712
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <bitset>
#include <string>
#include <cmath>
#include <complex>
#include <numeric>
#include <cassert>

#include <vector>
#include <array>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <utility>

#define int64 long long
#define uint64 unsigned long long
using namespace std;

int main()
{
	int64 xx, kk = 1;
	cin >> xx;
	while((xx * kk) % 360 != 0)
	{
		kk++;
	}
	cout << kk << endl;;
	return 0;
}

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

int main(){
  int N ;
  cin >> N;
  
  int sum = 0 ;
  int max_p = 0;
  for ( int i = 0 ; i < N ; i++ ){
  	int p;
    cin >> p;
    sum += p;
    if ( max_p < p)
      max_p = p;
  }
  cout << sum-max_p/2 << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <cmath>
#include <array>
#include <queue>
#include <map>
#include <set>
#include <stack>
#include <cstdint>
#include <unordered_set>
#include <ctime>
typedef long long int llint;

int main(void){

  std::string s;
  std::cin >> s;

  for(int i=0; i<s.size(); i++){
    std::cout << "x";
  }

  std::cout << std::endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>

using namespace std;

int main(){

	long long N, K;
	long long result = 0;
	cin >> N >> K;

	if (K % 2 == 1){
		result = (N / K)*(N / K)*(N / K);
		cout << result << endl;
	}
	else{
		long long t;
		for (int a = K / 2; a <= N; a += K / 2){
			t = (N - a) / K - (1 - a) / K + 1;
			result += t*t;
		}
		cout << result << endl;
	}

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int s=1;
  string w;
  cin>>w;
  sort(w.begin(),w.end());
  for(int i=1;i<w.size();i++){
    if(w.at(i)==w.at(i-1))s++;
    else{
      if(s%2==1)break;
      s=1;
    }
  }
  if(s%2==1)cout<<"No"<<endl;
  else cout<<"Yes"<<endl;
}

Measured memory_bytes: 256
// inputに入力データ全体が入る
function Main(input) {
	// 1行目がinput[0], 2行目がinput[1], …に入る
	// input = input.split("\n");
	ans = 0
	input = input.trim().split("");
	input.forEach(function(i) {
    if (i === '-') {
      ans--
		} else {
			ans++
		}
	})

	//出力
	console.log(ans+ "")
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
// Main(require('fs').readFileSync('./input.txt', 'utf-8'));

Measured memory_bytes: 21064
#include<bits/stdc++.h>
using namespace std;
const int N=3e6+10;
const int mod=1e9+7;
int gi() {
    int x=0,o=1;char ch=getchar();
    while((ch<'0'||ch>'9')&&ch!='-') ch=getchar();
    if(ch=='-') o=-1,ch=getchar();
    while(ch>='0'&&ch<='9') x=x*10+ch-'0',ch=getchar();
    return x*o;
}
int qpow(int a,int b) {
    int ret=1;
    while(b) {
        if(b&1) ret=1ll*ret*a%mod;
        a=1ll*a*a%mod,b>>=1;
    }
    return ret;
}
int X1,X2,X3,X4,X5,X6,Y1,Y2,Y3,Y4,Y5,Y6,fac[N],ifac[N];
int C(int n,int m) {
    return 1ll*fac[n+m]*ifac[n]%mod*ifac[m]%mod;
}
void init() {
    const int n=3e6;
    fac[0]=1;for(int i=1;i<=n;i++) fac[i]=1ll*fac[i-1]*i%mod;
    ifac[n]=qpow(fac[n],mod-2);
    for(int i=n-1;i>=0;i--) ifac[i]=1ll*ifac[i+1]*(i+1)%mod;
}
int f[4][3],g[4][3],ans=0;
int calc(int x1,int y1,int f1,int x2,int y2,int f2) {
    int ret=0;
    for(int x=X3;x<=X4;x++) {
        ret=(ret-1ll*C(x-x1,Y3-1-y1)*(x+Y3)%mod*C(x2-x,y2-Y3)%mod)%mod;
        ret=(ret+1ll*C(x2-x,y2-Y4-1)*(x+Y4+1)%mod*C(x-x1,Y4-y1)%mod)%mod;
    }
    for(int y=Y3;y<=Y4;y++) {
        ret=(ret-1ll*C(y-y1,X3-1-x1)*(y+X3)%mod*C(y2-y,x2-X3)%mod)%mod;
        ret=(ret+1ll*C(y2-y,x2-X4-1)*(y+X4+1)%mod*C(y-y1,X4-x1)%mod)%mod;
    }
    return ret*f1*f2;
}
int main() {
    init();
    X1=gi(),X2=gi(),X3=gi(),X4=gi(),X5=gi(),X6=gi();
    Y1=gi(),Y2=gi(),Y3=gi(),Y4=gi(),Y5=gi(),Y6=gi();
    f[0][1]=X1-1,f[0][2]=Y1-1,f[0][0]=1;
    f[1][1]=X1-1,f[1][2]=Y2,f[1][0]=-1;
    f[2][1]=X2,f[2][2]=Y1-1,f[2][0]=-1;
    f[3][1]=X2,f[3][2]=Y2,f[3][0]=1;
    g[0][1]=X6+1,g[0][2]=Y6+1,g[0][0]=1;
    g[1][1]=X5,g[1][2]=Y6+1,g[1][0]=-1;
    g[2][1]=X6+1,g[2][2]=Y5,g[2][0]=-1;
    g[3][1]=X5,g[3][2]=Y5,g[3][0]=1;
    for(int i=0;i<4;i++)
        for(int j=0;j<4;j++) {
            //cerr<<i<<" "<<j<<endl;
            ans=(ans+calc(f[i][1],f[i][2],f[i][0],g[j][1],g[j][2],g[j][0]))%mod;
        }
    ans=(ans%mod+mod)%mod,printf("%d\n",ans);
    return 0;
}


Measured memory_bytes: 23680
#include <iostream>
#include <cstring>
#include <string>    
#include <vector>
#include <queue>
#include <map>
#include <algorithm>
#include <cmath>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
ll sx, sy, tx, ty;
string str;

int main(){
	cin >> sx >> sy >> tx >> ty;
	ll x = tx - sx;
	ll y = ty - sy;
	
	for(ll i = 1; i <= x; i++){cout << 'R';}
	for(ll i = 1; i <= y; i++){cout << 'U';}
	for(ll i = 1; i <= x; i++){cout << 'L';}
	for(ll i = 1; i <= y; i++){cout << 'D';}
	
	cout << 'D';
	for(ll i = 1; i <= x+1; i++){cout << 'R';}
	for(ll i = 1; i <= y+1; i++){cout << 'U';}
	cout << 'L';
	cout << 'U';
	for(ll i = 1; i <= x+1; i++){cout << 'L';}
	for(ll i = 1; i <= y+1; i++){cout << 'D';}
	cout << 'R';
	cout << endl;
	
	return 0;
}

Measured memory_bytes: 256
import numpy as np

H, W = map(int, input().split())
S_list = [list(input()) for _ in range(H)]
S_list=(np.array(S_list) ==".")*1

L = np.zeros((H, W), int)
R = np.zeros((H, W), int)
U = np.zeros((H, W), int)
D = np.zeros((H, W), int)

for w in range(W):
    if w == 0:
        L[:,w] = S_list[:,w]
        R[:,W-w-1] = S_list[:,W-w-1]
    else:
        L[:,w] = (L[:,w-1]+1) * S_list[:,w]
        R[:,W-w-1] = (R[:,W-w]+1) * S_list[:,W-w-1]

for h in range(H):
    if h == 0:
        U[h,:] = S_list[h,:]
        D[H-h-1,:] = S_list[H-h-1,:]
    else:
        U[h,:] = (U[h-1,:]+1) * S_list[h,:]
        D[H-h-1,:] = (D[H-h,:]+1) * S_list[H-h-1,:]
        
ans = max(np.max(L+R+U+D-3), 0)

print(ans)

Measured memory_bytes: 266540
#include<stdio.h>
#define M 100001
typedef struct qu{
  char name[100];
  int t;
}W;

W Q[M];
int head, tail;

void initialize(void){
  head = 0;
  tail = 0;
}
/*
int isEmpty(void){
if(*head == *tail) return 1;
else return 0; 
}

int isFull(void){
if(*head == *tail % M) return 1;
else return 0;
}*/

void enqueue(W x){
  /*  if(isFull(*head, *tail) == 1) {
      printf("error");
      exit(1);
      }*/
  Q[tail]= x;
  tail = (tail+1) % M;
  /*  if(*tail + 1 == M) *tail = 0;
      else *tail = *tail+1;*/
}

W dequeue(void){
  W x = Q[head];
  /* if(isEmpty() == 1){
  // printf("error");
  exit(1);
  }*/
  /* x = *Q;
   if((*head+1) == M) head = 0;
   else *head++;*/
  head = (head+1) % M;
  return x;
}







/*
  int initialize(void);
  int isEmpty(void);
int isFull(void);
void enqueue(int *, int);
int dequeue();
*/



int main(void){
  char name;
  int n, q, i;
  W Qm;
  int counter = 0;
  //  int *head, *tail;
  
  scanf("%d %d", &n, &q);
  for(i=0; i<n; i++){
    //  scanf("%s %d", Q[i].name, &Q[i].t);
    scanf("%s %d", Qm.name, &Qm.t);
    enqueue(Qm);
  }
  while(head != tail){
    W deq = dequeue();
    if(deq.t <= q){
      counter += deq.t;
      printf("%s %d\n", deq.name, counter);
    }
    else{ 
      counter +=q;
      deq.t -= q;
      enqueue(deq);
    }
  }
  
  

  
  /* for(i=0;;i++){
     if(Q[i].t > q){
     Q[i].t =  Q[i].t - q;
     dequeue(&Q[i]);     
     enqueue(&Q[*tail],Q[i]);
     counter += q;
     }
     else{   //Q[i].t < q
     dequeue(&Q[i]);  
     counter = Q[i].t;
      printf(Q[i].name, counter);
      }    
      }*/
  
  return 0;
}

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

#define N 3000

int main() {
    int x[N], y[N], i;

    for(i=0; i<N; ++i) {
        cin >> x[i] >> y[i];
        if(x[i] <= 0 && y[i] <= 0) break;
    }

    i = 0;
    while(x[i] > 0 || y[i] > 0) {
        if(x[i]<y[i]) cout << x[i] << ' ' << y[i] << endl;
        else cout << y[i] << ' ' << x[i] << endl;
        ++i;
    }
    return 0;
}

Measured memory_bytes: 2992
import java.util.*;

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

	public Main() {
		new AOJ1020().doIt();
	}

	class AOJ1020{
		int[][][] memo;
		HashMap<Character,Point> map;
		int[] sx = {1,0,-1,0};
		int[] sy = {0,1,0,-1};
		int n;
		Point bad,goal;
		int dfs(int x,int y,int battery){
			if(memo[x][y][battery]>0)return memo[x][y][battery];
			if(battery==n){
				if(goal.x==x&&goal.y==y)return 1;
				else return 0;
			}
			int result = 0;
			for(int i=0;i<4;i++){
				int nx = x+sx[i];
				int ny = y+sy[i];
				if(nx<0||nx>=3||ny<0||ny>=3||(bad.x==nx&&bad.y==ny))result += dfs(x,y,battery+1);
				else result +=  dfs(nx,ny,battery+1);
			}
			return memo[x][y][battery] = result;
		}


		void doIt(){
			map = new HashMap<Character,Point>();
			map.put('A',new Point(0, 0));
			map.put('B',new Point(1, 0));
			map.put('C',new Point(2, 0));
			map.put('D',new Point(0, 1));
			map.put('E',new Point(1, 1));
			map.put('F',new Point(2, 1));
			map.put('G',new Point(0, 2));
			map.put('H',new Point(1, 2));
			map.put('I',new Point(2, 2));
			while(true){
				n = in.nextInt();
				if(n==0)break;
				char s = in.next().charAt(0);
				char g = in.next().charAt(0);
				char b = in.next().charAt(0);
				memo = new int[3][3][n+1];
				bad = new Point(map.get(b).x, map.get(b).y);
				goal = new Point(map.get(g).x,map.get(g).y);
				double a = dfs(map.get(s).x,map.get(s).y,0);
				long c = 4;
				for(int i=0;i<n-1;i++)c*=4;
//				System.out.println(a+" "+c);
				System.out.printf("%.9f\n",(a/c));
				
				
			}
		}
		class Point{
			int x,y;
			public Point(int x,int y) {
				this.x = x;
				this.y = y;
			}
		}

	}


}

Measured memory_bytes: 23408
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long int n, m, i, a, sum=0;
    cin >> n >> m;
    for(i=0;i<m;i++)
        {
            cin >> a;
            sum += a;
        }
    //cout << sum << endl;
    if(sum>n)
        cout << -1 << endl;
    else
        cout << n - sum << endl;
}


Measured memory_bytes: 3616
n,k=map(int,input().split())
P=list(map(int,input().split()))
S=[0]
for i in range(n):
    s=P[i]+S[i]
    S.append(s)
a=0
for i in range(k,n+1):
    a=max(a,S[i]-S[i-k])
print((a+k)/2)
    

Measured memory_bytes: 76040
import sys
read=sys.stdin.buffer.read
readline=sys.stdin.buffer.readline
readlines=sys.stdin.buffer.readlines

N=int(readline())

se=set(x*y for x in range(1,10) for y in range(1,10))
#print(se)

answer="Yes" if N in se else "No"
print(answer)

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

int main(){
    char ch[2][3],ch2[2][3];
    for(int i = 0; i < 2; ++i){
        for(int j = 0; j < 3; ++j){
            cin >> ch[i][j];
            ch2[1 - i][2 - j] = ch[i][j];
        }
    }
    for(int i = 0; i < 2; ++i){
        for(int j = 0; j < 3; ++j){
            if(ch[i][j] != ch2[i][j]){
                cout << "NO" << endl;
                return 0;
            }
        }
    }
    cout << "YES" << endl;

}

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


int main(){
  int k;
  cin >> k;
  int ans=0;
  if(360%k==0){
    ans=360/k;
  }else{
    int ka=0;
    while(ka!=360){
      ka+=k;
      if(ka>360)ka-=360;
      ans++;
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3632
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

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

    def unite(self, x, y):
        rx = self.root(x)
        ry = self.root(y)
        if rx == ry:
            return
        if self.parents[x] > self.parents[y]:
            rx, ry = ry, rx
        self.parents[rx] += self.parents[ry]
        self.parents[ry] = rx

    def same(self, x, y):
        rx = self.root(x)
        ry = self.root(y)
        return rx == ry

    def size(self, x):
        return -self.parents[self.root(x)]


n, m, k = map(int, input().split())
friend_cand = UnionFind(n)
friend = {i: set() for i in range(n)}
for _ in range(m):
    a, b = map(lambda x: int(x)-1, input().split())
    friend[a].add(b)
    friend[b].add(a)
    friend_cand.unite(a, b)
block = {i: set() for i in range(n)}
for _ in range(k):
    c, d = map(lambda x: int(x)-1, input().split())
    block[c].add(d)
    block[d].add(c)

res = []
for i in range(n):
    friend_cnt = len(friend[i])
    block_cnt = 0
    for k in block[i]:
        if friend_cand.same(i, k):
            block_cnt += 1
    res.append(friend_cand.size(i) - friend_cnt - block_cnt - 1)

print(' '.join(map(str, res)))


Measured memory_bytes: 98036
import sys

class Node:
    def __init__(self,value):
        self.value = value
        self.prev = None
        self.next = None

class LinkList:
    def __init__(self):
        self.head = None
        self.tail = None

    def insertzero(self,value):
        new  = Node(value)
        p = self.head
        self.head = new
        new.next = p
        if p is None:
            self.tail = new
        else:
            p.prev = new

    def deletefirst(self):
        if self.head is None:
            return
        p = self.head
        if p.next is None:
            self.head = None
            self.tail = None
        else:
            q = p.next
            q.prev = None
            self.head = q

    def deletelast(self):
        if self.tail is None:
            return
        p = self.tail
        q = p.prev
        if q is None:
            self.head =None
            self.tail =None
        else:
            q.next = None
            self.tail = q

    def delete(self,value):
        p = self.head
        while p is not None:
            if p.value == value:
                if p.prev is None:
                    self.deletefirst()
                    return
                elif p.next is None:
                    self.deletelast()
                    return
                else:
                    p.next.prev = p.prev
                    p.prev.next = p.next
                    return
            else:
                p = p.next

    def show(self):
        p = self.head
        #print("L:",end="")  
        l = []
        c = 0
        while p is not None:
            l.append(p.value)
            p=p.next
        print(" ".join(l))

    def rshow(self):
        p = self.tail
        c = 0
        while p is not None:
            if c > 0:
                print(" ",end="")
            else:
                c +=1
            print(p.value,end="")
            p = p.prev
        print()

def main():

    list  = LinkList()
    num = int(input())

    for _ in range(num):
        #a = input().split()                                                                                                                   
        line = sys.stdin.readline()
        a = line.rstrip().split()
        if a[0][0] == "i":
            list.insertzero(a[1])
        elif len(a[0]) == 6:
            list.delete(a[1])
        elif len(a[0]) == 11:
            list.deletefirst()
        elif len(a[0]) == 10:
            list.deletelast()
        else:
            pass

    list.show()

if __name__ == '__main__':
    main()




Measured memory_bytes: 227616
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author cherrypi59
 */

#include <bits/stdc++.h>
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define FFOR(i, a, b) FOR(i, a, b+1)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) FOR(i, 1, n+1)
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define LEN(x) (int)(x).size()
#define DUMP(x) cerr<<__LINE__<<' '<<#x<<"="<<(x)<<endl;
#define pb push_back
#define eb emplace_back
#define mp make_pair

using namespace std;
using lint = long long;
using pii =  pair<int, int>;
using pll =  pair<lint, lint>;
template <typename T> using vc = vector<T>;
template <typename T> using vvc = vector<vector<T>>;
template <typename T> inline bool chmax(T &a, T b){if(a<b){a = b; return true;} return false;}
template <typename T> inline bool chmin(T &a, T b){if(a>b){a = b; return true;} return false;}

constexpr lint ten(int n) {return n==0 ? 1 : ten(n-1)*10;}

class BEasyLinearProgramming {
public:
    void solve(std::istream& in, std::ostream& out){
        ios_base::sync_with_stdio(false);
        in.tie(nullptr), out.tie(nullptr);
        int A, B, C, K, ans = 0;
        in>>A>>B>>C>>K;
        ans += min(A, K);
        K -= min(A, K);
        K -= min(B, K);
        ans -= min(C, K);
        out<<ans<<'\n';
    }
};


int main() {
	BEasyLinearProgramming solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 3604
#include <stdio.h>
#include <iostream>
#include <cstdlib>
#include <iomanip>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <limits>
#include <numeric>
#include <set>

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;



int main() {
	int n;
	cin >> n;
	if (n % 2 == 0)cout<<fixed<<setprecision(10) <<1.0/2.0 << endl;
	else cout <<fixed << setprecision(10) << ((n/2+1.00)/n) << endl;


	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	int a, b;
	char s;

	while(1){
		scanf("%d%s%d", &a,&s,&b);
		if(s == '?')
			break;
		if(s == '+')
			printf("%d\n", a+b);
		if(s == '-')
			printf("%d\n", a-b);
		if(s == '*')
			printf("%d\n", a*b);
		if(s == '/')
			printf("%d\n", a/b);
	}
	return 0;
}

Measured memory_bytes: 600
import std.stdio, std.conv, std.functional, std.string;
import std.algorithm, std.array, std.container, std.range, std.typecons;
import std.numeric, std.math, std.random;
import core.bitop;

string FMT_F = "%.10f";

static File _f;
void file_io(string fn) { _f = File(fn, "r"); }
static string[] s_rd;
T _RD(T = long)() { while(!s_rd.length) s_rd = readln.chomp.split; string res = s_rd[0]; s_rd.popFront; return res.to!T; }
T _RD(T = long)(File f) { while(!s_rd.length) s_rd = f.readln.chomp.split; string res = s_rd[0]; s_rd.popFront; return res.to!T; }
T[] _RDA(T = long)(T fix = 0) { auto r = readln.chomp.split.to!(T[]); r[] += fix; return r; }
T[] _RDA(T = long)(File f, T fix = 0) { auto r = f.readln.chomp.split.to!(T[]); r[] += fix; return r; }
T RD(T = long)() { if (_f.isOpen) return _RD!T(_f); else return _RD!T; }
T[] RDA(T = long)(T fix = 0) { if (_f.isOpen)  return _RDA!T(_f, fix); else return _RDA!T(fix); }

size_t[] MAKE_IDX(alias less = "a < b", Range)(Range range) { auto idx = new size_t[](range.length); makeIndex!(less)(range, idx); return idx;}
size_t MIN_POS(alias less = "a < b", Range)(Range range) { auto r = minPos!(less)(range); return range.length - r.length; }

bool inside(T)(T x, T b, T e) { return x >= b && x < e; }
long lcm(long x, long y) { return x * (y / gcd(x, y)); }

long mod = 10^^9 + 7;
//long mod = 998244353;
//long mod = 1_000_003;
void moda(ref long x, long y) { x = (x + y) % mod; }
void mods(ref long x, long y) { x = ((x + mod) - (y % mod)) % mod; }
void modm(ref long x, long y) { x = (x * y) % mod; }

void main()
{
	auto H = RD;
	auto W = RD;
	auto K = RD;
	auto s = new string[](H);
	foreach (i; 0..H)
	{
		s[i] = RD!string;
	}

	auto ans = new long[][](H, W);
	long num = 1;
	foreach (y; 0..H)
	{
		long cnt;
		foreach (x; 0..W)
		{
			if (s[y][x] == '#')
			{
				++cnt;
				if (cnt == 2)
				{
					++num;
					cnt = 1;
				}
			}
			ans[y][x] = num;
		}
		if (cnt == 0)
		{
			foreach (x; 0..W)
				ans[y][x] = 0;
		}
		else
			++num;
	}

	foreach (y; 1..H)
	{
		foreach (x; 0..W)
		{
			if (ans[y][x] == 0)
			{
				ans[y][x] = ans[y-1][x];
			}
		}
	}
	foreach_reverse (y; 0..H-1)
	{
		foreach (x; 0..W)
		{
			if (ans[y][x] == 0)
			{
				ans[y][x] = ans[y+1][x];
			}
		}
	}

	foreach (y; 0..H)
	{
		ans[y].map!(to!string).join(" ").writeln;
	}
	stdout.flush();
	debug readln();
}

Measured memory_bytes: 4988
n, k = map(int,input().split())
if n < 3:
    print(0)
    exit()

table = [[0] * 5 for i in range(11)]
for i in range(11):
    for j in range(5):
        t = 9 * (j + 2 + 7 * (i + 1))
        table[i][j] = t % 11

c = [0]
for row in table:
    c.append(c[-1] + row.count(k))

d, m = divmod(n - 2, 11)
ans = c[m] + c[-1] * d
print(ans)


Measured memory_bytes: 9020
#include <iostream>
#include <algorithm>
#include <cmath>
#include <limits>
#include <vector>
#include <cstdio>
#include <bits/stdc++.h>
#include <set>
#include <map>
#include <stdio.h>
#include <stack>
#include <queue>
#include <deque>
#include <numeric>
#include<bits/stdc++.h>
#include <utility>

#define ALL(obj) (obj).begin(), (obj).end()
#define FOR(i,a,b) for(int i = (a); i < (b); i++)
#define RFOR(i,a,b) for(int i = (a); (b) <= i; i--)
#define REP(i,n) for(int i = 0; i < (n); i++)
#define RREP(i,n) for(int i = n; n <= i; i--)
#define ABS(a) ((a < 0) ? ((-1)*(a)) : (a))
#define elif else if
#define MOD 1000000007
#define INF (1<<29)

using namespace std;
using ll = long long;
map <int ,int> mpa,mpb;
typedef pair<ll, ll> P;
priority_queue<P, vector<P>, greater<P>> pque;

int main(){
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  int a,b,c;
  cin >> a >> b >> c;
  int cost=a+b+c-max({a,b,c});
  cout << cost << endl;
  return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
     
    public class Main { //クラス名はMain
        public static void main(String[] args) {
            //コード
          Scanner sc = new Scanner(System.in);
    	  String n = sc.nextLine();
          String[] strArray = n.split(" ");
          int a = Integer.parseInt(strArray[0]);
          int b = Integer.parseInt(strArray[1]);
          int c = -1;
          
          //九九判定
          if (a >= 10 || b >= 10) {
            System.out.println(c);
          }
          if (a < 10 && b < 10) {
            System.out.println(a*b);
          }
        }
    }

Measured memory_bytes: 22740
#include <iostream>
#include <stdio.h>
using namespace std;
static const double PI = 3.141592653589;

int main(void){
	double r,menseki,ensyu;
	cin >> r;
	menseki = PI * r * r;
	ensyu = 2 * PI * r;

	printf("%f %f\n",menseki,ensyu);
}

Measured memory_bytes: 1232
// :)
// "Khodaya, be man "Tagwaye setiz" biamooz ta
//  dar anbuh masuliat nalaghzam ..." -Shariati
#include <bits/stdc++.h>

using namespace std;
typedef long long int64;
typedef pair<int,int> pii;
typedef pair<int64,int> pii32;
typedef pair<int64,int64> pii64;

#define PB push_back
#define MP make_pair
#define F first
#define S second
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()

const int maxn = 1e5+10;
const int64 MO = 1e9+7;
const int64 IN = 1e9;

int n, ans, cnt1, cnt2, cnt3;

int main () {
	ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	cin >> n;
	for (int i = 0; i < n; i++) {
		string s;
		cin >> s;
		for (int t = 0; t < sz(s) - 1; t++)
			if (s[t] == 'A' && s[t + 1] == 'B')
				ans++;
		if (s[0] == 'B' && s[sz(s) - 1] == 'A') {
			cnt3++;
			continue;
		}
		if (s[0] == 'B')
			cnt1++;
		if (s[sz(s) - 1] == 'A')
			cnt2++;
	}
	if (cnt3) {
		ans += cnt3 - 1;
		if (cnt1) {
			ans++;
			cnt1--;
		}
		if (cnt2) {
			ans++;
			cnt2--;
		}
	}
	cout << ans + min(cnt1, cnt2) << "\n";
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define REP(i,a,b) for(int i=(a);i<(int)(b);++i)
#define rep(i,n) REP(i,0,n)
#define dump(x)  cout << #x << " = " << (x) << endl;
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

using namespace std;
typedef long long ll;

int main() {
    int H, W;
    cin >> H >> W;
    vector<vector<int>> map(H, vector<int>(W));
    rep(i, H) {
        rep (j, W) {
            char a;
            cin >> a;
            map[i][j] = a == '.' ? 1 : 2;
        }
    }
    rep(i, H) {
        bool flg = false;
        rep (j, W) {
            bool flg1 = true;
            for (int k = 0; k < H; k++)
                if (map[k][j] == 2) flg1 = false;
            bool flg2 = true;
            for (int k = 0; k < W; k++)
                if (map[i][k] == 2) flg2 = false;
            if (!(flg1 || flg2)) {
                if (map[i][j] == 1)
                    cout << '.';
                else
                    cout << '#';
                flg = true;
            }
        }
        if (flg)
            cout << endl;
    }
    return 0;
}




Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG

#include<bits/stdc++.h>
using namespace std;

#define endl '\n'
#define lfs cout<<fixed<<setprecision(10)
#define ALL(a)  (a).begin(),(a).end()
#define ALLR(a)  (a).rbegin(),(a).rend()
#define spa << " " <<
#define fi first
#define se second
#define MP make_pair
#define MT make_tuple
#define PB push_back
#define EB emplace_back
#define rep(i,n,m) for(ll i = (n); i < (ll)(m); i++)
#define rrep(i,n,m) for(ll i = (ll)(m) - 1; i >= (ll)(n); i--)
using ll = long long;
using ld = long double;
const ll MOD1 = 1e9+7;
const ll MOD9 = 998244353;
const ll INF = 1e18;
using P = pair<ll, ll>;
template<typename T1, typename T2>
bool chmin(T1 &a,T2 b){if(a>b){a=b;return true;}else return false;}
template<typename T1, typename T2>
bool chmax(T1 &a,T2 b){if(a<b){a=b;return true;}else return false;}
ll median(ll a,ll b, ll c){return a+b+c-max({a,b,c})-min({a,b,c});}
void ans1(bool x){if(x) cout<<"Yes"<<endl;else cout<<"No"<<endl;}
void ans2(bool x){if(x) cout<<"YES"<<endl;else cout<<"NO"<<endl;}
void ans3(bool x){if(x) cout<<"Yay!"<<endl;else cout<<":("<<endl;}
template<typename T1,typename T2>
void ans(bool x,T1 y,T2 z){if(x)cout<<y<<endl;else cout<<z<<endl;}  
template<typename T>
void debug(vector<vector<T>>&v,ll h,ll w){for(ll i=0;i<h;i++)
{cout<<v[i][0];for(ll j=1;j<w;j++)cout spa v[i][j];cout<<endl;}};
void debug(vector<string>&v,ll h,ll w){for(ll i=0;i<h;i++)
{for(ll j=0;j<w;j++)cout<<v[i][j];cout<<endl;}};
template<typename T>
void debug(vector<T>&v,ll n){if(n!=0)cout<<v[0];
for(ll i=1;i<n;i++)cout spa v[i];cout<<endl;};
template<typename T>
vector<vector<T>>vec(ll x, ll y, T w){
  vector<vector<T>>v(x,vector<T>(y,w));return v;}
ll gcd(ll x,ll y){ll r;while(y!=0&&(r=x%y)!=0){x=y;y=r;}return y==0?x:y;}
vector<ll>dx={1,-1,0,0,1,1,-1,-1};
vector<ll>dy={0,0,1,-1,1,-1,1,-1};
template<typename T>
vector<T> make_v(size_t a,T b){return vector<T>(a,b);}
template<typename... Ts>
auto make_v(size_t a,Ts... ts){
  return vector<decltype(make_v(ts...))>(a,make_v(ts...));
}
template<typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2>&p){
  return os << p.first << " " << p.second;
}
//mt19937 mt(chrono::steady_clock::now().time_since_epoch().count());

int main(){
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  ll res=0,buf=0;
  bool judge = true;
  ll x;cin>>x;
  rep(j,1,10000){
    //if(j&1)continue;
    if(x*j%360==0){
      cout<<j<<endl;
      return 0;
    }
  }
  return 0;
}

Measured memory_bytes: 3640
# coding: utf-8

N = int(input())

a = list(map(int, input().split()))

x = a[0]
y = sum(a[1:])

m = abs(x - y)
for i in range(1, N - 1):
    x += a[i]
    y -= a[i]
    m = min(abs(x - y), m)

print(m)


Measured memory_bytes: 24812
import java.util.*;
interface Main{
	static void main(String[]$){
		var s=new Scanner(System.in);
		long n=s.nextInt(),a=n++*n++*n--/6,m=n;
		while(n-->2){long u=s.nextInt(),v=s.nextInt();a-=(u<v?u:v)*m-u*v;}
		System.out.print(a);
	}
}

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


#define li          long long int
#define rep(i,to)   for(li i=0;i<((li)(to));i++)
#define repp(i,start,to)    for(li i=(li)(start);i<((li)(to));i++)
#define pb          push_back
#define sz(v)       ((li)(v).size())
#define bgn(v)      ((v).begin())
#define eend(v)     ((v).end())
#define allof(v)    (v).begin(), (v).end()
#define dodp(v,n)       memset(v,(li)n,sizeof(v))
#define bit(n)      (1ll<<(li)(n))
#define mp(a,b)     make_pair(a,b)
#define rin rep(i,n)
#define EPS 1e-12
#define ETOL 1e-8
#define MOD 1000000007
typedef pair<li, li> PI;

#define INF bit(60)

#define DBGP 1


#define idp if(DBGP)
#define F first
#define S second
#define p2(a,b)     idp cout<<a<<"\t"<<b<<endl
#define p3(a,b,c)       idp cout<<a<<"\t"<<b<<"\t"<<c<<endl
#define p4(a,b,c,d)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<endl
#define p5(a,b,c,d,e)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<endl
#define p6(a,b,c,d,e,f)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<endl
#define p7(a,b,c,d,e,f,g)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<endl
#define p8(a,b,c,d,e,f,g,h)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<endl
#define p9(a,b,c,d,e,f,g,h,i)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<endl
#define p10(a,b,c,d,e,f,g,h,i,j)        idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<"\t"<<j<<endl
#define foreach(it,v)   for(__typeof((v).begin()) it=(v).begin(); it!=(v).end(); ++it)
#define p2p(x)      idp p2((x).F, (x).S)
#define dump(x,n)   idp{rep(i,n){cout<<x[i]<<" ";}puts("");}
#define dump2(x,n)  idp{rep(i,n){cout<<"["<<x[i].F<<" , "<<x[i].S<<"] ";}puts("");}
#define dumpi(x)    idp{foreach(it, x){cout<<(*it)<<" ";}puts("");}
#define dumpi2(x)   idp{foreach(it, x){cout<<"["<<(it)->F<<" , "<<(it)->S<<"] ";}puts("");}

#define read2d(a,w,h)   rep(i,h)rep(j,w)cin>>a[i][j]
#define dump2d(a,w,h)   rep(i,h){rep(j,w)cout<<a[i][j]<<" ";puts("");}

typedef pair<li, li> PI;

string s[11];
bool res[11][11];

int main() {
    li h, w;
    cin >> h >> w;
    li cnt = 0;
    rep(i, h) {
        cin >> s[i];
        rep(j, sz(s[i])) {
            if (s[i][j] == '#')cnt++;
        }
    }
    cout << (cnt == (h + w - 1) ? "Possible" : "Impossible") << endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
using namespace std;
ll tree [10000000+5];
void upd(ll node,ll st,ll en,ll ind,ll v){
	if(st>en){
		return;
	}
	if(st==en){
		if(st==ind)tree[node]=max(tree[node],v);
		return ;
	}
	ll m=(st+en)/2ll;
	if(ind>=st && ind<=m){
		upd(node*2,st,m,ind,v);
	}else if(ind>m && ind<=en){
		upd(node*2+1,m+1,en,ind,v);
	}
	tree[node]=max(tree[node*2+1],tree[node*2]);
}

ll query(ll node,ll st,ll en,ll l,ll r){
	if(st>en){
		return 0;
	}
	if(st>r or en<l){
		return 0;
	}
	if(st>=l && en<=r){
		return tree[node];
	}
	ll m=(st+en)/2ll;
	return max(query(node*2,st,m,l,r),query(node*2+1,m+1,en,l,r));
}
int main(){
	
	ll n,k;
	cin>>n>>k;
	ll ans=1;
	for(ll i=1;i<=n;i++){
		ll j;
		cin>>j;
		ll mi_e=max(0ll,j-k);
		ll ma_e=min(300000ll,j+k);
		ll sol=query(1,0,300000,mi_e,ma_e)+1ll;
		ans=max(ans,sol);
		upd(1,0,300000,j,sol);
	}
	
	cout<<ans;
}

Measured memory_bytes: 11800
#include<iostream>
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<vector>
#include<cstdlib>
#include<map>
#include<fstream>
#include<string>
#include<sstream>
#include<iomanip>
#include<iostream>
#include<numeric>
#include<cctype>
using namespace std;

void sout(string* a, string* b) {
	if (*a > * b) {
		string c = *a;
		*a = *b;
		*b = c;
	}
}
int main() {
	string s, t;
	cin >> s;
	for (int i = 0; i < s.size(); i++) {
		if (s[i] == '0')
			t += '0';
		else if (s[i] == '1')
			t += '1';
		else {
			int c = t.size();
			if (c > 0)
				t.pop_back();
		}
	}
	cout << t << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,a,b) for(int i=a;i<b;i++)
#define REP(i,a,b) for(int i=a;i<=b;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define vi vector<int>
#define pi pair<int,int>
#define vp vector<pair<int,int> >
#define all(v) v.begin(),v.end()
using namespace std;

signed main(){
    int n;
    cin>>n;
    vector<tuple<int,int,char,int,string>> a(n);
    rep(i,n){
        int v,w,d;
        char t;
        string s;
        cin>>v>>w>>t>>d>>s;
        a[i]=make_tuple(v,w,t,d,s);
    }
    sort(all(a));
    rep(i,n){
        cout<<get<0>(a[i])<<" "<<get<1>(a[i])<<" "<<get<2>(a[i])<<" "<<get<3>(a[i])<<" "<<get<4>(a[i])<<endl;
    }
    return 0;
}


Measured memory_bytes: 12992
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i=0;i<(n);i++)
typedef long long ll;
int main() {
int k,s;
int x=0;
int y=0;
int z=0;
int count=0;
cin>>k>>s;

rep(i,k+1){
    for(int j=i;j<=k;j++){
        for(int l=j;l<=k;l++){
            x=i;
            y=j;
            z=l;
            if((x+y+z)==s){
                if(x==y&&y==z){
                count++;
                }
                else if(x==y||y==z||z==x){
                    count+=3;
                }
                else count+=6;
            }
        }
    }
}
printf("%d\n",count);
	return 0;
}

Measured memory_bytes: 256
/*..............................................*\
Author:Kishor Kumar Paroi
Dept:CSE-1703053
email.kishor.josephite@gmail.com
RUET,BANGLADESH
\*---------------------------*/
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cctype>
#include <cmath>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <string>
#include <fstream>
#include <sstream>
#include <map>
#include <vector>
#include <stack>
#include <queue>
#include<bits/stdc++.h>
#include<iostream>
#include<iterator>

#define max(a,b) ((a>b)?a:b)                        //finding max
#define min(a,b) ((a<b)?a:b)                        //finding min
#define Max(a,b,c) max(a,max(b,c))                  //finding max between 3 numbers
#define Min(a,b,c) min(a,min(b,c))                  //finding min between 3 numbers
#define Pi acos(-1.0)                               //defining Pi for mathematical uses
#define Clear(a) memset(a,0,sizeof(a))              //clearing memory of an array
#define setfalse(a) memset(a,false,sizeof(a))       //setting the array into false
#define settrue(a) memset(a,true,sizeof(a))         //setting the array into true
#define clrstr(a) memset(a,'\0',sizeof(a))          //setting string array to null
#define open freopen("input.txt","r",stdin)         //opening input file
#define close freopen ("output.txt","w",stdout)     //opening output file
#define Case(a) printf("Case %d: ",a)               //printing case number
#define caseh(a) printf("Case #%d: ",a)             //printing case number having '#'
#define getcase(a) scanf("%d",&a)                   //scanning case number
#define caseloop(a,b) for(a=1;a<=b;a++)             //making case loop
#define EPS 1e-9                                    //small value for avoiding preccesion error
#define LL long long                                //long long short form
#define fori(i,n) for(int i=1;i<=n;++i)
#define forn(i,n) for(int i=0;i<n;++i)
#define sz(x) int(x.size())
#define error(x) cout<<#x<<" "<<x<<endl
#define IOS  ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define vi vector<int>v
#define si vector<int>s

/*for(vector<int>iterator it=v.begin();it!=v.end();it++)
{
    cout<<*it<< " ";
}
cout<< endl;
*/

#define CIN1(a) long long a;cin >> a;
#define CIN2(a,b) long long a,b;cin >> a >> b;
#define CIN3(a,b,c) long long a,b,c;cin >> a >> b >> c;
#define rep(i,n) for(int i=0,i##_len=(n); i<i##_len; ++i)
//const int N=100*1000;
//const int mod=1e9+7;

//# define int min3(int a,int b,int c){return min(a,min(b,c));}
//#define int max3(int a,int b,int c){return max(a,max(b,c));}
//#define int min4(int a,int b,int c,int d){return min(min(a,b),min(c,d));}
//#define int max4(int a,int b,int c,int d){return max(max(a,b),max(c,d));}

using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
     vi;
     int k;
     for(int i=0;i<3;i++)
     {
         int num;
         cin>>num;
         v.push_back(num);
     }
     cin>>k;
     sort(v.begin(),v.end());
         cout<<(v[0]+v[1]+pow(2,k)*v[2])<<endl;

    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define rng(i, l, r) for (size_t i = (l); i < (r); ++i)
#define rep(i, n) rng(i, 0, n)
#define gnr(i, l, r) for (size_t i = (r)-1; i >= (l); i--)
#define per(i, b) gnr(i, 0, b)
#define ALL(obj) (obj).begin(), (obj).end()    //1,2,3,...
#define rALL(obj) (obj).rbegin(), (obj).rend() //...,3,2,1

using namespace std;
const int INF = 1e18;
const int dx4[4] = {1, 0, -1, 0};
const int dy4[4] = {0, 1, 0, -1};
#define WHITE 0
#define GRAY 1
#define BLACK 2
int H, W;
vector<string> maze;

int bfs(int sy, int sx, int gy, int gx)
{
    int seen[30][30];
    int dist[30][30];
    rep(i, 30)
    {
        rep(j, 30)
        {
            seen[i][j] = 0;
            dist[i][j] = 0;
        }
    }

    queue<int> yque;
    queue<int> xque;
    seen[sy][sx] = true;
    dist[sy][sx] = 0;
    yque.push(sy);
    xque.push(sx);

    while (!yque.empty() && !xque.empty())
    {
        int nowy = yque.front();
        yque.pop();
        int nowx = xque.front();
        xque.pop();

        for (int i = 0; i < 4; i++)
        {
            int nexty = nowy + dy4[i];
            int nextx = nowx + dx4[i];

            bool isOKY = (0 <= nexty && nexty < H);
            bool isOKX = (0 <= nextx && nextx < W);

            if (!(isOKY && isOKX))
                continue;
            if (maze[nexty][nextx] == '#')
                continue;
            if (seen[nexty][nextx])
                continue;

            seen[nexty][nextx] = true;
            dist[nexty][nextx] = dist[nowy][nowx] + 1;

            yque.push(nexty);
            xque.push(nextx);
        }
    }

    return dist[gy][gx];
}

void solve()
{

    // remove the bottom 3 lines when you submit this code.
    std::ifstream in("sample.txt");
    std::cin.rdbuf(in.rdbuf());

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

    cin >> H >> W;
    maze.resize(H);
    rep(h, H) cin >> maze[h];

    int ans = 0;
    for (int sh = 0; sh < H; sh++)
    {
        for (int sw = 0; sw < W; sw++)
        {
            for (int gh = 0; gh < H; gh++)
            {
                for (int gw = 0; gw < W; gw++)
                {
                    if (maze[sh][sw] == '#')
                        continue;
                    if (maze[gh][gw] == '#')
                        continue;
                    ans = max(ans, bfs(sh, sw, gh, gw));
                }
            }
        }
    }

    cout << ans << endl;
}

signed main()
{
    solve();
    return 0;
}


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

typedef long long ll;
#define all(x) (x).begin(), (x).end()  // sortなどの引数を省略
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define max3(x, y, z) max(x, max(y, z))
#define min3(x, y, z) min(x, min(y, z))

#ifdef _MSC_FULL_VER  //デバッグ出力
#define dout cout
#define debug() if (true)
#define check(x) std::cout << "★" << #x << "の値:" << (x) << endl
#define pass(x) std::cout << "☆" << x << endl
#else
#define dout \
  if (false) cout
#define debug() if (false)
#define check(x) \
  if (false) cout << "★" << #x << "の値:" << (x) << endl
#define pass(x) \
  if (false) cout << "☆" << x << endl
#endif

using namespace std;
int main() {
  ll N;
  cin >> N;
  vector<tuple<string,int,int>> shop(N);
  string tmp;
  int tmp2;
  rep(i, N) {
    cin >> tmp >> tmp2;
    tmp2 = 100 - tmp2;
    shop[i] = make_tuple(tmp, tmp2,i);
  }
  sort(all(shop));
  rep(i, N) {
    cout << get<2>(shop[i])+1 << endl;
  }
}
/*
//よく使うやつ
int N;
cin >> N;
vector<int> list(N);
rep(i,N) {
  cin >> list[i];
}
//配列(スタックとしても使える)
vector<int> list;
list.at(i)
vector<vector<int>> list(10, vector<int>(10));
//ソート クイックだからO(NlogN)
sort(all(list));
sort(all(list), greater<int>());

//配列の内容表示
dout << "====listの内容====\n";
for (int edp = 0; edp < N; edp++) dout << list[edp] << endl;
dout << "====ここまで====\n";


//配列の最小最大(Nは要素数)
*min_element(all(c))
*max_element(all(c))

//a[0]からa[N]を逆順にする(計算量はO(N))
reverse(all(a));
//listの末尾に要素を追加
list.push_back(10);
//listの末尾から要素を削除
list.pop_back();
//空ですか？
list.empty()



//キュー(待ち行列)
//定義
queue<int> a;
//追加
a.push(x);
//取る
a.pop();
//チェック
a.front()
//サイズ
a.size()
//空ですか
a.empty()



//優先度付きキュー※全部計算量がO(NlogN)あるので注意
// int 型の要素を持ち、最も小さい値を取り出す形の priority_queue を定義
priority_queue<int, vector<int>, greater<int>> Q1;
// double 型の要素を持ち、最も大きい値を取り出す形の priority_queueを定義
priority_queue<double, vector<double>, less<double>> Q2;
//追加
a.push(x);
//取る
a.pop();
//一番小さいの教えて下さい
a.top()
//サイズ
a.size()
//空ですか
a.empty()



//部分文字列
//添字3から5文字
s.substr(3,5)
//添字3から全部
s.substr(3)

//入れ替え
swap(a,b);



// int 型の番地に string 型の変数を記録する場合（2^31 要素の
string型配列と同じような感じ） map<int, string> mp; for (auto itr =mp.begin();
itr != mp.end(); itr++) {
    //順番にマップを眺める。itr->firstでキー、itr->secondがバリュー
}

//ソート済みのaの中で初めてx以上になるインデックスを返す
lower_bound(all(a), x) - a

//next_permutation
do {
  //ここにパーテーションがくる
} while (next_permutation(s.begin(), s.end()));

//set
set<int> hoge;
hoge.insert(50);  //hogeに挿入。重複は無視される。
hoge.insert(20);  //内部は小さい順に並ぶ
hoge.erase(50);   //hogeから消し去る。
//40以上である最小の要素を指すイテレーターを返す。
//もちろんそんなものはないからEndが出力される
auto itr1 = Set.lower_bound(40);
if (itr1 == Set.end()) cout << "End" << endl;
else cout << (*itr1) << endl;

//pair
//たくさんつくる
vector<pair<int,string>> hoge(10);
//参照
hoge[0].first
sort(all(hoge), greater<pair<int, string>>());




*/


Measured memory_bytes: 3596
n = gets.to_i
as = gets.chomp.split.map(&:to_i)
ans = Array.new(n,0)
as.each_with_index do |a,i|
	if i % 2 == 0
		ans[0] += a
	else
		ans[0] -= a
	end
end

(1..n-1).each do |i|
	ans[i] = 2 * as[i-1] - ans[i-1]
end

puts ans.join(" ")

Measured memory_bytes: 15108
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>

using namespace std;

#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 1e9
#define rep(i,n) for(i=0;i<n;i++)
#define loop(i,a,n) for(i=a;i<n;i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

typedef vector<int> vi;
typedef pair<int,int> pii;

int main(void) {
  int i,j;
  vi n(6);
  rep(i,6)
    cin>>n[i];
  cout<<(n[0]+5*n[1]+10*n[2]+50*n[3]+100*n[4]+500*n[5]>=1000)<<endl;
}

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

//#define int long long
typedef long long ll;

typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = mod * mod;
const int INF_N = 1e+9;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
#define all(v) (v).begin(),(v).end()
typedef pair<ll, ll> LP;
typedef long double ld;
typedef pair<ld, ld> LDP;
const ld eps = 1e-12;
const ld pi = acos(-1.0);
//typedef vector<vector<ll>> mat;
typedef vector<int> vec;

//繰り返し二乗法
ll mod_pow(ll a, ll n, ll m) {
	ll res = 1;
	while (n) {
		if (n & 1)res = res * a%m;
		a = a * a%m; n >>= 1;
	}
	return res;
}

struct modint {
	ll n;
	modint() :n(0) { ; }
	modint(ll m) :n(m) {
		if (n >= mod)n %= mod;
		else if (n < 0)n = (n%mod + mod) % mod;
	}
	operator int() { return n; }
};
bool operator==(modint a, modint b) { return a.n == b.n; }
modint operator+=(modint &a, modint b) { a.n += b.n; if (a.n >= mod)a.n -= mod; return a; }
modint operator-=(modint &a, modint b) { a.n -= b.n; if (a.n < 0)a.n += mod; return a; }
modint operator*=(modint &a, modint b) { a.n = ((ll)a.n*b.n) % mod; return a; }
modint operator+(modint a, modint b) { return a += b; }
modint operator-(modint a, modint b) { return a -= b; }
modint operator*(modint a, modint b) { return a *= b; }
modint operator^(modint a, int n) {
	if (n == 0)return modint(1);
	modint res = (a*a) ^ (n / 2);
	if (n % 2)res = res * a;
	return res;
}

//逆元(Eucledean algorithm)
ll inv(ll a, ll p) {
	return (a == 1 ? 1 : (1 - p * inv(p%a, a)) / a + p);
}
modint operator/(modint a, modint b) { return a * modint(inv(b, mod)); }

const int max_n = 1 << 18;
modint fact[max_n], factinv[max_n];
void init_f() {
	fact[0] = modint(1);
	for (int i = 0; i < max_n - 1; i++) {
		fact[i + 1] = fact[i] * modint(i + 1);
	}
	factinv[max_n - 1] = modint(1) / fact[max_n - 1];
	for (int i = max_n - 2; i >= 0; i--) {
		factinv[i] = factinv[i + 1] * modint(i + 1);
	}
}
modint comb(int a, int b) {
	if (a < 0 || b < 0 || a < b)return 0;
	return fact[a] * factinv[b] * factinv[a - b];
}
using mP = pair<modint, modint>;

int dx[4] = { 0,1,0,-1 };
int dy[4] = { 1,0,-1,0 };




void solve() {
    string s; cin >> s;
    unordered_map<char, int> m;
    rep(i, 4) m[s[i]]++;
    for(auto p: m){
        if(p.second != 2){
            cout << "No" << endl;
            return;
        }
    }
    cout << "Yes" << endl;
}

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  //cout << fixed << setprecision(10);
  //init_f();
  //init();
  //int t; cin >> t; rep(i, t)solve();
  solve();
//   stop
    return 0;
}


Measured memory_bytes: 7728
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 1e18;

void solve(long long N, std::vector<long long> P){
    vector<ll> M(N, P[0]);
    for(ll i = 1; i < N; ++i){
        M[i] = min(P[i], M[i-1]);
    }
    //for(auto m : M) cout << m << endl;
    ll cnt = 0;
    for(ll i = 0; i < N; ++i){
        if(P[i] == M[i]) cnt++;
    }
    cout << cnt << endl;
    return;
}

int main(){
    long long N;
    scanf("%lld",&N);
    std::vector<long long> P(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&P[i]);
    }
    solve(N, std::move(P));
    return 0;
}


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

int main(void) {
  long long N;
  cin >> N;
  long long ans = LLONG_MAX;
  for (long long i = 1; i * i <= N; i++) {
    if (N % i == 0) {
      long long j = N / i;
      ans = min(ans, (i - 1) + (j - 1));
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256