akhauriyash/Code-Regression huggingface dataset:
import java.util.*;
import java.io.*;

public class Main {
	static final int mod = (int) 1e9 + 7;
	static final int DX[] = { -1, 0, 1, 0 }, DY[] = { 0, -1, 0, 1 };
	static final int[] DX8 = { -1, -1, -1, 0, 0, 1, 1, 1 }, DY8 = { -1, 0, 1, -1, 1, -1, 0, 1 };
	static final int INF = Integer.MAX_VALUE / 3;
	static final long LINF = Long.MAX_VALUE / 3;
	static final String nextLine = "\n";

	public static void main(String[] args) {
		FastScanner fs = new FastScanner(System.in);
		int n = fs.nextInt();
		int a[] = fs.nextIntArray(n);
		long cnt[] = new long[n+1];
		for(int i=0;i<n;i++) {
			cnt[a[i]]++;
		}
		long total = 0;
		for(int i=1;i<=n;i++) {
			total += cnt[i]*(cnt[i]-1)/2;
		}
		for(int i=0;i<n;i++) {
			long t = cnt[a[i]]-1;
			//long ans = t * (t-1)/2;
			System.out.println(total - t);
		}
	}

	//MOD culculations
	static long plus(long x, long y) {
		long res = (x + y) % mod;
		return res < 0 ? res + mod : res;
	}

	static long sub(long x, long y) {
		long res = (x - y) % mod;
		return res < 0 ? res + mod : res;
	}

	static long mul(long x, long y) {
		long res = (x * y) % mod;
		return res < 0 ? res + mod : res;
	}

	static long div(long x, long y) {
		long res = x * pow(y, mod - 2) % mod;
		return res < 0 ? res + mod : res;
	}

	static long pow(long x, long y) {
		if (y < 0)
			return 0;
		if (y == 0)
			return 1;
		if (y % 2 == 1)
			return (x * pow(x, y - 1)) % mod;
		long root = pow(x, y / 2);
		return root * root % mod;
	}
}

//高速なScanner
class FastScanner {
	private BufferedReader reader = null;
	private StringTokenizer tokenizer = null;

	public FastScanner(InputStream in) {
		reader = new BufferedReader(new InputStreamReader(in));
		tokenizer = null;
	}

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

	public String nextLine() {
		if (tokenizer == null || !tokenizer.hasMoreTokens()) {
			try {
				return reader.readLine();
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
		}
		return tokenizer.nextToken("\n");
	}

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

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

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

	public int[] nextIntArray(int n) {
		int[] a = new int[n];
		for (int i = 0; i < n; i++)
			a[i] = nextInt();
		return a;
	}

	public long[] nextLongArray(int n) {
		long[] a = new long[n];
		for (int i = 0; i < n; i++)
			a[i] = nextLong();
		return a;
	}
}

Measured memory_bytes: 65752
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define fo(a,b) for(int a=0;a<b;a++)
 int $(int a,int b) {
   if(a%b==0)
     return a/b;
   else
     return a/b+1;
 }
 int keta(int a){
  double b=a;
  b=log10(b);
  int c=b;
  return c+1;
 }
 int souwa(int a){
  return a*(a+1)/2;
 }

signed main(){
  int a;
  cin>>a;
  vector<int> b(a);
  fo(i,a)
  cin>>b.at(i);
  sort(b.begin(),b.end());
  int c=b.at(0),d=b.at(a-1),e=0,f=1000000000;
  for(int i=c;i<=d;i++){
    e=0;
    for(int j=0;j<b.size();j++){
      e+=(b.at(j)-i)*(b.at(j)-i);
    }
    f=min(f,e);
  }
  cout<<f<<endl;
}

Measured memory_bytes: 256
let n, m = Scanf.scanf " %d %d" @@ fun a b -> a, b
let g = Array.make n []
let vs = Array.make n false
let c, ans = ref 0, ref 0
let rec f v p =
  vs.(v) <- true; incr c; if !c = n then incr ans;
  List.iter (fun u -> if not vs.(u) then f u v) g.(v);
  vs.(v) <- false; decr c
let _ =
  for _ = 1 to m do
    Scanf.scanf " %d %d" @@ fun u v -> g.(u - 1) <- v - 1 :: g.(u - 1); g.(v - 1) <- u - 1 :: g.(v - 1) done;
  f 0 @@ -1; Printf.printf "%d\n" !ans

Measured memory_bytes: 896
#include <stdio.h>
#include <stdlib.h>

int q(const int *a,const int *b)
{
    return *a-*b;
}

int main(void)
{
    int n[3];
    scanf("%d%d%d",&n[0],&n[1],&n[2]);
    qsort(n,3,4,q);
    printf("%d",n[0]+n[1]);
    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define LL long long
#define PII pair<int,int>
#define PIL pair<int,LL>
#define PLI pair<LL,int>
#define PIII pair<int,PII>
#define PLL pair<LL,LL>
#define PLII pair<LL,PII>
#define VI vector<int>
#define VL vector<LL>
#define VPII vector<PII>
#define FF first
#define SS second
#define MP make_pair
#define PB push_back
#define EPS 0.00000000001
#define PI acos(-1)
#define loop(i,b,n) for(int i=b;i<n;++i)
#define rev_loop(i,b,n) for(int i=b;i>=n;--i)
using namespace std;

const int MOD = 1e9 + 7;
const LL MX = 1e9;
const LL INF = 1e9;

LL gcd(LL a, LL b)
{
    if(a == 0) return b;
    else return gcd(b%a,a);
}

int main()
{
    //ofstream out("output.txt");
    //ifstream in("input.txt");
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

    int n, c = 0;
    cin>>n;
    LL a,b,g;
    map<PLL,PLL> mp;

    loop(i,0,n)
    {
        cin>>a>>b;
        if(a == 0 && b == 0) ++c;
        else if(b == 0)
        {
            a = 1;
            ++mp[{a,0}].FF;
        }
        else if(a == 0)
        {
            b = 1;
            ++mp[{b,0}].SS;
        }
        else
        {
            g = gcd(abs(a),abs(b));
            a = a/g;
            b = b/g;
            if((a > 0 && b > 0) || (a < 0 && b < 0))
            {
                a = abs(a);
                b = abs(b);
                ++mp[{a,b}].FF;
            }
            else
            {
                a = abs(a);
                b = abs(b);
                ++mp[{b,a}].SS;
            }
        }
    }

    LL p2[n+1];
    p2[0] = 1;
    loop(i,1,n+1) p2[i] = (p2[i-1] * 2) % MOD;

    LL ans = 1;
    for(pair<PLL,PLL> it : mp)
    {
        ans = (ans * (p2[it.SS.FF] + p2[it.SS.SS] - 1)) % MOD;
    }

    c = (c + MOD - 1) % MOD;
    ans = (ans + c) % MOD;
    cout<<ans<<'\n';

    return 0;
}


Measured memory_bytes: 20644
s = input()

if len(s) % 2 != 0:
    s = s[:len(s)-1]
else:
    s = s[:len(s)-2]

for i in range(len(s)//2):
    if s[:len(s)//2-i] == s[len(s)//2-i:len(s)-2*i]:
        print(len(s)-2*i)
        exit()


Measured memory_bytes: 2940
#include <bits/stdc++.h>
#define int long long

using namespace std;

int32_t main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int d, t, s; cin >> d >> t >> s;
	if(s*t >= d) cout << "Yes\n";
	else cout << "No\n";	

  return 0;
}


Measured memory_bytes: 3648
macro_rules! get {
    ($t:ty) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t:ty),*) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            (
                $(iter.next().unwrap().parse::<$t>().unwrap(),)*
            )
        }
    };
    ($t:ty; $n:expr) => {
        (0..$n).map(|_|
            get!($t)
        ).collect::<Vec<_>>()
    };
    ($($t:ty),*; $n:expr) => {
        (0..$n).map(|_|
            get!($($t),*)
        ).collect::<Vec<_>>()
    };
}

