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

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

#define INF 1 << 30
#define REP(i,n) for(ll i=0; i<(int)(n); i++)
#define FOR(i,k,n) for(ll i=(k);i<(int)(n);i++)


int n;
ll x[100], y[100], h[100];

int main(){
  cin >> n;
  REP(i,n) cin >> x[i] >> y[i] >> h[i];
  REP(i,101){
    REP(j,101){
      ll H;
      REP(k,n){
        if(h[k]>0){
          H = h[k] + abs(y[k]-i) + abs(x[k]-j);
          break;
        }
      }
      bool flag = true;
      REP(k,n){
        ll a = max(0ll,H-abs(y[k]-i)-abs(x[k]-j));
        if(h[k]!=a){
          flag = false;
          break;
        }
      }
      if(flag==false) continue;
      cout << j << " " << i << " " << H <<endl;
      return 0;
    }
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define R cin>>
#define Z class
#define ll long long
#define ln cout<<'\n'
#define in(a) insert(a)
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define all(c) (c).begin(),(c).end()
#define iter(c) __typeof((c).begin())
#define rrep(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++)
template<Z A>void pr(A a){cout<<a;ln;}
template<Z A,Z B>void pr(A a,B b){cout<<a<<' ';pr(b);}
template<Z A,Z B,Z C>void pr(A a,B b,C c){cout<<a<<' ';pr(b,c);}
template<Z A,Z B,Z C,Z D>void pr(A a,B b,C c,D d){cout<<a<<' ';pr(b,c,d);}
template<Z A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}ln;}
ll check(ll n,ll m,ll x,ll y){return x>=0&&x<n&&y>=0&&y<m;}
const ll MAX=1e9+7,MAXL=1LL<<61,dx[4]={-1,0,1,0},dy[4]={0,1,0,-1};
typedef pair<ll,ll> P;

void Main() {
  ll n,m;
  cin >> n >> m;
  pr((ll)ceil((double)n/(m*2+1)));
}

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


Measured memory_bytes: 256
import java.util.*;
public class Main  {
    public static void main(String[] args) {
        Scanner sc =new Scanner (System.in);
        int n=sc.nextInt();
        int []arr1=new int[n];
        int []arr2=new int[n];
        for(int i=0;i<n;i++)
        {
            arr1[i]=sc.nextInt();
            arr2[i]=sc.nextInt();
        }
        int res[]=new int [n];
        for(int i=0;i<n;i++)
        {
            if(arr1[i]==arr2[i])
            {
                res[i]=1;
            }
        }
        boolean flag=false;
        for(int i=0;i+2<n;i++)
        {
            if(res[i]==res[i+1]&&res[i+1]==res[i+2]&&res[i+2]==1)
            {
                flag=true;
            }
        }
        if(flag==true)
        {
            System.out.println("Yes");
        }
        else
        {
            System.out.println("No");
        }
        // String s=sc.nextLine();
        // int length=s.length();
        // char c=s.charAt(length-1);
        // if(Character.isLowerCase(c))
        // {
        //     if(c=='s')
        //     {
        //         System.out.println(s+"es");
        //     }
        //     else{
        //         System.out.println(s+"s");
        //     }
        // }
        sc.close();
    }
}


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

int main() {
  int N;
  cin >> N;
  vector<int> v(N);
  for (int i = 0; i < N; i++) cin >> v[i];

  int sum = accumulate(v.begin(), v.end(), 0);
  int max = *max_element(v.begin(), v.end());
  if (max < sum - max)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}


Measured memory_bytes: 256
using System;

public class Hello
{
    public static void Main()
    {
        while (true)
        {
            string[] line = Console.ReadLine().Trim().Split(' ');
            var t = int.Parse(line[0]);
            var h = int.Parse(line[1]);
            var s = int.Parse(line[2]);
            if (t == -1 && h == -1 && s == -1) break;
            var def = new TimeSpan(2, 0, 0) - new TimeSpan(t, h, s);
            Console.WriteLine(def.ToString());
            var t3 = TimeSpan.FromSeconds(def.TotalSeconds * 3);
            Console.WriteLine(t3.ToString());
        }
    }
}

Measured memory_bytes: 9088
#include <iostream>
#include <vector>
#include <set>
using namespace std;

int main() {
    /* 入力受け取り */
    int n;
    cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n; ++i) cin >> a[i];

    /* しゃくとり法 */
    long long res = 0;
    int right = 0;
    int sum = 0; // AND 和
    for (int left = 0; left < n; ++left) {
        while (right < n && (sum ^ a[right]) == (sum + a[right])) {
            sum += a[right];
            ++right;
        }
        res += right - left;
        sum -= a[left]; // a[left] を削除 (sum ^= a[left] でも OK)
        // if (left == right) ++right;
        // else {
        // }
    }

    cout << res << endl;
}


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

using namespace std;
typedef long long ll;

int main(){
    ll n;
    cin>>n;
    ll max=0;
    for(int i=1;i<=sqrt(n);i++){
        if(n%i==0) max = i;
    }
    cout<<max-1 + n/max - 1<<endl;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    int b = sc.nextInt();

    if(a >= 13) {
      System.out.println(b);
    } else if(a >= 6 && a <= 12) {
      System.out.println(b/2);
    } else {
      System.out.println(0);
    }
    
  }

}


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

#define rep(i, n) for(int i = 0; i < (n); i++)
using namespace std;
using ll = long long;

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

  vector<int> d(n);
  rep(i, n) cin >> d[i];
  int ans = 0;
  rep(i, n-1){
    for(int j = i+1; j < n; j++){
      ans += d[i] * d[j];
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
"use strict";
    
const main = arg => {
    arg = arg.split("\n");
    const k = parseInt(arg.slice(5, 6));
    const antennas = arg.slice(0,5).map(n=>parseInt(n));//arg.map(n=>parseInt(n));
    
    for(let i=0; i<antennas.length; i++) {
        for(let j=i+1; j<antennas.length; j++) {
            if(antennas[j] - antennas[i] > k) {
                console.log(":(");
                return;
            }   
        }
    }
    
    console.log("Yay!");
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));


Measured memory_bytes: 21064
#include <iostream>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <iomanip>
#include <cmath>
using namespace std;

long long mod = 1000000007;

long long mypow(long long a, long long b){
  if(b == 1) return a;
  long long t = mypow(a, b / 2);
  if(b % 2 == 0) return (t * t) % mod;
  else return (((t * t) % mod) * a) % mod;
}

void solve(){
  long long x, y, l, r, u = 1, d = 1; cin >> x >> y;
  if((x + y) % 3 != 0 || max(x, y) > 2 * min(x, y)){
    cout << 0 << endl;
    return;
  }
  l = (x + y) / 3;
  r = min(x, y) - l;
  for(int i = l; i >= l - r + 1; i--){
    u = (u * i) % mod;
  }
  //cout << u << endl;
  for(int i = 1; i <= r; i++){
    d = (d * i) % mod;
  }
  //cout << d << endl;
  d = mypow(d, mod - 2);
  //cout << d << endl;
  cout << (u * d) % mod<< endl;

  /*for(int i = 1; i < 13; i++){
    cout << i << " : " << mypow(i, mod - 2) << endl;
  }*/
  return;
}

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
	int N,c;
	cin>>N;
	for(int i=1;i<=9;i++){
		for(int j=1;j<=9;j++){
			if(N==i*j){
				cout<<"Yes"<<endl;
				return 0;
			}
		}
	}
	cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,l,r) for(long long i=(l);i<(r);++i)
#define REP(i,n) FOR(i,0,n)
#define REPS(i,n) FOR(i,1,n+1)
#define RFOR(i,l,r) for(long long i=(l);i>=(r);--i)
#define RREP(i,n) RFOR(i,n-1,0)
#define RREPS(i,n) RFOR(i,n,1)
#define int long long
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define SZ(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
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 INF = 1e18;

signed main(){
    double n, m, d; cin >> n >> m >> d;
    double ans = max(n-d,0.0)*(d !=0 ? 2 : 1) / (n*n) * (m-1);
    cout << fixed << setprecision(20.20) << ans << endl;
}

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

int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n,g=0,m=0,k;
	cin>>n>>k;
	for(int i=1;i<=n;i++){
		int x;
		cin>>x;
		g=__gcd(x,g);
		m=max(m,x);
	}
	if(k%g==0&&k<=m)
		cout<<"POSSIBLE"<<endl;
	else
		cout<<"IMPOSSIBLE"<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
//NOT TO SUBMIT IN WRONG PLACE OR BY WRONG COMPILER
//ABC 177, task b, 2020/08/29
//ms,
/*
*/

int main(void){
  string s;
  string t;
  int max_cor=0;

  cin >>s >>t;
  for(int i=0; i<s.size()-t.size()+1; i++){
    int same_chars=0;
    for(int j=0;j<t.size();j++){
      if(s.at(i+j) == t.at(j)) same_chars++;
    }
    max_cor = max(max_cor, same_chars);
  }
  cout <<t.size()-max_cor <<endl;
  return 0;
}
/*
*/


Measured memory_bytes: 3604
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		final Scanner sc = new Scanner(System.in);
		String s = sc.next();
		char[] o = s.toCharArray();
		int l = s.length();
		String f = "%0"+(l-1)+"s";
		long ans = 0L;
		for(int i = 0; i < 1<<(l-1); i++) {
			String p = Integer.toBinaryString(i);
			while(p.length() < l-1) {
				p = "0"+p;
			}
			char[] pp = p.toCharArray();
			//System.out.println(Arrays.toString(o));
			//System.out.println(Arrays.toString(pp));
			char[] chars = new char[l*2-1];
			for(int j = 0; j < chars.length; j++) {
				if(j%2==0) chars[j]=o[j/2];
				else  {
					chars[j]=pp[(j-1)/2];
					if(chars[j]=='1') {
						chars[j]='p';
					}
				}
			}
			String p1 = new String(chars);
			p1 = p1.replaceAll("0", "");
			String[] nums = p1.split("p");
			ans += Arrays.stream(nums).mapToLong(Long::parseLong).sum();
		}
		System.out.println(ans);
	}
}


Measured memory_bytes: 26964
#include <bits/stdc++.h>
#define ll long long
#define endl "\n"
using namespace std ;
int main()
{
    ios_base::sync_with_stdio(false) ;
    cin.tie(0);
    cout.tie(0);
    int n ;
    cin >> n ;
    cin.ignore() ;
    string str ;
    cin >> str ;
    int cnt = 0 ;
    for(int i = 0 ; i < str.length() && i < n ; i++)
    {
        if(i >= str.length()-2) break ;
        else
        {
            if(str[i] == 'A' && str[i+1] =='B' && str[i+2] == 'C') cnt++ ;
        }

    }
    cout << cnt << endl ;

}


Measured memory_bytes: 3548
n,m=map(int,input().split())
ss=[list(map(int,input().split())) for i in range(n)]
che=[list(map(int,input().split())) for i in range(m)]
for i in range(n):
    ans=100000000000000000000000000000000000000000000000000000
    x,y=ss[i]
    for  j in range(m):
        if ans>abs(x-che[j][0])+abs(y-che[j][1]):
            ans=abs(x-che[j][0])+abs(y-che[j][1])
            ind=j
    print(ind+1)


Measured memory_bytes: 9152
#include <stdio.h>
#include <math.h>

int main( void )
{
	double r, r2, area, around;

	scanf( "%lf", &r );

	r2 = pow( r, 2.0 );

	area = M_PI * ( r * r );
	around = 2 * M_PI * r;
	
	printf( "%.05lf %.05lf\n", area, around );

	return 0;
}

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

ll solve(ll h, ll w)
{
    ll res = h*w;
    ll t_area = h*w;
    for(ll i=1; i<w; i++)
    {
        ll a = i*h;
        ll b = (w-i)*(h/2);
        ll c = t_area - a - b;
        ll tmp = max({a,b,c}) - min({a,b,c});
        res = min(res, tmp);
//        cout<<a<<" "<<b<<" "<<c<<" "<<tmp<<"\n";
    }
//    cout<<"------\n";
    for(ll i=1; i<h; i++)
    {
        ll a = i*w;
        ll b = (h-i)*(w/2);
        ll c = t_area - a - b;
        ll tmp = max({a,b,c}) - min({a,b,c});
        res = min(res, tmp);
//        cout<<a<<" "<<b<<" "<<c<<" "<<tmp<<"\n";
    }
    res = min({res, w, h});
    return res;
}