fn main() {
    let (n, m) = get!(usize, usize);
    let mut aa = Vec::new();
    let mut bb = Vec::new();
    for _ in 0..n {
        aa.push(get!(String).chars().into_iter().collect::<Vec<_>>());
    }
    for _ in 0..m {
        bb.push(get!(String).chars().into_iter().collect::<Vec<_>>());
    }

    for y in 0..n-m+1 {
        for x in 0..n-m+1 {
            let mut ok = true;
            for i in 0..m {
                for j in 0..m {
                    if !ok { break; }
                    if aa[y+i][x+j] != bb[i][j] { ok = false; }
                }
            }
            if ok {
                println!("Yes");
                return;
            }
        }
    }
    println!("No");
}

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

using namespace std;
typedef long long ll;
typedef long int li;
typedef long double lb;
#define rep(i,j,n) for (ll i = j; i < (n); i++)
#define repr(i,j,n) for(ll i = j; i >= (n); i--)
#define all(x) (x).begin(),(x).end()
#define CLR(mat,f) memset(mat, f, sizeof(mat))
#define IN(a, b, x) (a<=x&&x<b)
#define out(ans) cout << ans << endl
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
typedef pair<ll,ll>P;
const ll mod=1e9+7;
const ll INF = 1LL<<60;

int main(){

  ll n,k;cin>>n>>k;
  ll a[n];rep(i,0,n)cin>>a[i];


  ll ans=INF;
  rep(bit,0,(1<<n)){
    ll count=0,cost=0;
    ll ma=0;
    rep(i,0,n){
      ll height=a[i];
      if((bit>>i)&1){
        count++;
        if(ma>=a[i]){
          cost+=ma-a[i]+1;
          height=ma+1;
        }
      }
      chmax(ma,height);
    }
    if(count>=k)chmin(ans,cost);
  }

  out(ans);


  return 0;
}


Measured memory_bytes: 508
#include <stdio.h>
#include <string.h>
#include <stdbool.h>