int main() {
    
    ll h, w;
    cin >> h >> w;
    if(h % 3 == 0 || w % 3 == 0) cout << 0 << endl;
    else
        cout << solve(h, w);
    
    return 0;
}

Measured memory_bytes: 256
#include<deque>
#include<queue>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<cmath>
#include<tuple>
#include<string>
#include<chrono>
#include<functional>
#include<iterator>
#include<random>
#include<unordered_set>
#include<unordered_map>
#include<array>
#include<map>
#include<bitset>
#include<iomanip>
using namespace std;
typedef long long int llint;
typedef long double lldo;
#define mp make_pair
#define mt make_tuple
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define fir first
#define sec second
#define res resize
#define ins insert
#define era erase
#define RE return 0
//ios::sync_with_stdio(false);
//std::cin.tie(0);
//<< setprecision(20)
const int mod=1e9+7;
const llint big=1e15+100;
const long double pai=3.141592653589793238462643383279502884197;
const long double ena=2.71828182845904523536;
const long double eps=1e-7;
template <class T,class U>void mineq(T& a,U b){if(a>b){a=b;}}
template <class T,class U>void maxeq(T& a,U b){if(a<b){a=b;}}
template <class T> void soun(T& ar)
{sort(ar.begin(),ar.end());ar.erase(unique(ar.begin(),ar.end()),ar.end());}
int main(void){
	llint n,q;cin>>n>>q;
	while(q--){//完全なので余裕
		//親は(ter-2)/n +1
		//深さを求めない実装
		int v,w;cin>>v>>w;
		if(n==1){cout<<min(v,w)<<endl;continue;}
		while(v!=w){
			if(v>w){swap(v,w);}
			w=(w-2)/n +1;
		}
		cout<<v<<endl;
	}
	RE;
}

Measured memory_bytes: 1280
spade = list(range(1, 14))
heart = list(range(1, 14))
club = list(range(1, 14))
diamond = list(range(1, 14))

n = int(input())
for i in range(n):
    table = input().split(' ')
    mark = table[0]
    num = int(table[1])
    if mark == 'S':
        spade.remove(num)
    elif mark == 'H':
        heart.remove(num)
    elif mark == 'C':
        club.remove(num)
    else:
        diamond.remove(num)

def output_trump(mark, list):
    for num in list:
        print('{} {}'.format(mark, num))

output_trump('S', spade)
output_trump('H', heart)
output_trump('C', club)
output_trump('D', diamond)


Measured memory_bytes: 5596
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <iomanip>
#include <limits>
#include <list>
#include <queue>
#include <tuple>
#include <map>
#include <stack>
#include <set>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define INF (int)(1123456789)
#define LINF (long long int)(112345678901234567)
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
#define all(v) v.begin(), v.end()

const int N = (int)3e5;

ll mpow(ll a, ll b){
  if(b==0) return 1;
  else if(b%2==0){ll memo = mpow(a,b/2); return memo*memo%MOD;}
  else return mpow(a,b-1) * a % MOD;
}
ll lpow(ll a, ll b){
  if(b==0) return 1;
  else if(b%2==0){ll memo = lpow(a,b/2); return memo*memo;}
  else return lpow(a,b-1) * a;
}
ll gcd(ll a, ll b){
  if(b==0) return a;
  else return gcd(b, a%b);
}
vector<ll> kaijo_memo;
ll kaijo(ll n){
  if(kaijo_memo.size() > n) return kaijo_memo[n];
  if(kaijo_memo.size() == 0) kaijo_memo.push_back(1);
  while(kaijo_memo.size() <= n) kaijo_memo.push_back(kaijo_memo[kaijo_memo.size()-1] * kaijo_memo.size() % MOD);
  return kaijo_memo[n];
}
vector<ll> gyaku_kaijo_memo;
ll gyaku_kaijo(ll n){
  if(gyaku_kaijo_memo.size() > n) return gyaku_kaijo_memo[n];
  if(gyaku_kaijo_memo.size() == 0) gyaku_kaijo_memo.push_back(1);
  while(gyaku_kaijo_memo.size() <= n) gyaku_kaijo_memo.push_back(gyaku_kaijo_memo[gyaku_kaijo_memo.size()-1] * mpow(gyaku_kaijo_memo.size(), MOD-2) % MOD);
  return gyaku_kaijo_memo[n];
}

ll nCr(ll n, ll r){
  if(n == r) return 1;//0個の丸と-1個の棒みたいな時に時に効く？不安.
  if(n < r || r < 0) return 0;
  ll ret = 1;
  ret *= kaijo(n); ret %= MOD;
  ret *= gyaku_kaijo(r); ret %= MOD;
  ret *= gyaku_kaijo(n-r); ret %= MOD;
  return ret;
}


int main(void){
  ll x;cin>>x;
  if(x >= 2000){
    cout<<1<<endl;
    return 0;
  }
  ll count = x/100;
  if(x - count*100 <= count * 5){
    cout<<1<<endl;
  }else{
    cout<<0<<endl;
  }
  return 0;
}


Measured memory_bytes: 256
use std::io::{self, BufRead, BufWriter, Write};

fn solve<R, W>(reader: R, mut writer: W)
where
    R: BufRead,
    W: Write,
{
    let mut lines = reader.lines();
    let a: i32 = lines.next().unwrap().unwrap().parse().unwrap();
    let s = lines.next().unwrap().unwrap();

    let ans = if a >= 3200 { &s } else { "red" };

    writeln!(&mut writer, "{}", ans).unwrap();
}

fn main() {
    let stdio = io::stdin();
    let input = stdio.lock();

    let stdout = io::stdout();
    let output = BufWriter::new(stdout.lock());

    solve(input, output);
}

#[cfg(test)]
mod tests {
    use super::*;

    const TESTS: &'static [(&'static [u8], &'static [u8])] = &[
        (
            br"3200
pink", br"pink
",
        ),
        (
            br"3199
pink", br"red
",
        ),
        (
            br"4049
red", br"red
",
        ),
    ];

    #[test]
    fn test_a() {
        for &(input, expected) in TESTS {
            let mut output = Vec::new();
            solve(input, &mut output);
            let expected_str = String::from_utf8(expected.to_vec()).unwrap();
            let output_str = String::from_utf8(output).unwrap();
            assert_eq!(expected_str, output_str);
        }
    }
}


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

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

    int a[n], b[n], c[n];
    for(int i = 0; i < n; ++i) {
        cin >> a[i] >> b[i] >> c[i];
    }

    int da[n], db[n], dc[n];
    da[0] = a[0], db[0] = b[0], dc[0] = c[0];

    for(int i = 1; i < n; ++i) {
        da[i] = max(db[i-1], dc[i-1]) + a[i];
        db[i] = max(da[i-1], dc[i-1]) + b[i];
        dc[i] = max(db[i-1], da[i-1]) + c[i];
    }
    cout << max(da[n-1], max(db[n-1], dc[n-1])) << endl;
}

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

int main(void){
    string s;
    cin >> s;
    if(s[0] == s[1] || s[1] == s[2] || s[2] == s[0]){
        cout << "No" << endl;
    }else{
        cout << "Yes" << endl;
    }
    
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<sstream>
#include<vector>
#include<algorithm>
#include<string>
#include<stdexcept>
#include<stdio.h>
#include<queue>
using namespace std;
using P=pair<int,int>;
typedef long long  ll;

 int main(){
   int a,b,t; int ans=0;
   cin >>a>>b>>t;
   for(int i=1;i<30;i++){
     if(i*a<=t) ans+=b;
     else break;
   }
   cout << ans <<endl;
 }
   

Measured memory_bytes: 256
using System;

namespace AtCoder.ABC._122
{
    class b
    {
        static void Main(string[] args)
        {
            var line = Console.ReadLine().Trim();
            var S = line.ToCharArray();
            var cnt = 0;
            var max = 0;
            foreach(var c in S)
            {
                if ("ACGT".Contains(c.ToString()))
                {
                    ++cnt;
                }
                else
                {
                    if(max < cnt)
                    {
                        max = cnt;
                    }
                    cnt = 0;
                }
            }
            if (max < cnt)
            {
                max = cnt;
            }
            Console.WriteLine(max);
        }
    }
}


Measured memory_bytes: 11092
#include <stdio.h>
#include <string.h>
 
char S[105];
 
int main() {
 
	int N;
 
	scanf("%d",&N);
 
	scanf("%s",S);
 
	int len=strlen(S);
 
	int i,j;
 
	int ans=0;
 
	for(i=0;i<len;i++){
		int history[2][26]={0};
		for(j=0;j<=i;j++){
		history[0][S[j]-'a']++;
		}
		for(j=i+1;j<len;j++){
		history[1][S[j]-'a']++;
		}
		int cnt=0;
 
		for(j=0;j<26;j++){
			if(history[0][j]>0&&history[1][j]>0){cnt++;}
		}
 
		if(ans<cnt){ans=cnt;}
	}
 
	printf("%d\n",ans);
 
	return 0;
}

Measured memory_bytes: 128
#include<iostream>
using namespace std;
using ll = long long;
ll fact[(int)1e6 + 5];
ll fact_inv[(int)1e6 + 5];

const ll MOD = (int)1e9 + 7;
// 繰り返し二乗法
ll power(ll a, ll b){
  ll res=1;
  while(b>0){
    if(b&1) res=res*a%MOD;
    a=a*a%MOD;
    b>>=1;
  }
  return res;
}

ll comb(ll n, ll r){
	return (fact[n]*fact_inv[r])%MOD*fact_inv[n-r]%MOD;
}

int main(){
  int x, y;
  cin >> x >> y;
  if((x+y)%3 != 0){
    cout << 0 << "\n";
    return 0;
  }

  int a = (2 * x - y) / 3;
  int b = (2 * y - x) / 3;
  if(a < 0 || b < 0){
    cout << 0 << "\n";
    return 0;
  }
  int n = a + b + 100000;

  fact[0] = 1;
  for (int i = 0; i < n; i++){
    fact[i + 1] = fact[i] * (i + 1) % MOD;
  }
  fact_inv[n] = power(fact[n], MOD - 2);
  for (int i = n - 1; i >= 0; i--){
    fact_inv[i] = fact_inv[i + 1] * (i + 1) % MOD;
  }
  cout << comb(a + b, a) << "\n";

  return 0;
}

Measured memory_bytes: 14592
#include <iostream>
#include <vector>
using namespace std;
int main(void){
  int N,M;
  cin >> N >> M;
  
  vector<bool>reach_1toi(N + 1,false);
  vector<bool>reach_itoN(N + 1,false);
  for(int i=0;i<M;i++){
    int a,b;
    cin >> a >> b;
    if(a == 1)
      reach_1toi[b] = true;
    if(b == 1)
      reach_1toi[a] = true;
    if(a == N)
      reach_itoN[b] = true;
    if(b == N)
      reach_itoN[a] = true;
  }
  
  bool ans = false;
  
  for(int i=2;i<N;i++){
    if(reach_1toi[i] == true && reach_itoN[i] == true)
      ans = true;
  }
  
  if(ans)
    cout << "POSSIBLE" << endl;
  else
    cout << "IMPOSSIBLE" << endl;
  
  return 0;
}

      


Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <math.h>
#define PI 3.1415926535897932384626433832795

using namespace std;

double radian(int degree)
{
	return (PI * degree) / 180;
}

int main()
{
	double x = 0;
	double y = 0;
	int degree = 0;

	int walk, turn;
	while(true)
	{
		scanf("%d,%d", &walk, &turn);
		if(walk == 0 && turn == 0)
			break;

		x -= cos( radian(degree - 90) ) * walk;
		y -= sin( radian(degree - 90) ) * walk;
		degree -= turn;
	}

	cout << int(x) << endl << int(y) << endl;

	return 0;
}

Measured memory_bytes: 1204
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); i++)
#define sz(x) int(x.size())
using namespace std;
typedef long long ll;
const int inf = 1001001001;