int main() {
	int i, j, N;
	char ww[100][11];
	char w[100][3];
	bool flag = true;

	scanf("%d", &N);

	for (i = 0; i < N; i++) {
		scanf("%s", &ww[i]);
		w[i][0] = ww[i][0];
		w[i][1] = ww[i][strlen(ww[i]) - 1];
		if (i >= 1) {
			if (w[i - 1][1] != w[i][0])
				flag = false;
		}
	}

	for (i = 0; i < N; i++) {
		for (j = i + 1; j < N; j++) {
			if (strcmp(ww[i], ww[j]) == 0) 
				flag = false;
		}
	}

	printf(flag == true ? "Yes\n" : "No\n");

	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <algorithm>
using namespace std;

typedef long long int ll;

int main () {
    ll n, a, b; cin >> n >> a >> b;
    ll ans = (n / (a+b)) * a;
    ll m = (n % (a+b));
    if (m <= a) {
        ans += m;
    } else {
        ans += a;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
import sys
import queue

input_methods=['clipboard','file','key']
using_method=0
input_method=input_methods[using_method]

tin=lambda : map(int, input().split())
lin=lambda : list(tin())
mod=1000000007

#+++++

def main():
	n = int(input())
	graph = [[] for _ in range(n)]
	for _ in range(n-1):
		a, b, d = tin()
		graph[a-1].append((b-1, d))
		graph[b-1].append((a-1, d))
	#s = input()
	q, k = tin()
	dist = [-1]*n
	dist[k-1] = 0
	qu=queue.Queue()
	qu.put(k-1)
	while not qu.empty():
		pos = qu.get()
		for v, d in graph[pos]:
			if dist[v] == -1:
				dist[v] = dist[pos] + d
				qu.put(v)
	
	for _ in range(q):
		f, t = tin()
		print(dist[f-1] + dist[t-1])
	
	
	
#+++++
isTest=False

def pa(v):
	if isTest:
		print(v)
		
def input_clipboard():
	import clipboard
	input_text=clipboard.get()
	input_l=input_text.splitlines()
	for l in input_l:
		yield l

if __name__ == "__main__":
	if sys.platform =='ios':
		if input_method==input_methods[0]:
			ic=input_clipboard()
			input = lambda : ic.__next__()
		elif input_method==input_methods[1]:
			sys.stdin=open('inputFile.txt')
		else:
			pass
		isTest=True
	else:
		pass
		#input = sys.stdin.readline
			
	ret = main()
	if ret is not None:
		print(ret)

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

int main() {
	int N, K;
	cin >> N >> K;
	if (N % K == 0) cout << 0;
	else cout << 1;
	return 0;
}
/*
31536000のコメント解説欄
ここテンプレで用意してるから、A問題とかだとこの先空欄の危険あり
また、コンテスト後に https://31536000.hatenablog.com/ で解説していると思うので、良かったら読んでねー

まず、せんべいの枚数N=aK+b枚とする(0≦b<K)
この時、すべての参加者にa枚配ると残りはb枚であり、この時点では差は0枚になる
後はb人に1枚ずつ配ると差が1となり、これが最小である
b=0なら差は0にできるので、要はKで割り切れれば0、そうでないなら1
*/

Measured memory_bytes: 256
#include <bits/stdc++.h>
#ifdef __DEBUG__
    #define DBG(X) cout << #X << " = " << (X) << endl;
    #define SAY(X) cout << (X) << endl;
#else
    #define DBG(X)
    #define SAY(X)
#endif

using namespace std;

using ll = long long int;
using ull = unsigned long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

int dx[]={1, 0, -1, 0, 1,-1, 1,-1};
int dy[]={0, 1, 0, -1, 1, 1,-1,-1};
const int INT_INF = (int)(2e9);
const ll  LL_INF = (ll)(2e18);

inline void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); };
template<typename T, typename S> inline ostream& operator<<(ostream& os, const pair<T, S> p) { cout << "[" << p.first << ";" << p.second << "]"; return os; }
template<typename T, typename S> inline ostream& operator<<(ostream& os, const map<T, S> p) { for (auto el : p) cout << "[" << el.first << ";" << el.second << "]"; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const vector<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const deque<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const set<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline vector<T> fetch_vec(int sz) { vector<T> ret(sz); for (auto& elem : ret) cin >> elem; return ret; }

int a,b,c;
void input(){
    fast_io();
    cin >> a >> b >> c;
}

int solve(){
    int ans = (a+b+c)-max({a,b,c});
    cout << ans << endl;
    return 0;
}   

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

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cassert>
#include <climits>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <fstream>

using namespace std;
#define TOSTRING(x) #x
#define SZ(x) (int)(x).size()
#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REPR(i,n) for(int i=(n)-1;i>=0;i--)
#define ALL(s) (s).begin(), (s).end()
#define so(V) sort(ALL(V))
#define rev(V) reverse(ALL(V))
#define uni(v) v.erase( unique(ALL(v)) , v.end());
#define PAU system("pause")

typedef long long unsigned int llu;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef vector<vb> vvb;
const int EPS = 1e-9;
const int MOD = 1e9 + 7;
const int INF = (1 << 30);
const double PI = acos(-1);

typedef pair<int, bool> P;

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N, H;
	cin >> N >> H;
	vector<P> VP;
	REP(i, N) {
		int a, b;
		cin >> a >> b;
		VP.push_back(P(a, true));
		VP.push_back(P(b, false));
	}
	so(VP); rev(VP);
	int ans = 0;
	REP(i, SZ(VP)) {
		P p = VP[i];
		if (p.second) {
			ans += (H + p.first - 1) / p.first;
			break;
		}
		H -= p.first;
		ans++;
		if (H <= 0)break;
	}
	cout << ans << endl;
	PAU;
	return 0;
}


Measured memory_bytes: 2420
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>
#include <climits>

#define F first
#define S second
#define vsort(v) sort((v).begin(), (v).end())
#define vrev(v) reverse((v).begin(), (v).end())


//INT_MAX
//INT_MIN
//LLONG_MAX
//LLONG_MIN
//DBL_MIN
//DBL_MAX
//LDBL_MIN
//LDBL_MAX

using namespace std;
using ll = long long;

int main(int argc, const char * argv[]) {
    ll a, b;
    char op;
    cin >> a >> op >> b;
    if (op == '+') {
        cout << a + b << endl;
    }else{
        cout << a - b << endl;
    }
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <stdio.h>
#include <queue>
#include <stack>
#include <climits>
#include <map>
#include <set>

using namespace std;

typedef long long ll;
typedef pair<int, int> P;

const ll mod = 1000000007;
const int inf = 1e9;
const long long INF = 1LL << 60;


int main()
{
    int n; cin >> n;
    int ans[205];
    int tmp = 0;
    for(int i = 1; i <= 200; i++){
        int num = 0;
        if(i%2==0){
            ans[i] = tmp;
        }else{
            for(int j = 1; j*j <= i; j++){
                if(i % j == 0){
                    if(j * j == i) num++;
                    else num += 2;
                }
            }
            if(num == 8) tmp++;
            ans[i] = tmp;
        }
    }
    cout << ans[n];
}

Measured memory_bytes: 256
#include <iostream>
#include <bits/stdc++.h>
#define maxn 200005
typedef long long ll;
using namespace std;
const ll mod=998244353;
ll fac[maxn],inv[maxn];
ll pow_mod(ll a,ll n)
{
    ll ret =1;
    while(n)
    {
        if(n&1) ret=ret*a%mod;
        a=a*a%mod;
        n>>=1;
    }
    return ret;
}
void init()
{
    fac[0]=1;
    for(int i=1;i<maxn;i++)
    {
        fac[i]=fac[i-1]*i%mod;
    }
}
ll Cc(ll x, ll y)
{
    return fac[x]*pow_mod(fac[y]*fac[x-y]%mod,mod-2)%mod;
}

int main(){
    init();
    ll n,m;cin>>n>>m;
    cout<<Cc(n,2*1ll)+Cc(m,2*1ll)<<endl;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (int)(n); ++i)
using P = pair<int,int>;
using ll = long long;
static const int INF = 1000000000;
static const ll MOD = 1000000007;

ll gcd(ll a, ll b){return b!=0 ? gcd(b, a%b) : a;}
ll lcm(ll a, ll b){return a / gcd(a, b) * b;}

int main(){
	string s;
	cin >> s;
	if(s.size() < 4){
		cout << "No" << endl;
		return 0;
	}
	const string YAKI = "YAKI";
	for(int i = 0; i < 4; ++i){
		if(YAKI[i] != s[i]){
			cout << "No" << endl;
			return 0;
		}
	}
	cout << "Yes" << endl;
	return 0;
}



Measured memory_bytes: 256
#include<stdio.h>
int main(){
  int a, b, c;
  scanf("%d %d %d",&a, &b, &c);
  if(a>=b && a>=c) printf("%d\n",b+c);
  else if(b>=a && b>=c) printf("%d\n",a+c);
  else if(c>=a && c>=b) printf("%d\n",a+b);
  return 0;
}

Measured memory_bytes: 256
/*BY-ADITYA OJHA
  LEARN DSA SINCERELY*/
#include <bits/stdc++.h>
#define ll long long int
#define forin for(int i=0;i<n;i++)
#define forjn for(int j=0;j<n;j++)
#define pb push_back
#define vx vector<ll> x
#define fas1  ios_base::sync_with_stdio(false)
#define fas2   cin.tie(NULL)
#define fas3   cout.tie(NULL)
using namespace std;


int main()
{
     fas1;
     fas2;
     fas3;
     char s;
     cin>>s;
     s++;
     cout<<s<<endl;
     }


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

#define MOD 1000000007
using namespace std;
int dp[1005][1005];
int h,w;
char mp[1005][1005];

int grid(int y,int x){
  if(y==h && x==w)return 1;
  if(mp[y][x]=='#' || y>h || x>w)return 0;
  if(dp[y][x]!=-1)return dp[y][x];

  return dp[y][x]=(grid(y+1,x)%MOD+grid(y,x+1)%MOD)%MOD;
}

int main(){
  cin>>h>>w;
  for(int i=1;i<=h;i++){
    for(int j=1;j<=w;j++){
      cin>>mp[i][j];
    }
  }

  memset(dp,-1,sizeof(dp));
  cout<<grid(1,1)<<"\n";

  return 0;
}


Measured memory_bytes: 5248
#include<bits/stdc++.h>
using namespace std;
int main(){
    int N,K;
    cin>>N>>K;
    string S;
    cin>>S;
    int inside=0,outside=0;
    for(int i=1;i<N;i++){
        if(S[i]=='L'&&S[i-1]=='R'){
            inside++;
        }
    }
    if(S[0]=='L'){
        outside++;
    }
    if(N-1!=0&&S[N-1]=='R'){
        outside++;
    }
    int happy=N-inside*2-outside;
    //cout<<inside<<" "<<outside<<endl;
    if(K>=inside){
        happy+=2*inside;
        int left=K-inside;
        if(left>1){
            happy=N-1;
        }else if(left==1){
            if(outside==2){
                happy=N-1;
            }
        }
    }else{
        happy+=2*K;
    }
    cout<<happy<<endl;
    return 0;
    
}

Measured memory_bytes: 512
fun main(args: Array<String>) {
    val inf = 1e9.toInt()
    val (h, n) = readLine()!!.split(' ').map { it.toInt() }
    val ms = (0 until n).map {
        val (a, b) = readLine()!!.split(' ').map { it.toInt() }
        a to b
    }

    val ans = IntArray(h + 1) { inf }
    ans[h] = 0

    for (i in h - 1 downTo 1) {
        for (m in ms) {
            val j = i + m.first
            if (j > h) continue
            ans[i] = Math.min(ans[j] + m.second, ans[i])
        }
    }

    for (m in ms) {
        val j = m.first
        ans[0] = Math.min(ans.slice(1..j).min()!! + m.second, ans[0])
    }

    println(ans[0])
}


Measured memory_bytes: 52824
#include<bits/stdc++.h>
typedef long long ll;
#define  fi0(i,n)  for(int i=0;i<n;i++)
#define   pb()    push_back()
#define   mk()    make_pair()
#define   fst      first
#define   scnd    second
using namespace std;
int f[500], c;
void solve()
{
    string s[]={ "SUN","MON", "TUE", "WED", "THU", "FRI", "SAT","SUN"};
    int n;
    string ss;
    cin >> ss;

    for(int i=0;i<8;i++)
    if(ss==s[i]){
        n=i;
        break;
    }

    for(int j=n+1;j<8;j++){
        if(s[j]=="SUN")
        {
            cout<<j-n<<endl;
            return;
        }
    }
}
ll without()
{
}
void pairwise(ll n)
{

}
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    ///int t;cin>>t;while(t--){ solve();}
    solve();
}


Measured memory_bytes: 3648
#include <bits/stdc++.h>
// #include <limits>
//auto std::numeric_limits<float>::infinity() { return __builtin_huge_valf(); }
using namespace std;
#define rep(i, a, n) for (int i = a; i < n; i++)

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

    if (N % 2 == 0)
    {
        cout << N / 2 << endl;
    }
    else
        cout << N / 2 + 1 << endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <string>
#include <utility>
#include <vector>

#define REP(i,s,n) for(int i=(int)(s);i<(int)(n);i++)
#define DEBUGP(val) cerr << #val << "=" << val << "\n"

using namespace std;
typedef long long int ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef pair<int, int> PI;
const ll mod = 1e9 + 7;

const int N = 4010;

int tbl[N][N];

int main(void) {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, k;
  cin >> n >> k;
  VI x(n), y(n);
  REP(i, 0, n) {
    string cl;
    cin >> x[i] >> y[i] >> cl;
    x[i] %= 2 * k;
    y[i] %= 2 * k;
    if (cl == "W") {
      y[i] = (y[i] + k) % (2 * k);
    }
  }
  REP(i, 0, n) {
    tbl[x[i]][y[i]] += 1;
    tbl[x[i]][y[i] + k] -= 1;
    tbl[x[i] + k][y[i]] -= 1;
    tbl[x[i] + k][y[i] + k] += 1;
    x[i] += k;
    y[i] += k;
    tbl[x[i]][y[i]] += 1;
    tbl[x[i]][y[i] + k] -= 1;
    tbl[x[i] + k][y[i]] -= 1;
    tbl[x[i] + k][y[i] + k] += 1;
  }
  REP(i, 0, N) {
    REP(j, 0, N) {
      if (i + j == 0) continue;
      if (i > 0) {
	tbl[i][j] += tbl[i - 1][j];
      }
      if (j > 0) {
	tbl[i][j] += tbl[i][j - 1];
      }
      if (i > 0 && j > 0) {
	tbl[i][j] -= tbl[i - 1][j - 1];
      }
    }
  }
  REP(i, 0, 4 * k) {
    REP(j, 0, 4 * k) {
      int c = tbl[i][j];
      tbl[i][j] = 0;
      tbl[i % (2 * k)][j % (2 * k)] += c;
    }
  }
  int ma = 0;
  REP(i, 0, 2 * k) {
    REP(j, 0, 2 * k) {
      ma = max(ma, tbl[i][j]);
    }
  }
  cout << ma << endl;
}


Measured memory_bytes: 63872
s = gets.chop
len = s.size
ok = true
len.times{|i|
  ok &= 
  s[i] == 'p' && s[len - i - 1] == 'q' ||
  s[i] == 'q' && s[len - i - 1] == 'p' ||
  s[i] == 'd' && s[len - i - 1] == 'b' ||
  s[i] == 'b' && s[len - i - 1] == 'd'
}
puts ok ? "Yes" : "No"


Measured memory_bytes: 3964
#include<bits/stdc++.h>
#define int			long long
#define ll 			long long
#define pb          push_back
#define	endl		'\n'
#define pii         pair<int,int>
#define vi          vector<int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (int)x.size()
#define hell        1000000007
#define rep(i,a,b)	for(int i=a;i<b;i++)
#define dep(i,a,b)	for(int i=a;i>=b;i--)
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
using namespace std;

#define N  100005

void solve()
{
	int k,n;
	cin>>k>>n;
	vi a(n);
	rep(i,0,n)
	cin>>a[i];
	int ans=hell;
	rep(i,0,n)
	{
		int last=(i-1+n)%n;
		ans=min(ans,(a[last]-a[i]+k)%k);
	}
	cout<<ans;
}

signed main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int TESTS=1;
//	cin>>TESTS;
	while(TESTS--)
	{
		solve();
	}
	return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
#define maxn 200005
int main()
{
    char c;
    cin>>c;
    if(c=='A')printf("T");
    else if(c=='T')printf("A");
    else if(c=='C')printf("G");
    else if(c=='G')printf("C");
    return 0;
}


Measured memory_bytes: 256
//
//  multiple_of_2019.cpp
//  learningCplusplus
//
//  Created by Tran Duc Chinh on 2020/04/04.
//  Copyright © 2020 Tran Duc Chinh. All rights reserved.
//

#include <iostream>
#include <map>
using namespace std;
typedef long long ll;
ll mod = 1000000007;


int main(int argc, const char* argv[]) {

  std::string s;
  std::cin >> s;
  int n = s.size();
  std::map<int, int> ma;
  ma[0] = 1;

  int t[n+1];
  t[n] = 0;

  int basemod = 1;
  for (int i=n-1; i>=0; i--) {
    t[i] = (t[i+1] + (s[i] - '0')*basemod) % 2019;
    basemod = (basemod * 10) % 2019;
    ma[t[i]] += 1;

  }
  int sum = 0;
  for (int i=0; i<2019; i++) {
    if (ma.count(i)){
      // std::cout << i << ": " << ma[i] << std::endl;
    }
    sum += ma[i]*(ma[i]-1)/2;
  }
  std::cout << sum << std::endl;

  return 0;
}


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

int main(){
	int N; cin>>N;
	vi ans(N);
	rep(i, N-1){
		int a; cin>>a;
		ans[a-1]++;
	}
	rep(i, N) cout<<ans[i]<<endl;
}

Measured memory_bytes: 4056
def divisor(n): #約数全列挙
    ans = [1,n]
    i = 2
    while i**2 <= n:
        if n%i == 0:
            ans.append(i)
            if i**2 < n:
                ans.append(n//i)
        i += 1
    ans.sort()
    return ans

n,k = map(int,input().split())
A = list(map(int,input().split()))
d_max= sum(A)
div = divisor(d_max)[::-1]

for ans in div:
    b = [a%ans for a in A]
    b.sort()
    s = sum(b)
    if sum(b[:-s//ans]) <=k:
        print(ans)
        exit()

Measured memory_bytes: 41948
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")


from collections import defaultdict
n,m = map(int, input().split())
ns = defaultdict(set)
for _ in range(m):
    u,v = map(int, input().split())
    u -= 1
    v -= 1
    ns[u].add(v)
    ns[v].add(u)
dp = [[0]*(1<<n) for _ in range(n)]
dp[0][1] = 1
for b in range(1, 1<<n):
    for u in range(n):
        for i in range(n):
            if not (b>>i&1) and i in ns[u]:
                dp[i][b+(1<<i)] += dp[u][b]
ans = sum(dp[u][(1<<n)-1] for u in range(n))
print(ans)

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

#define fi first
#define se second
#define all(x) x.begin(), x.end()
using namespace std;
using ull = unsigned long long;
using ll = long long;
constexpr int I_INF = INT_MAX;
constexpr ll L_INF = LLONG_MAX;

struct __INIT {
    __INIT() {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(15);
    }
} __init;

template <class X> map<X,int> prime_factorize(X a){
    int b = 2;
    map<X,int>cnt;
    while(a >= b * b){
        if(a % b == 0){
            cnt[b]++;
            a /= b;
        }else b++;
    }
    cnt[a]++;
    return cnt;
}

int main() {
    int N;
    cin >> N;
    map<int,int> cnt;
    for(int i = 2; i <= N; i++){
        map<int,int> tmp = prime_factorize(i);
        for(auto p : tmp) cnt[p.fi] += p.se;
    }
    ll ans = 1;
    for(auto p : cnt){
        ans *= p.se + 1;
        ans %= 1000000007;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
n, m = [int(_) for _ in input().split()]
a = [int(_) for _ in input().split()]
c = {}

s = [0]
for i in range(n):
  s.append((s[i] + a[i]) % m)

for i in s:
  if i in c:
    c[i] += 1
  else:
    c[i] = 1

count = 0
for k in c:
  count += c[k] * (c[k] - 1) // 2

print(count)

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

int main() {
  int n,k;
  cin >> n >> k;
  vector<int> v(n);
  
  for (int i = 0; i < n; i++) {
    int p;
    cin >> p;
    v[p-1] ++;
  }
  
  sort(v.begin(), v.end(), greater<int>());
 
  int cnt = 0;
  int nonzero = 0;
  for (int i = 0; i < k; i++) {
    cnt += v[i];
  }
  cout << n-cnt << endl;
}

Measured memory_bytes: 1024
import sys
for line in sys.stdin.readlines():
    line=map(int,line.strip().split())
    cards=range(1,11)
    m=sum(line[0:2])
    for x in line:
        cards.remove(x)
    c=0
    for x in cards:
       if  m+x<21:c+=1
    if c>len(cards)/2:print "YES"
    else:print "NO"

Measured memory_bytes: 6560
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <queue>
#include <vector>
#include <map>
#include <set>

using namespace std;

typedef pair<int , int> P2;
typedef pair<pair<int , int> , int> P3;
typedef pair<pair<int , int> , pair<int , int> > P4;
#define Fst first
#define Snd second
#define PB(a) push_back(a)
#define MP(a , b) make_pair((a) , (b))
#define M3P(a , b , c) make_pair(make_pair((a) , (b)) , (c))
#define M4P(a , b , c , d) make_pair(make_pair((a) , (b)) , make_pair((c) , (d)))
#define repp(i,a,b) for(int i = (int)(a) ; i < (int)(b) ; ++i)
#define repm(i,a,b) for(int i = (int)(a) ; i > (int)(b) ; --i)
#define repv(t,it,v) for(vector<t>::iterator it = v.begin() ; it != v.end() ; ++it)

int N;
int a[100010];
int s[100010];
vector<int> V[100010];
vector<int> d[100010];

int dfs(int z){
	if((int)V[z].size() == 0) return 0;
	repv(int,it,V[z]){
		d[z].PB(dfs(*it));
	}
	sort(d[z].begin() , d[z].end() , greater<int>());
	int x = 0;
	repp(i,0,d[z].size()){
		x = max(x , d[z][i] + i + 1);
	}
	return x;
}

int main(){
	scanf("%d" , &N);
	repp(i,2,N+1){
		scanf("%d" , a + i);
		V[a[i]].PB(i);
	}
	printf("%d\n" , dfs(1));
	return 0;
}


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

#ifdef NON_SUBMIT
#define TEST(n) (n)
#else
#define TEST(n) ((void)0)
#endif

using namespace std;

vector<pair<int, int>> idx(1, make_pair(0, 1));
vector<int> A;

bool solve(int l)
{
	int P = A[0];
	idx.resize(1);
	idx[0] = { 0,1 };
	for (int i = 1; i < A.size(); i++) {
		int c = A[i];
		if (P < c) {
			idx.push_back({ P + 1,1 });
		}
		else {
			while (idx.back().first > c) idx.pop_back();
			while (idx.back().second == l) {
				c = idx.back().first - 1;
				if (idx.size() == 1) break;
				idx.pop_back();
				while (idx.back().first > c) idx.pop_back();
			}
			if (c <= 0) return false;
			idx.push_back({ c,idx.back().second + 1 });
		}
		P = c;
	}
	return true;
}

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(NULL); cout.tie(NULL);
	TEST(freopen("input.txt", "r", stdin));
	TEST(freopen("output.txt", "w", stdout));
	TEST(freopen("debug.txt", "w", stderr));
	int N, s = 1, e;
	cin >> N; e = N;
	A.resize(N);
	for (int i = 0; i < N; i++) cin >> A[i];
	while (s <= e) {
		int m = (s + e) >> 1;
		if (solve(m)) {
			e = m - 1;
		}
		else {
			s = m + 1;
		}
	}
	cout << s << '\n';
	return 0;
}

Measured memory_bytes: 3188
#include <iostream>
#include <fstream>
using namespace std;
int main(){
  int s,x,y,z,k,t;
  cin >> k >> s;
  t=0;
  for(x=0;x<=k;x++){
     for(y=0;y<=k;y++){
        if((x+y) <= s && (s-x-y) <= k){
          t=t+1;
        }
     }
  }
   cout << t << endl;
   return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <algorithm>
#include <iomanip>
#include <set>
#include <map>
#include <bitset>
#include <cmath>
#include <functional>

using namespace std;

#define REP(i,n) for(ll (i) = (0);(i) < (n);++i)
#define REV(i,n) for(ll (i) = (n) - 1;(i) >= 0;--i)
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {REP(WW,n)cerr << v[WW] << ' ';cerr << endl;}
#define SHOW2d(v,WW,HH) {REP(W_,WW){REP(H_,HH)cerr << v[W_][H_] << ' ';cerr << endl;}}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL
#define MOD 1000000007LL

typedef long long ll;
typedef pair<ll,ll> P;

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

	ll n, d;cin >> n >> d;
	ll ans = 0;

	REP(i, n){
		ll x, y;cin >> x >> y;
		if(x * x + y * y <= d * d)ans++;
	}

	cout << ans << endl;

	return 0;
}


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


int main(){
  int a,b;
  cin >> a >> b;
  int k;
  k=a+b;
  if(k%2==0){
    k=k/2;
    cout << k << endl;
  }else{
    cout << "IMPOSSIBLE" << endl;
  }

  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#define  _CRT_SECURE_NO_WARNINGS

int main(void) {
	int a, b, c;
	scanf("%d%d%d", &a, &b, &c);

	int i;
	int n = 0;
	for (i = a; i <= b; i++) {
		if (c%i == 0)
			n++;

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

	return 0;
}

Measured memory_bytes: 596
//もともと隣接リストをArrayListで保持していたがSetでもできるっぽいのでやってみた
import java.util.*;
import static java.lang.System.*;
public class Main {
    public static void main(String[]$){
        Scanner sc = new Scanner(in);

        int n=sc.nextInt();
        int m=sc.nextInt();
        int[] a=new int[m+1];
        int[] b=new int[m+1];
        for (int i = 1; i <=m ; i++) {
            a[i] = sc.nextInt();
            b[i] = sc.nextInt();
        }

        int[] node=new int[n+1];
        //頂点1,2,3,...,n
        //探索済み→node[i]=-1,未探索→node[i]=0
        //0はジャマなのではじめから探索済みにしておく
        node[0]=-1;

        //各頂点iに対し、そことつながっている頂点j,k,...をbridge[i]=j,k....で表す
        Set<Integer>[] bridge=new HashSet[n+1];

        //bridge[i]はそれぞれがSetなのですべて初期化する必要がある（bridge[0]は使わないので放置）
        for (int i = 1; i <=n ; i++) {
            bridge[i]=new HashSet<>();
        }

        //辺の追加
        //頂点a[i],b[i]につながっている頂点をbridge[a[i]],bridge[b[i]]に追加していく（隣接リスト）
        for(int i=1;i<=m;i++){
            bridge[a[i]].add(b[i]);
            bridge[b[i]].add(a[i]);
        }

        int ans=0;

        //全探索
        for (int i = 1; i <=m; i++) {
            //i番目の辺を削除
            //Integerにキャストしないと「a[i]番目の要素を削除」となってしまいぬるぽを吐く
            bridge[a[i]].remove((Integer)b[i]);
            bridge[b[i]].remove((Integer)a[i]);
            //条件を満たすか確認（BFSでグラフが連結か判定）満たすなら++ans
            if(bfs(node,bridge))++ans;
            //i番目の辺を復元
            bridge[a[i]].add(b[i]);
            bridge[b[i]].add(a[i]);
        }

        out.println(ans);
    }
    //グラフをBFS（Queueを用いる）
    static boolean bfs(int[] node,Set[] x){
        Queue<Integer> q=new ArrayDeque<>();

        //node[]の添え字は0～nなので配列長はn+1、よってnはnode[]の配列長-1
        int n=node.length-1;

        //初期化（全頂点を未探索にする）
        for(int i=1;i<=n;i++){
            node[i]=0;
        }

        //未探索→探索済みの回数（新たに到達した頂点の個数）をカウント(新たに頂点を探索したら++sum)
        //つまり、sumは「到達することができた頂点の個数」である
        //もし全体が連結ならば最終的にsum==nとなるはず
        int sum=0;

        //頂点1から探索開始
        q.add(1);

        //BFS
        while(q.size()>0) {
            int tempnode = q.poll();
            //未探索かどうか判定
            if (node[tempnode] == 0) {
                //探索済みにする
                node[tempnode] = -1;
                //新たに到達したので++sum
                ++sum;
                //隣接する頂点をQueueに入れる（BFSですね）
                for (Object k : x[tempnode]) {
                    q.add((Integer) k);
                }
            }
        }

        //グラフが非連結になっているかどうか判定（非連結になっていれば題意を満たします）
        return sum!=n;
    }
}

Measured memory_bytes: 23252
#include <bits/stdc++.h>
using namespace std;
using vec_int = vector<int>;
using P = pair<int,int>;
using T = tuple<int,int,int>;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
using ll = long long;


const int MAX = 510000;
const int MOD = 998244353;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
 

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

   // 前処理
    COMinit();
//    cout<<COM(100,2)<<endl;

//一つも同じ色を使わないとき
// M * M-1 * M-1 * .... 
//1つ同じ色を使うとき
// M * M-1 * M-1 * 1 * M-1....
//ただし、この1をどこにおくかでN-1個の選び方がある
// 2つ: M*(M-1)**(N-3) * N-1C2

//1津も同じ色を使わないとき
// 2*1*1 
//1つ同じ色を使っていいとき
// 2*2*1

ll combi = 0;
rep(i,K+1){
    if(i==N)break;//組み合わせは最大N-1通りしかない
    //K個同じ色を使うとき
    ll temp = M;
    temp = (temp*modpow(M-1,N-i-1,MOD))%MOD;
    temp = temp*COM(N-1,i);
    combi = (combi+temp)%MOD;
}
cout<<combi<<endl;

}

Measured memory_bytes: 15592
#50 最頻値

import collections
collections.Counter

x = [0]*101     
while True:
        try:
                x[int(input())] += 1
        except EOFError:
                break           #EOFErrorになったらbreakする
        
max = max(x)
for i in range(101):
        if x[i] == max:
                print(i)


Measured memory_bytes: 5992
#include <cstdio>
#include <algorithm>
using namespace std;
const long long NR=114514;
long long x,y,a,b,c,maxn,sum,yi,er,yx;
struct Node
{
	long long a,l;
} g[NR*3];
bool cmp(Node a,Node b)
{
	return a.a>b.a;
}
int main()
{
	scanf("%lld%lld%lld%lld%lld",&x,&y,&a,&b,&c);
	for(long long i=1;i<=a;i++)
	{
		scanf("%lld",&g[i].a);
		g[i].l=1;
	}
	for(long long i=1;i<=b;i++)
	{
		scanf("%lld",&g[a+i].a);
		g[a+i].l=2;
	}
	for(long long i=1;i<=c;i++)
	{
		scanf("%lld",&g[a+b+i].a);
		g[a+b+i].l=3;
	}
	sort(g+1,g+a+b+c+1,cmp);
	for(long long i=1;i<=a+b+c;i++)
	{
		if(g[i].l==1&&yi<x)
		{
			sum+=g[i].a;
			yi++;
			yx++;
		}
		if(g[i].l==2&&er<y)
		{
			sum+=g[i].a;
			er++;
			yx++;
		}
		if(g[i].l==3)
		{
			sum+=g[i].a;
			yx++;
		}
		if(yx==(x+y))
		{
			break;
		}
	}
	printf("%lld",sum);
	return 0;
}

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

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

typedef long long ll;

const int INF = 1 << 30;
const ll LLINF = 1LL << 62;

int mod = 1000000007;

double deg_to_rad(double d){
    return d*M_PI/180.0;
}

double dist(double x1, double y1, double x2, double y2){
    return sqrt((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2));
}

int main(void){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    double A, B, H, M; cin >> A >> B >> H >> M;
    double base = 90.0;
    double hx, hy, mx, my;
    //1440で360度
    hx = A*cos(deg_to_rad(90.0 - 0.5*(H*60 + M)));
    hy = A*sin(deg_to_rad(90.0 - 0.5*(H*60 + M)));
    mx = B*cos(deg_to_rad(90.0 - 6.0*M));
    my = B*sin(deg_to_rad(90.0 - 6.0*M));

    printf("%.10f\n", dist(hx, hy, mx, my));
    return 0;
}

Measured memory_bytes: 4188
//#define _GLIBCXX_DEBUG
#include "bits/stdc++.h"

using namespace std;

//------------------------------- Type Names -------------------------------//

using i64 = int_fast64_t;

using seika = string;
//{akari : 1D, yukari : 2D, maki : 3D} vector
template <class kizuna>
using akari = vector<kizuna>;
template <class yuzuki>
using yukari = akari<akari<yuzuki>>;
template <class tsurumaki>
using maki = akari<yukari<tsurumaki>>;
//{akane : ascending order, aoi : decending order} priority queue
template <class kotonoha>
using akane = priority_queue<kotonoha, akari<kotonoha>, greater<kotonoha>>;
template <class kotonoha>
using aoi = priority_queue<kotonoha>;

//------------------------------- Libraries ---------------------------------//

//------------------------------- Dubug Functions ---------------------------//
inline void print()
{
    cout << endl;
}
template <typename First, typename... Rest>
void print(const First &first, const Rest &... rest)
{
    cout << first << ' ';
    print(rest...);
}
//------------------------------- Solver ------------------------------------//

void solve()
{
    int n;
    cin >> n;
    for (int x = 1; x <= n; x++)
    {
        if (int(x * 1.08) == n)
        {
            cout << x << endl;
            return;
        }
    }
    cout << ":(" << endl;
}

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


Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define EPS (1e-7)
#define INF (1e9)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
const double PI = acos(-1);
const ll MOD = 1000000007;
template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}
 
template<class T>
inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}
///////////////////////////////////////////////////////////////

int main() {
  ios::sync_with_stdio(false); cin.tie(nullptr); //入出力高速化
  ll N,C; cin >> N >> C;
  vector<ll> x(N),v(N);
  for (int i = 0; i < N; i++) cin >> x[i] >> v[i];
  ll l,r,ls,rs,lM,rM,lsM,rsM;
  l = r = ls = rs = lM = rM = lsM = rsM = 0;
  vector<ll> lmax(N), rmax(N), lsmax(N), rsmax(N);

  rep(i,N) {
    if (i == 0) {
      l = (v[i] - x[i]);
      ls = l - x[i];
      r = (v[N-1-i] - (C - x[N-1-i]));
      rs = r - (C - x[N-1-i]);
    }
    else {
      l += (v[i] - (x[i] - x[i-1]));
      ls = l - x[i];
      r += (v[N-1-i] - (x[N-i] - x[N-1-i]));
      rs = r - (C - x[N-1-i]);
    }
    chmax(lM,l);
    chmax(rM,r);
    chmax(lsM,ls);
    chmax(rsM,rs);
    lmax[i] = lM;
    rmax[i] = rM;
    lsmax[i] = lsM;
    rsmax[i] = rsM;
  }
  
  ll ansl, ansr;
  ansl = ansr = 0;
  rep(i,N) {
    if (i == N-1) {
      chmax(ansl,lmax[i]);
      chmax(ansr,rmax[i]);
    } else {
      chmax(ansl,lmax[i] + rsmax[N-2-i]);
      chmax(ansr,rmax[i] + lsmax[N-2-i]);
    }
  }

  cout << max(ansl,ansr) << endl;
}

Measured memory_bytes: 4992
#include <iostream>
using namespace std;
int main(){
        int N;
        int a[101];
        cin >> N;
        for(int i=0 ; i<N ; i++ )
                cin >> a[i];
        for(int i=N-1 ; i>=0 ; i-- ){
                cout << a[i];
                if(i!=0)cout << " ";
        }
        cout << endl;
        return 0;
}


Measured memory_bytes: 3080
import java.util.*;
import java.math.*;
public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int x = in.nextInt();
		int n = in.nextInt();
		Set<Integer> seen = new TreeSet<>();
		for(int i = 0; i < n; i++) {
			seen.add(in.nextInt());
		}
		int diff = 1000;
		int ans = -1;
		for(int i = -200; i <= 200; i++) {
			if(seen.contains(i)) continue;
			if(Math.abs(x - i) < diff) {
				diff = Math.abs(x - i);
				ans = i;
			}
		}
		System.out.println(ans);
	}
}

Measured memory_bytes: 36160
#include <iostream>
#include <cmath>

typedef long long ll;

int main()
{
	ll x, y;
	std::cin >> x >> y;

	ll ans = -1;
	for( ll i = 0; i <= y; i++ ) {
		if( x == y ) {
			break;
		}
		if( ( x * i ) % y != 0 ) {
			ans = x * i;
			break;
		}
	}
	std::cout << ans << std::endl;
	return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define FOR(i,x,n) for(int i=x; i<(n); i++)
#define ALL(n) begin(n),end(n)
#define MOD 1000000007
 
typedef long long ll;
typedef unsigned int ui;
typedef unsigned long long ull;
template <class T>
void print(T& x){printf("%d\n", x);}
void printvec(vector<int> a){
    rep(i, a.size()-1){
        printf("%d ", a[i]);
    }
    printf("%d\n", a[a.size()-1]);
}
 
int main()
{
    int x;
    cin >> x;
    printf("%d\n", x*x*x);
    return 0;
}


Measured memory_bytes: 3216
#include <bits/stdc++.h>
    using namespace std;
     
    int main(){
      string n;
      cin >> n;
      if(n.at(0)=='S') cout << "Cloudy" << endl;
      else if(n.at(0)=='C') cout << "Rainy" << endl;
      else cout << "Sunny" << endl;
     
      return 0;
    }

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

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

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

	ll cnt = 0;
	for(int b=K+1; b<=N; ++b){
		int p = N/b;
		int r = N%b;
		cnt += p * max(0, b-K);
		cnt += max(0, r-K+1);
	}
	cout<< cnt <<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<stdio.h>
#include<iostream>
#include<string>
#include<math.h>
#include<map>
#include<iterator>
using namespace std;
#define tt int t;cin>>t;while(t--)
#define ll long long
#define nl endl
#define srt(v) sort(v.begin(),v.end());
#define rsrt(v) sort(v.begin(),v.end(),greater<int>());
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*b)/gcd(a,b)
#define amax(a,n) *max_element(a,a+n)
#define amin(a,n) *min_element(a,a+n)
#define vmax(a) *max_element(a.begin(),a.end())
#define vmin(a) *min_element(a.begin(),a.end())
#define so ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define a_size 100
ll i,j;

int main()
{
        so

        ll n,a[300],mx=0,ctr=0;
        cin>>n;
        for(i=0;i<2*n;i++){
          cin>>a[i];
        }
        for(i=0;i<2*n-1;i+=2){
          if(a[i]==a[i+1]){ctr++;mx=max(mx,ctr);}
          else ctr=0;
        }
        if(mx>=3)cout<<"Yes";
          else cout<<"No";

        return 0;
}



Measured memory_bytes: 3636
import math

def get_inp():
	inp = str(input()).split()
	return float(inp[0]), float(inp[1])

n, d = get_inp()
result = 0
for _ in range(int(n)):
  x, y = get_inp()
  if math.sqrt(pow(x, 2) + pow(y, 2)) <= d:
    result += 1

print(result)


Measured memory_bytes: 9200
N = int(input())
s = [input() for i in range(N)]
M = int(input())
t = [input() for i in range(M)]
d1, d2 = {}, {}
for i in s:
    d1.setdefault(i, 0)
    if i in d1:
        d1[i] += 1
for i in t:
    d2.setdefault(i, 0)
    if i in d2:
        d2[i] += 1
bucket = [d1[i]-d2[i] if i in d2 else d1[i] for i in d1]
ans = max(bucket)
if ans > 0:
    print(ans)
else:
    print(0)

Measured memory_bytes: 3064
#include<stdio.h>
int main()
{
    long long int k,i,c=0,m=100;
     
    scanf("%lld",&k);
    for ( i = 0;; i++)
    {
        m=m+((m*1)/100);
        c++;
        if(m>=k)
        {
            break;
        }
    }
    printf("%lld\n",c);
    
}

Measured memory_bytes: 1732
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <map>
#include <vector>
#include <stack>
#include <queue>
#include <tuple>
#include <cassert>
#include <functional>
#include <set>
#include <deque>
#include <list>
using namespace std;
typedef long long ll;
int dx[4] = {0,0,1,-1};
int dy[4] = {1,-1,0,0};
const int INF = 1<<29;
#define LNF __LONG_LONG_MAX__
const ll MOD = 1000000007;
const int MAX = 200000;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
// 法mでのaの逆元を計算
long long modinv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}
// a^n mod を計算する
long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
//最大公約数
int gcd(int x, int y) { return (x % y)? gcd(y, x % y): y; }
//最小公倍数
int lcm(int x, int y) { return x / gcd(x, y) * y; }
// nが大きく,kが10^7程度の時の二項係数
long long com[200005];
void combination(long long n,long long k){
    com[0] = 1;
    for(int i=1;i<=k;i++){
        com[i] = (com[i-1]*(n-i+1)%MOD)*modinv(i,MOD)%MOD;
    }
}

int main(){
    int n; cin >> n;
    string S;
    vector<int> mm(26,INF);
    string out="";
    for(int i=0;i<n;i++){
        vector<int> c(26,0);
        cin >> S;
        for(int j=0;j<S.size();j++){
            c[S[j]-'a']++;
        }
        for(int j=0;j<26;j++){
            if(mm[j]>c[j]) mm[j] = c[j];
        }
    }
    
    for(int i=0;i<26;i++){
        int t = mm[i];
        if(t==0) continue;
        for(int j=0;j<t;j++){
            cout << (char)('a'+i);
        }
    }
    printf("\n");

    return 0;
}


Measured memory_bytes: 3588
H, W = [int(n) for n in input().split()]
if H == 1 or W == 1:
    print(1)
elif H%2 == 0:
    print(H*W//2)
else:
    h = (H+1)//2
    h_ = h-1
    if W%2 == 0:
        print((h+h_)*W//2)
    else:
        print((h+h_)*(W//2) + h)


Measured memory_bytes: 2940