int main(){

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

  
  ll ans = 0;
  for(int k = 1; k < n+1; k++){
    ans += ll(k)*d[k];
  }
  cout << ans << endl;
}


Measured memory_bytes: 42272
# n = int(input())
# mod = 10**9+7
# print((10**n - (9**n)*2 + 8**n) % mod)
n = int(input())
mod = 10**9+7
print((pow(10, n, mod) - 2*pow(9, n, mod) + pow(8, n, mod))%mod)


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

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

#define F first
#define S second
#define PB push_back
#define MP make_pair
#define what_is(x) cerr << #x << " is " << x << endl;
#define MT make_tuple
#define eb emplace_back
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))

#define REP(i,a,b) for (int i = a; i <= b; i++)
#define FOR(i,n) for (int i=0;i < n ; i++)
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " = " << a << endl;
	err(++it, args...);
}

int main(){
	int n,odd=0,div2=0,div4=0;
	cin >> n;
	ll a;
	FOR(i,n){
		cin >> a;
		if(a%2) odd++;
		else if(a%4) div2=1;
		else div4++;
	}
	if(div4>=odd+div2-1) cout <<"Yes";
	else cout << "No";
	return 0;
}

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

int main() {
	int n, m;
	cin >> n >> m;
	int sum = 0;
	for (int i = 0; i < m; ++i) {
		int a;
		cin >> a;
		sum += a;
	}
	cout << ((n - sum >= 0) ? (n - sum) : -1) << '\n';
}

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


int main() {
  int a; cin>>a;
  if(a<100){cout<<0;}
  else if(a/100*5 >= a%100){cout<<1;}
  else{cout<<0;}
}
      

Measured memory_bytes: 3676
# https://atcoder.jp/contests/abc132/tasks/abc132_e
"""
タグ: bfs、拡張グラフ
"""

import sys
input = sys.stdin.readline
from collections import deque


class Graph:
    def __init__(self, n, directed=False, decrement=True, destroy=False, edges=[]):
        self.n = n
        self.directed = directed
        self.decrement = decrement
        self.destroy = destroy
        self.edges = [set() for _ in range(self.n)]
        self.visited = set()
        self.info = [-1]*self.n
        for x, y in edges:
            self.add_edge(x,y)

    def add_edge(self, x, y):
        if self.decrement:
            x -= 1
            y -= 1
        self.edges[x].add(y)
        if self.directed == False:
            self.edges[y].add(x)

    def add_adjacent_list(self, i, adjacent_list):
        if self.decrement:
            self.edges[i] = set(map(lambda x: x - 1, adjacent_list))
        else:
            self.edges[i] = set(adjacent_list)

    def bfs(self, start=1, goal=-1, time=0, save=False):
        """
        :param start: スタート地点
        :param goal: ゴール地点
        :param save: True = 前回の探索結果を保持する
        :return: （ループがあっても）最短距離。存在しなければ -1
        """
        if self.decrement:
            start -= 1
            goal -= 1
        p, t = start, time
        self.visited.add((p,0))
        next_set = deque([(p, t)])
        while next_set:
            p, t = next_set.popleft()
            for q in self.edges[p]:
                if (q, (t+1)%3) in self.visited:
                    continue
                if q == goal and (t+1)%3==0:
                    return (t+1)//3
                self.visited.add((q,(t+1)%3))
                next_set.append((q, t + 1))
        return -1

##################################################################################################

N, M = map(int, input().split())
graph = Graph(N, directed=True, decrement=True, destroy=False)
for _ in range(M):
    x, y = map(int, input().split())
    graph.add_edge(x, y)
S, T = map(int, input().split())
print(graph.bfs(start=S, goal=T))



Measured memory_bytes: 143116
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
using ll=long long;
using vi=vector<int>;
using vll=vector<ll>;
#define MOD 1000000007

int main(){
    int n;
    cin >> n;
    vi b(n);
    vi ans;
    rep(i,n) cin >> b[i];
    for(int i=0;i<n;i++){
        for(int j=b.size()-1;j>=0;j--){
            if(j+1==b[j]){
                ans.push_back(b[j]);
                b.erase(b.begin()+j);
                break;
            }
        }
    }
    if(b.size()) cout << "-1" << endl;
    else{
        reverse(ans.begin(),ans.end());
        for(int x: ans){
            cout << x << endl;
        }
    }  
}

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

dic = {}
ans = 0

for i in range(n):
    s = input()
    sss = "".join(sorted(s))
    #print(dic)
    #print(sss)
    if sss in dic:
        val = dic[sss]
        dic[sss] = val + 1
        ans = ans + val
        #print(dic[sss])
    else:
        dic.setdefault(sss, 1)

#print(dic)
print(ans)


Measured memory_bytes: 17892
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
char s[4] = {'L','R','U','D'}, t[4] = {'R','L','D','U'};

int main()
{
	int H,W,N;
	cin >> H >> W >> N;
	int sr,sc;
	cin >> sr >> sc;
	string S,T;
	cin >> S >> T;
	bool ans = true;
	int temp = sc;
	rep(i,N)
	{
		if (S[i] == 'L')
		{
			temp--;
			if (temp == 0) ans = false;
		}
		if (T[i] == 'R' && temp != W)
		{
			temp++;
		}
	}
	temp = sc;
	rep(i,N)
	{
		if (S[i] == 'R')
		{
			temp++;
			if (temp == W+1) ans = false;
		}
		if (T[i] == 'L' && temp != 1)
		{
			temp--;
		}
	}
	temp = sr;
	rep(i,N)
	{
		if (S[i] == 'U')
		{
			temp--;
			if (temp == 0) ans = false;
		}
		if (T[i] == 'D' && temp != H)
		{
			temp++;
		}
	}
	temp = sr;
	rep(i,N)
	{
		if (S[i] == 'D')
		{
			temp++;
			if (temp == H+1) ans = false;
		}
		if (T[i] == 'U' && temp != 1)
		{
			temp--;
		}
	}
	if (ans) cout << "YES" << endl;
	else cout << "NO" << endl;
	return 0;
}

Measured memory_bytes: 776
#include <bits/stdc++.h>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#define rep(i,n) for (long long i=0; i < (n); ++i)
#define rep2(i,n,m) for(long long i=n;i<=m;i++)
#define ALL(a)  (a).begin(),(a).end()
using namespace std;
using ll = long long;
using P = pair<int,int>;
const ll INF=1e18 ;
inline void chmax(ll& a,ll b){a=max(a,b);}
inline void chmin(ll& a,ll b){a=min(a,b);}
int main() {
 int  n ;
 cin >> n ;
vector<int> A(n) ;
vector<int> B(n) ;
vector<int> C(n) ;
rep(i,n) cin>> A[i] ;
rep(i,n) cin >> B[i] ;
rep(i,n) cin >>C[i] ;
sort(A.begin(),A.end()) ;
sort(C.begin(),C.end()) ;
ll ans=0 ;
rep(i,n){
ll p= lower_bound(ALL(A),B[i])-A.begin() ;
ll q= upper_bound(ALL(C),B[i])-C.begin() ;
ans+= p*(n-q) ;
}
 
 cout <<ans<<endl ;
     return 0;
}

Measured memory_bytes: 1536
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <iomanip>
#include <string>
#include <sstream>
//#include <bits/stdc++.h>
#define INF 0x3f3f3f3f
using namespace std;
/*struct shi
{
    int x;
    int T;
} s[100000];
int cmp(shi a,shi b)
{
    return a.x<b.x;
}
long long cmd(long long a, long long  b)
{
    return a > b;
}*/
/*typedef struct node {
    string name;
    int score;
    //struct node *next;

}student[1000000];
/*student * creatlist(int b){
    student *head = new student;
    student *pre = head;
    for(int i=1;i<=b;i++){
        student *p = new student ;
        p->num = i;
        pre->next = p;
        pre = p;
        p->next = NULL;
    }
    pre->next = head->next;//quan
    return head;

};*/
/*void kill(struct node *head){
    student *p ;
    p = head->next;
    do{
        for(int i=1;i<=4;i++){
            head = head->next;
            //sum++;
        }
            //return;
        p=head->next;
        head->next = head->next->next;
       // p=head;
        sum++;
        //cout<<p->num;
    }while(p->num!=1);
    //cout<<p->num<<endl;
    cout<<sum<<endl;
}*/

int main()
{
    int a,b,c,flag=0;
    cin>>a >>b >>c;
    for(int i=1;i<=100;i++)
        if(i*a%b==c)
    {
        cout<<"YES"<<endl;
        flag=1;
        break;
    }
    if(flag==0)
        cout<<"NO"<<endl;

    return 0;

}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
ll ans = 0;
const ll mo = 1000000007;
auto mod = [](ll modx) {modx%=mo;modx+=mo;modx%=mo;return modx; };

ll mypow(ll a, ll b)
{
  ll res = 1;
  a %= mo;
  while (b)
  {
    if (b & 1)
      res = res * a % mo;
    a = a * a % mo;
    b >>= 1;
  }
  return res;
}
int main()
{
ll n , a , b ;
cin >> n >> a >> b ;
ans=mypow(2,n);
ll an=1;
rep(i,a){
  an=mod(an*(n-i));
  an=mod(an*mypow(i+1,mo-2));
}
ans=mod(ans-an);
an=1;
rep(i,b){
  an=mod(an*(n-i));
  an=mod(an*mypow(i+1,mo-2));
}
ans=mod(ans-an);
ans=mod(ans-1);
cout << ans << endl;
return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cassert>
#include <cmath>
#include <climits>
#include <cstdlib>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define DEBUG 1
constexpr int kMod = 1000000007;
typedef long long LL;

int main() {
  int N, M; std::cin >> N >> M;
  std::map<int, int> m;
  std::vector<bool> b(N + 1, false);
  std::set<int> v;

  for (int i = 0; i < M; ++i) {
    int p; std::cin >> p;
    std::string S; std::cin >> S;
    if (b[p]) continue;

    if (S == "AC") {
      b[p] = true;
      v.insert(p);
    } else {
      m[p]++;
    }
  }

  int sum = 0;
  for (const auto& x : v) {
    sum += m[x];
  }
  std::cout << v.size() << " " << sum << std::endl;
}


Measured memory_bytes: 9600
#include <bits/stdc++.h>
using namespace std;
int n,ans,arr[2][8][100000],ctr[2][8];

int main(){
	int par,tmp,md;
	scanf("%d", &n);
	for (int i=0; i<n; i++){
		scanf("%d", &tmp);
		arr[0][tmp&7][ctr[0][tmp&7]] = tmp;
		ctr[0][tmp&7]++;
	}
	for (int i=1; i<10; i++){
		for (int j=7; j>=0; j--){
			for (int k=0; k<ctr[par][j]; k++){
				tmp = arr[par][j][k];
				md = (tmp>>(3*i))&7;
				arr[1-par][md][ctr[1-par][md]] = tmp;
				ctr[1-par][md]++;
			}
		}
		for (int hoge=0; hoge<8; hoge++){ctr[par][hoge] = 0;}
		par = 1-par;
	}
	tmp = 0;
	int dup = 0;
	for(int i=0; i<8; i++){
		for (int j=0; j<ctr[par][i]; j++){
			if(arr[par][i][j] == tmp){ dup++; tmp=0;} else {tmp=arr[par][i][j];}
		}
	}
	printf("%d\n", (n-dup*2));
}


Measured memory_bytes: 5504
// #includes {{{
#ifdef MY_DEBUG
#include "header/header.hpp"
#else
#include <bits/stdc++.h>
#endif

using namespace std;

#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define RREP(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define FOR(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();++i)
#define LET(x,a) __typeof(a) x(a)
//#define IFOR(i,it,c) for(__typeof((c).begin())it=(c).begin();it!=(c).end();++it,++i)
#define ALL(c) (c).begin(), (c).end()
#define MP make_pair

#define EXIST(e,s) ((s).find(e)!=(s).end())

#define RESET(a) memset((a),0,sizeof(a))
#define SET(a) memset((a),-1,sizeof(a))
#define PB push_back
#define DEC(it,command) __typeof(command) it=command

//debug

#define whole(f,x,...) ([&](decltype((x)) whole) { return (f)(begin(whole), end(whole), ## __VA_ARGS__); })(x)

typedef long long Int;
typedef unsigned long long uInt;
typedef long double rn;

template<class T>
T inf(){
	return numeric_limits<T>::has_infinity?numeric_limits<T>::infinity():(numeric_limits<T>::max()/2);
}

typedef pair<int,int> pii;

#ifdef MY_DEBUG
#include"print.hpp"
#include"debug.hpp"
#endif
// }}}

Int N;

void solve(){
	cout<<(N-2)*180<<endl;
}

//{{{ main fucnction
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	cin >> N;
	solve();
	return 0;
}

//}}}



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


int main(){
 	//freopen("in", "r", stdin);
  	//freopen("out", "w", stdout);
	int tc;
	//scanf("%d", &tc);
	tc = 1;
	for(int tt = 1 ; tt <= tc; ++tt){
	   	int n;
	   	scanf("%d", &n);
	   	printf("%d\n", (n*(n+1))/2);


	//	fprintf(stderr, "caso de teste %d resolvido\n", tt);
	//	fflush(stderr);
	}
	
	return 0;
}

Measured memory_bytes: 256
fun main(args:Array<String>){
  var n = readLine()!!.toInt()
  var w = readLine()!!.split(" ").map(String::toInt).toList()
  var all = 0
  var ans = 0
  var hoge = 0
  var abs = 0
  var num = 1000
  var t = 0
  for(i in 0..n-1){
    all += w[i]
  }
  for(i in 0..n-1){
    ans += w[i]
    hoge = all-ans
    abs = Math.abs(ans-hoge)
    if(abs<=num){
      num = abs
    }
  }
  println(num)
}

Measured memory_bytes: 37756
import java.util.Scanner;
import java.util.Arrays;
import java.util.StringJoiner;
// import java.util.Stack;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String[] dataString = scanner.nextLine().split(" ");
        
        //Stack<String> stack = new Stack<>();
        Stack stack = new Stack();
        
        for (String s : dataString) {
            int a;
            int b;
            switch (s) {
            case "+":
                a = Integer.parseInt(stack.pop());
                b = Integer.parseInt(stack.pop());
                stack.push(Integer.toString(a + b));
                break;
            case "-":
                a = Integer.parseInt(stack.pop());
                b = Integer.parseInt(stack.pop());
                stack.push(Integer.toString(b - a));
                break;
            case "*":
                a = Integer.parseInt(stack.pop());
                b = Integer.parseInt(stack.pop());
                stack.push(Integer.toString(a * b));
                break;
            default:
                stack.push(s);
                break;
            
            }
        }
        
        System.out.println(stack.pop());
    }
    
    private static class Stack {
        private int top = 0;
        private String[] data = new String[200];
        
        public String pop() {
            top--;
            return data[top];
            
        }
        
        public void push(String s) {
            data[top] = s;
            top++;
        }
    }
}


Measured memory_bytes: 26320
N = int(input())
X = list(map(int,input().split()))
MOD = 10**9+7

MAXN = N+5
fac = [1,1] + [0]*MAXN
finv = [1,1] + [0]*MAXN
inv = [0,1] + [0]*MAXN
for i in range(2,MAXN+2):
    fac[i] = fac[i-1] * i % MOD
    inv[i] = -inv[MOD%i] * (MOD // i) % MOD
    finv[i] = finv[i-1] * inv[i] % MOD

c = 0
f = fac[N-1]
ans = 0
for i in range(1,N):
    c += f * inv[i]
    c %= MOD
    ans += c * (X[i] - X[i-1])
    ans %= MOD
print(ans)


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

namespace AtCoder
{
	class Program
	{
		public static void Main()
		{
			var radius = IO.ReadDouble();
			IO.Write(2 * radius * Math.PI);
		}
	}

	public static class IO
	{
		public static string   Read()								 { return Console.ReadLine(); }
		public static string[] ReadArray(char iSplitter = ' ')		 { return Read().Split(iSplitter); }
		public static int	   ReadInt()							 { return int.Parse(Read()); }
		public static int[]	   ReadIntArray(char iSplitter = ' ')	 { return ReadArray().Select(iText => int.Parse(iText)).ToArray(); }
		public static long	   ReadLong()							 { return int.Parse(Read()); }
		public static long[]   ReadLongArray(char iSplitter = ' ')	 { return ReadArray().Select(iText => long.Parse(iText)).ToArray(); }
		public static double   ReadDouble()							 { return double.Parse(Read()); }
		public static double[] ReadDoubleArray(char iSplitter = ' ') { return ReadArray().Select(iText => double.Parse(iText)).ToArray(); }
		public static char[]   ReadCharArray()						 { return Read().ToCharArray(); }

		public static void Write(string iValue)									   { Console.WriteLine(iValue); }
		public static void Write(int iValue)									   { Console.WriteLine(iValue); }
		public static void Write(IEnumerable<int> iValue , string iJoinWord = " ") { Console.WriteLine(string.Join(iJoinWord , iValue)); }
		public static void Write(long iValue)									   { Console.WriteLine(iValue); }
		public static void Write(double iValue)									   { Console.WriteLine(iValue); }
		public static void Write(decimal iValue)								   { Console.WriteLine(iValue); }
		public static void Write(bool iValue)									   { Console.WriteLine(iValue ? "Yes" : "No"); }
	}

	public static class Util
	{
		public static long Gcd(long i0 , long i1) { return (i0 > i1) ? _Gcd(i0 , i1) : _Gcd(i1 , i0); }
		public static long Lcm(long i0 , long i1) { return (i0 * i1) / Gcd(i0 , i1); }
		public static long ModPow(long iBaseNumber , long iPow , long iModNumber)
		{
			var num = 1L;
			while(iPow != 0)
			{
				if((iPow & 0x1) != 0)
				{
					num = (num * iBaseNumber) % iModNumber;
				}
				iBaseNumber = (iBaseNumber * iBaseNumber) % iModNumber;
				iPow >>= 1;
			}
			return num;
		}

		private static long _Gcd(long i0 , long i1)	{ return (i1 == 0) ? i0 : _Gcd(i1 , i0 % i1); }
	}
}


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

using namespace std;

using ll = long long;

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

    ll a, b;
    cin >> a >> b;
    if (abs(b - a) <= 1) cout << "Brown\n";
    else cout << "Alice\n";

    return 0;
}


Measured memory_bytes: 256
/*by freesteed*/
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define pb push_back
#define fill(x,c) memset(x,c,sizeof(x))
#define fi first
#define se second
#define sz(A) (int)(A.size())
#define all(x) (x).begin(),(x).end()
#define caset int ___T; cin>>___T; for(int cs=1;cs<=___T;cs++)
#define get_be(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
//get_be biger & equal
typedef long long ll;
typedef pair<int,int> PII;
typedef vector<int> VI;
const ll mod=1e9+7;
const ll oo=1e9+10;
const int Max = 1e6+10;
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
//ll a[Max];
ll n,m;
//SUN, MON, TUE, WED, THU, FRI, or SAT.
void solve(){
	cin>>n;
	if(n&1){
		cout<<((double)(n+1)/2)/n;
	}else{
		cout<<0.5;
	}
}
int main() {
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	//caset{
		solve();
	//}
  	return 0;
}





Measured memory_bytes: 256
from sys import stdin
n = int(stdin.readline().rstrip())
li = [int(stdin.readline().rstrip()) for _ in range(n)]
li.sort()
if n%2 == 1:
    mid = li[n//2]
    mae = li[:n//2]
    ushiro = li[n//2+1:]
    sono1 = -mid - mae[-1]
    sono1 += sum(ushiro)*2-sum(mae[:-1])*2
    sono2 = mid + ushiro[0]
    sono2 += sum(ushiro[1:])*2-sum(mae)*2
    print(max(sono1,sono2))
else:
    mae = li[:n//2]
    ushiro = li[n//2:]
    sono3 = -mae[-1] + ushiro[0]
    sono3 += sum(ushiro[1:])*2-sum(mae[:-1])*2
    print(sono3)

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

int main(){
    int a, b, c;
    cin >> a >> b >> c;
    if((a == b && a!= c)||(a == c && a!= b)||(c == b && a!= c)) cout << "Yes" << endl;
    else cout << "No" << endl;
}

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

using namespace std;

#define S scanf
#define P printf
#define G getline
#define SZ size()
#define C clear()
#define B begin()
#define F front()
#define T top()
#define E end()
#define EM empty()
#define V vector
#define Q queue
#define DQ deque
#define PQ priority_queue
#define ST stack
#define FI first
#define SE second
#define PI acos(-1)
#define PS push
#define PP pop()
#define PSF push_front
#define PSB push_back
#define PPF pop_front()
#define PPB pop_back()
#define MP make_pair
#define LL long long int
#define ULL unsigned long long int
#define PII pair<int,int>
#define PSI pair<string,int>
#define PIS pair<int,string>
#define PLI pair<long long int,int>
#define PLL pair<long long int,long long int>
#define MII map<int,int>
#define MSI map<string,int>
#define MIS map<int,string>
#define MLI map<long long int,int>
#define FAST() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)





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






int main()
{
    FAST();

//    freopen("input.txt","r",stdin);
//    freopen("output.txt","w",stdout);

    int n;
    cin >> n;
    cout << n*n;
    return 0;
}


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

void SOLVE(int* dice, int u, int f) {
    int around[4];
    switch(u) {
        case 0 : {
            around[0] = 1;   around[1] = 2;   around[2] = 4;   around[3] = 3;
            break;
        }
        case 1 : {
            around[0] = 0;   around[1] = 3;   around[2] = 5;   around[3] = 2;
            break;
        }
        case 2 : {
            around[0] = 0;   around[1] = 1;   around[2] = 5;   around[3] = 4;
            break;
        }
        case 3 : {
            around[0] = 0;   around[1] = 4;   around[2] = 5;   around[3] = 1;
            break;
        }
        case 4 : {
            around[0] = 0;   around[1] = 2;   around[2] = 5;   around[3] = 3;
            break;
        }
        case 5 : {
            around[0] = 1;   around[1] = 3;   around[2] = 4;   around[3] = 2;
            break;
        }
    }
    int index = 0;
    while(dice[f] != dice[around[index]])   ++index;
    index += 1;
    if(index < 4)   cout << dice[around[index]] << endl;
    else            cout << dice[around[0]] << endl;
}

int main(void) {
    int dice [6];
    int n;
    int u, f;
    int u_index, f_index;
    
    for(int i = 0; i < 6; ++i) {
        cin >> dice[i];
    }
    cin >> n;
    
    for(int i = 0; i < n; ++i) {
        cin >> u >> f;
        u_index = 0;
        f_index = 0;
        while(dice[u_index] != u)   ++u_index;
        while(dice[f_index] != f)   ++f_index;
        SOLVE(dice, u_index, f_index);
    }
    return 0;
}


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

// https://atcoder.jp/contests/abc126/tasks/abc126_e
public class Main {

    class UF {

        int n;
        int[] par; // 親の要素の番号
        int[] rank; // 木の高さ

        public UF(int n) {
            this.n = n;
            par = new int[n];
            rank = new int[n];
            for (int i = 0; i < n; i++) {
                par[i] = i;
                rank[i] = 0;
            }

        }

        // 木の根を求める
        int find(int x) {
            if (par[x] == x) {
                return x;
            } else {
                return par[x] = find(par[x]);
            }
        }

        // xとyの属する集合を併合
        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]++;
            }
        }

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

    void run() {
        Scanner sc = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);

        int n = sc.nextInt();
        int m = sc.nextInt();

        UF uf = new UF(n);

        int count = 0;
        for (int i = 0; i < m; i++) {
            int x = sc.nextInt() - 1;
            int y = sc.nextInt() - 1;
            int z = sc.nextInt();

//            if (z % 2 == 1) {
//                // xとyは別の数。
//                count++;
//            } else {
//                uf.unite(x, y);
//            }
            uf.unite(x, y);
        }
//        debug(uf.par);
//        debug(uf.rank);

        Set<Integer> set  = new HashSet<>();
        for (int i = 0 ; i < n; i++) {
            set.add(uf.find(i));
        }
        System.out.println(set.size());

        out.flush();
    }

    void debug(Object... os) {
        System.err.println(Arrays.deepToString(os));
    }

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


Measured memory_bytes: 93476