akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>

int	main(void)
{
  	int	n;
  	int	i;
  	long long	sum;
  	
  	scanf("%d", &n);
  
  	sum = 0;
  	for(i=1; i<=n; i++)
    {
	  	if(i % 5 == 0)
	  	{
          	continue ;
	  	}
      	if(i % 3 == 0)
        {
            continue ;
        }
      	sum += i;
    }
  	printf("%lld", sum);
  	return (0);
}

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

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

int dy[] = {-1, 0, 0, 1};
int dx[] = {0, -1, 1, 0};
int H, W;
string s[110];

void dfs(int y, int x, char c) {
  s[y][x] = '.';
  for (int i = 0; i < 4; i++) {
    int ny = y + dy[i], nx = x + dx[i];
    if (ny >= 0 && ny < H && nx >= 0 && nx < W && s[ny][nx] == c) {
      dfs(ny, nx, c);
    }
  }
}

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  
  while (cin >> H >> W, H) {
    for (int i = 0; i < H; i++) {
      cin >> s[i];
    }
    int ans = 0;
    for (int i = 0; i < H; i++) {
      for (int j = 0; j < W; j++) {
        if (s[i][j] == '.') continue;
        ans++;
        dfs(i, j, s[i][j]);
      }
    }
    cout << ans << endl;
  }

  return 0;
}


Measured memory_bytes: 4056
#include <algorithm>
#include <iostream>
#include <cstdlib>
#include <cstring>
#include <cstdio>
#include <cmath>
using namespace std;

int a,b;

void work()
{
	scanf("%d %d",&a,&b);
	if ((a<=0)&&(0<=b))  puts("Zero");
	else  if (a>0)  puts("Positive");
	else  puts(((a^b)&1)?"Positive":"Negative");
}

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


Measured memory_bytes: 256
#!/usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float, input().split()))
def LI_(): return list(map(lambda x: int(x)-1, input().split()))
def II(): return int(input())
def IF(): return float(input())
def LS(): return list(map(list, input().split()))
def S(): return list(input().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float("inf")

"""
URL: https://atcoder.jp/contests/dp/tasks/dp_n
N - Slimes / 
実行時間制限: 2 sec / メモリ制限: 1024 MB

配点 : 
100 点

問題文
N 匹のスライムが横一列に並んでいます。 
最初、左から i 番目のスライムの大きさは ai です。

太郎君は、すべてのスライムを合体させて 1 匹のスライムにしようとしています。 
スライムが 1 匹になるまで、太郎君は次の操作を繰り返し行います。

左右に隣り合う 2 匹のスライムを選び、それらを合体させて新しい 1 匹のスライムにする。 
合体前の 2 匹のスライムの大きさを x および y とすると、
    合体後のスライムの大きさは x+y となる。 
このとき、太郎君は x+y のコストを支払う。 
なお、合体の前後でスライムたちの位置関係は変わらない。
太郎君が支払うコストの総和の最小値を求めてください。
"""
#solve
def solve():
    n = II()
    a = LI()
    dp = [[0] * (n + 1) for i in range(n)]
    acc = [0] + list(itertools.accumulate(a))
    c = [[0] * (n + 1) for i in range(n)]
    def f(l, r):
        tmp = inf
        if c[l][r]: return dp[l][r]
        c[l][r] = 1
        # print(dp, l, r)
        if l + 1 == r: return 0
        
        
        for i in range(l + 1, r):
            tmp = min(tmp, f(l, i) + f(i, r) + acc[r] - acc[l])
        # print(l,r)
        dp[l][r] = tmp
        return tmp
    print(f(0, n))
    # print(dp)
    return


#main
if __name__ == '__main__':
    solve()


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

int main() {

  int N;
  cin >> N;

  /* input data */
  vector<int> A(N);
  for(int i=0;i<N;i++){
    cin >> A.at(i);
  }
  
  /* push button */
  int count=0;
  int next=0;
  for(int i=0;i<N;i++){
    next = A.at(max(next-1,0));
    
    if(next == 2){
      count = i+1;
      break;
    }
  }
    
  
  /* output data */
  if(count!=0)
    cout << count << endl;
  else
    cout << -1 << endl; 
}


Measured memory_bytes: 640
s=input()
if s=="SUN":
  print(7)
elif s=="MON":
  print(6)
elif s=="TUE":
  print(5)
elif s=="WED":
  print(4)
elif s=="THU":
  print(3)
elif s=="FRI":
  print(2)
elif s=="SAT":
  print(1)

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

#define ONLINE_JUDGE
#define pb(a) push_back(a)
#define all(a) (a.begin(), a.end())

using ll = long long;

const int E5 = 1e5;

//////////// Solution /////////////////////////////////

map<int,int> d,md;
int cur[11] = {};
int cnt[3] = {};
int n,k,ans=0,j=0,t;

bool next() {
	int i = 0;
	bool was_emp = false;
	if (cur[i]==-1) was_emp = true;
	cur[i] = (cur[i] == -1 ? 3 : d[(d[cur[i]] + 1) % 3]);
	while (i <= k && !was_emp && cur[i] == 3) {
		++i;
		was_emp = false;
		if (cur[i] == -1) was_emp = true;
		cur[i] = (cur[i] == -1 ? 3 : d[(d[cur[i]] + 1) % 3]);
		if (i >= k || (i == k && cur[i] > t)) {
			return false;
		}
	}
	//cout << "#";
	j = max(j,i);
	int num = 0;

	for (int l = j; l >= 0; --l) {
	//	cout << cur[l];
		num = num*10 + cur[l];
	}
//	cout << '\n';

	for (int l = 0; l < 3; ++l) 
		cnt[l] = 0;
	

	for (int l = 0; l <= j; ++l) {
		cnt[d[cur[l]]]++;
	}


	//cout << cnt[0] << ' ' << cnt[1] << ' ' << cnt[2] << '\n';
	if (num <= n && cnt[0] >= 1 && cnt[1] >= 1 && cnt[2] >= 1)
		++ans;

	return true;
}

void solve() {
	d[3] = 0;
	d[5] = 1;
	d[7] = 2;
	d[0] = 3;
	d[1] = 5;
	d[2] = 7;
	fill(cur,cur+11,-1);
	cin >> n;
	k = 1;
	t = n;
	
	while(t/10 != 0) {
		t /= 10;
		++k;
	}
	//cout << "k: " << k << '\n';

	while (1) {
		bool fl = false;
		fl = next();
		if (!fl)
			break;	
	}

	cout << ans << '\n';
}	

/////////// End Solution ///////////////////////////////////////

//////// Initialization ////////////////////////////////////

int main() {

	#ifndef ONLINE_JUDGE
	FILE *FIN = freopen("/home/danil/prog/input.txt", "r", stdin);
	clock_t time_start = clock();
	#endif

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

	solve();

	#ifndef ONLINE_JUDGE
	fclose(FIN);
	cerr << "\x1b[031m\n-----------------\nTime=" << (ll)((double)(clock()-time_start) / CLOCKS_PER_SEC * 1000) << "ms\n\x1b[0m";
	#endif

	return 0;
}

//////// End Initialization ///////////////////////////////////////

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include<math.h>
#include<queue>
#include<cstdio>
#include<set>
#include<map>
using namespace std;
using ll = long long;

int main(){
    ll N;
    cin >> N;
    vector<ll> A(N);
    for(ll i=0; i<N; i++){
        cin >> A.at(i);
    }
    sort(A.begin(),A.end());
    vector<ll> prime(A.at(N-1)+1,0);
    ll ans=0;
    for(ll i=0; i<N; i++){
        if(prime.at(A.at(i))==0){
            if(i<N-1){
                if(A.at(i)==A.at(i+1)){
                    ans--;
                }
            }
            ans++;
            ll k=1;
            while(A.at(i)*k<=A.at(N-1)){
                prime.at(A.at(i)*k)=1;
                k++;
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 12680
#include <iostream>
#include <string>

using namespace std;

int main()
{
	int n;
	cin >> n;
	
	string s[n];
	for(int i = 0; i < n; i++)
	{
		cin >> s[i];
	}
	
	char c = 'a';
	int cnt[n][26] = {0};
	for(int i = 0; i < n; i++)
	{
		for(int j = 0; j < s[i].size(); j++)
		{
			cnt[i][s[i][j] - 'a']++;
		}
	}
	
	int a[26] = {0};
	for(int i = 0; i < 26; i++)
	{
		bool flag = true;
		int min = 99999;
		
		for(int j = 0; j < n; j++)
		{
			if(cnt[j][i] < min && cnt[j][i] != 0)
			{
				min = cnt[j][i];
			}
			
			if(cnt[j][i] == 0)
			{
				flag = false;
				break;
			}
		}
		
		if(flag == true)
		{
			while(min > 0)
			{
				cout << char('a' + i);
				min--;
			}
		}
	}
	
	cout << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;
const int maxn=1e5+5;
#define ll long long
int main() {
	string s;
	bool flag=1;
	cin>>s;
	int len=s.length();
	if(s[2]!=s[3]||s[4]!=s[5])flag=0;
	if(flag)cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(v) v.begin(), v.end()
using namespace std;
typedef long long ll;

int main() {
	
	int n;
	cin >> n;
	vector<int> a(n/2), b(n/2);
	map<int, int> a_map, b_map;
	rep(i, n){
		if(i % 2 == 0){
			cin >> a[i/2];
			if(a_map.count(a[i/2])){
				a_map.at(a[i/2])++;
			}else{
				a_map[a[i/2]] = 1;
			}
		}
		else{
			cin >> b[i/2];
			if(b_map.count(b[i/2])){
				b_map.at(b[i/2])++;
			}else{
				b_map[b[i/2]] = 1;
			}
		}
	}
	
	int a_max = 0, b_max = 0;
	int a_max2 = 0, b_max2 = 0;
	int a_top, b_top;
	for(auto p: a_map){
		if(a_max < p.second){
			if(a_max2 < a_max) a_max2 = a_max;
			a_max = p.second;
			a_top = p.first;
		}else if(a_max2 < p.second){
			a_max2 = p.second;
		}
	}
	for(auto p: b_map){
		if(b_max < p.second){
			if(b_max2 < b_max) b_max2 = b_max;
			b_max = p.second;
			b_top = p.first;
		}else if(b_max2 < p.second){
			b_max2 = p.second;
		}
	}
	int ans;
	if(a_top != b_top){
		ans = n - a_max - b_max;
	}else{
		ans = min(n - a_max2 - b_max, n - a_max - b_max2);
		// cout << a_max << " " << b_max << endl;
		// cout << a_max2 << " " << b_max2 << endl;
	}
	cout << ans << endl;
	return 0;
}

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

#define fastIO ios_base::sync_with_stdio(false); cin.tie(NULL);
#define pb push_back
#define mod 1000000007
#define mp make_pair
#define fi first
#define se second
#define merge(a,b) a##b //concat a and b
#define mkstr(a) #a  //convert a to string a. a is not variable
#define flush fflush(stdout);
#define debug(x) cout<<#x<<endl;
#define debug1(x) cout<<x<<endl;
#define inf 1e18
#define endl "\n"
#define epsilon 1e-9

typedef long long int ll;
typedef long double   ld;
typedef unsigned long long int ull;

/************************************TEMPLATE**********************************/

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

/*************************************CODE*************************************/

int main()
{
  // freopen("input.txt","r",stdin);
  // freopen("output.txt","w",stdout);
  fastIO
  ll test_case=1;
  //cin>>test_case;
  while(test_case--)  {
    int n,x,t;
    cin>>n>>x>>t;
    n=(n+x-1)/x;
    cout<<n*t<<endl;
  }
  return 0;
}


Measured memory_bytes: 3596
#![allow(unused_parens)]
#![allow(unused_imports)]
#![allow(non_upper_case_globals)]


macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($next:expr, [$t:tt]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };
    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}


#[cfg(debug_assertions)]
macro_rules! mydbg {
    //($arg:expr) => (dbg!($arg))
    ($arg:expr) => (println!("{:?}",$arg));
}


#[cfg(not(debug_assertions))]
macro_rules! mydbg {
    ($($arg:expr),*) => {};
}


use std::cmp;
use std::collections::HashMap;





fn main() {

    input! { 
       s: chars,
    }

    
    let mut a: char;
    let mut b:char;
    let mut c:char;

    a = s[0];
    b = s[1];

    if s.len() == 2{
        if a==b{
            println!("{} {}",1,2);
            return;
        }
        else{
            println!("{} {}",-1,-1);
            return;
        }

    }

    for i in 2..s.len(){
        c = s[i];
        if( a==b || a==c || b==c){
            println!("{} {}",i-1,i+1);
            return;
        }

        std::mem::swap(&mut a, &mut b);
        std::mem::swap(&mut b, &mut c);
        
    }
    
    
    println!("{} {}",-1,-1);


}


Measured memory_bytes: 4352
use proconio::input;
#[allow(unused_imports)]
use proconio::marker::*;
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;
#[allow(unused_imports)]
use std::f64::consts::*;

#[allow(unused)]
const INF: usize = std::usize::MAX / 4;
#[allow(unused)]
const M: usize = 1000000007;

fn main() {
    input! {
        s: Chars,
    }
    let n = s.len();
    if (n % 2 == 0) == (s[0] == s[n - 1]) {
        println!("First");
    } else {
        println!("Second");
    }
}


Measured memory_bytes: 2544
def fun(n, k):
    A = []
    total = 0
    for _ in range(n):
        a = int(input())
        total += a
        A.append(total)
    maximam = A[k-1]
    for num, a in zip(range(k,n), A[k:]):
        maximam = max(maximam, A[num] - A[num - k])
    print(maximam)

for _ in range(5):
    n, k = map(int, input().split())
    if n == 0 and k == 0:
        break
    else:
        fun(n, k)


Measured memory_bytes: 9912
#include<bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef pair<int, int> P;
 
#define mod 1000000007
#define inf 1000000000
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define popcount(x) __builtin_popcountll(x)
 
const long double PI = acos(-1);
 
ll gcd(ll a,ll b){return b ? gcd(b,a%b) : a;}
ll lcm(ll a,ll b){return a / gcd(a,b) * b;}
 
int main(){
  string s;
  cin >> s;
  ll q;
  cin >> q;

  bool rev = false;
  for(ll i = 0; i < q; i++){
    ll t;
    cin >> t;
    if(t == 1){
      if(rev) rev = false;
      else rev = true;
    }else{
      ll f;
      char c;
      cin >> f >> c;
      if(f == 1){
        if(rev == false) s.insert(s.begin(), c);
        else s.pb(c);
      }else{
        if(rev == false) s.pb(c);
        else s.insert(s.begin(), c);
      }
    }
    //cout << s << endl;
  }

  if(rev) reverse(all(s));

  cout << s << endl;
  return 0;
}

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

int main(){

    int n;
    int ans=0;
    cin>>n;
    for(int i=1;i<=n;i++){
        if(i>=1&&i<=9||i>=100&&i<=999||i>=10000&&i<=99999) ans++;
    }

    cout<<ans<<endl;




    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
const int MOD = 1e9+7;
const int INF = 0x3f3f3f3f;
const double PI = 4*atan(1);
typedef long long ll;
typedef pair<int,int> pii;
int n;
string s;
// int gcd(int a, int b) { 
//     if (a == 0) return b; 
//     return gcd(b % a, a); 
// } 
void solve() {
	cin >> n >> s;
	int r = 0, g = 0, b = 0;
	for (int i = 0; i < n; i++) {
		if (s[i] == 'R') {
			r++;
		} else if (s[i] == 'G') {
			g++;
		} else if (s[i] == 'B') {
			b++;
		}
	}
	ll sum = 1LL * r * g * b;
	for (int i = 0; i < n; i++) {
		for (int j = i+1; j < n; j++) {
			if (s[i] == s[j]) continue;
			int k = j + (j-i);
			if (k >= n) continue;
			if (s[k] != s[i] && s[k] != s[j]) {
				sum--;
			}
		}
	}
	printf("%lld\n",sum);
}
int main() {
	#ifndef ONLINE_JUDGE
		freopen("input.txt","r",stdin);
		freopen("output.txt","w",stdout);
	#endif
	// int t;
	// cin >> t;
	// for (int i = 1; i <= t; i++) { 
		// cout << "Case #" << i << ": ";
		solve();
	// }
}

Measured memory_bytes: 3768
#include <cstdio>
#include <map>
using namespace std;
int n, k, l, a[200005], b[200005];
map<pair<int,int>,int> mp;
 
int f(int p, int x[]) {
	if(x[p]==p) return p;
	else return x[p] = f(x[p], x);
}
 
int main() {
	int i, u, v;
	scanf("%d%d%d", &n, &k, &l);
	for(i=1; i<=n; i++) a[i] = b[i] = i;
	while(k--) {
		scanf("%d%d", &u, &v);
		u = f(u,a), v = f(v,a);
		if(u!=v) a[u] = v;
	}
	while(l--) {
		scanf("%d%d", &u, &v);
		u = f(u,b), v = f(v,b);
		if(u!=v) b[u] = v;
	}
	for(i=1; i<=n; i++) {
		u = f(i,a), v = f(i,b);
		mp[{u,v}]++;
	}
	for(i=1; i<=n; i++) {
		u = f(i,a), v = f(i,b);
		printf("%d ", mp[{u,v}]);
	}
	return 0;
}

Measured memory_bytes: 13568
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

struct Vertex {
    int x, y;
};

vector<Vertex> inputVertexes(int m) {
    vector<Vertex> vertexes(m);
    int px, py;
    for (vector<Vertex>::iterator it = vertexes.begin(); it != vertexes.end(); it++) {
        cin >> (*it).x >> (*it).y;
        if (it == vertexes.begin()) {
            px = (*it).x;
            py = (*it).y;
        }
        (*it).x -= px;
        (*it).y -= py;
    }
    return vertexes;
}

int main() {
    while (true) {
        int n;
        cin >> n;
        if (n == 0) {
            break;
        }
        int m;
        cin >> m;
        vector<Vertex> patterns = inputVertexes(m);
        for (int i = 0; i < n; i++) {
            int size;
            cin >> size;
            vector<Vertex> subjects = inputVertexes(size);
            if (m != size) {
                continue;
            }
            for (int j = 0; j < 2; j++) {
                for (int k = 0; k < 4; k++) {
                    bool match = true;
                    for (int l = 0; l < m; l++) {
                        if (patterns[l].x != subjects[l].x || patterns[l].y != subjects[l].y) {
                            match = false;
                            break;
                        }
                    }
                    if (match) {
                        cout << i + 1 << endl;
                        goto endMatch;
                    }
                    for (vector<Vertex>::iterator it = subjects.begin(); it != subjects.end(); it++) {
                        int nx = -(*it).y, ny = (*it).x;
                        (*it).x = nx;
                        (*it).y = ny;
                    }
                }
                if (j == 0) {
                    reverse(subjects.begin(), subjects.end());
                    int px, py;
                    for (vector<Vertex>::iterator it = subjects.begin(); it != subjects.end(); it++) {
                        if (it == subjects.begin()) {
                            px = (*it).x;
                            py = (*it).y;
                        }
                        (*it).x -= px;
                        (*it).y -= py;
                    }
                }
            }
        endMatch:;
        }
        cout << "+++++" << endl;
    }
}

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

using namespace std;

#define all(c)	(c).begin(),(c).end()
#define rall(c)	(c).rbegin(),(c).rend()
#define rep(i,N)	for(int i=0;i<N;++i)
#define pb	push_back
#define eb	emplace_back

using ll = long long;

constexpr ll INF = 0x0fffffffffffffff;
constexpr int inf = 0x1fffffff;
constexpr double inf_l = 1e18;
constexpr ll MOD = 1000000007LL;
constexpr int mod = 1000000007;

int main()
{
	int N; cin >> N;
	vector<int> a(N);
	for (auto& i : a)cin >> i;
	sort(all(a));
	int ans = inf;
	int tf = accumulate(all(a), 0) / N;
	int tc = (accumulate(all(a), 0) + N - 1) / N;
	int target[2] = { tf,tc };
	for (int i = 0; i < 2; ++i) {
		int tmp = 0;
		for (int j = 0; j < N; ++j) {
			tmp += (a[j] - target[i])*(a[j] - target[i]);
		}
		ans = min(ans, tmp);
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		
		int N = sc.nextInt();
		int T = sc.nextInt();
		int[] t = new int[N];
		for(int i=0; i<N; i++){
			t[i] = sc.nextInt();
		}
		
		if(N==1){
			System.out.println(T);
		} else {
			int time = 0;
			int total = T;
			for(int i=1; i<N; i++){
				time = t[i]-t[i-1];
				if(time>=T){
					total += T;
				} else {
					total += time;
				}
			}
			System.out.println(total);
		}
		
		sc.close();
	}

}

Measured memory_bytes: 65600
#include<stdio.h>


int put[ 100 ] ;

int came ;


void back( int now )
{
	if( came == 0 )
	{
		int i ;
		for( i = now - 1 ; i > -1 ; --i )
		{
			put[ i ] = -1 ;
		}

		++came ;
	}
}


int main( void )
{
	int H ,W ;
	scanf( "%d %d" ,&H ,&W ) ;

	int p ;

	int i ,j ;
	for( i = 0 ; i < H ; ++i )
	{
		getchar() ;

		for( j = 0 ; j < W ; ++j )
		{
			char c = getchar() ;

			if( c == 'c' )
			{
				p = j ;

				put[ j ] = 0 ;

				back( j ) ;
			}

			else if( came == 1 )
			{
				put[ j ] = j - p ;
			}
		}

		if( came == 0 )
		{
			back( j ) ;
		}

		for( j = 0 ; j < W ; ++j )
		{
			printf( "%d" ,put[ j ] ) ;

			if( j == W - 1 )
			{
				puts( "" ) ;
			}

			else
			{
				printf( " " ) ;
			}
		}

		came = 0 ;
	}


	return 0 ;
}

Measured memory_bytes: 1812
class UnionFind():
    def __init__(self, N):
        self.par = [i for i in range(N)]
        self.rank = [0 for _ in range(N)]
        self.size = [1 for _ in range(N)]

    def find(self, x):
        if self.par[x] == x:
            return x
        else:
            self.par[x] = self.find(self.par[x])
            return self.par[x]
    
    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if x != y:
            if self.rank[x] == self.rank[y]:
                self.rank[x] += 1
            elif self.rank[x] < self.rank[y]:
                x, y = y, x
            self.par[y] = x
            self.size[x] += self.size[y]

    def is_same(self, x, y):
        return self.find(x) == self.find(y)
    
    def get_size(self, x):
        x = self.find(x)
        return self.size[x]

N, M = map(int, input().split())
P = list(map(int, input().split()))
uf = UnionFind(N)
for i in range(M):
    x, y = map(int, input().split())
    x, y = x-1, y-1
    uf.union(x, y)

ans = 0
for i in range(N):
    if uf.is_same(i, P[i]-1):
        ans += 1

print(ans)

Measured memory_bytes: 96492
#include <cstdio>
typedef long long LL;
int main() {
  int N;
  scanf("%d", &N);
  for (int h = 1; h <= 3500; ++h)
    for (int n = 1; n <= h; ++n) {
      double t = 4.0 / N - 1.0 / h - 1.0 / n;
      if (t < 1e-15) continue;
      LL k = (int)(1.0 / t + 0.5);
      if (4LL * n * h * k == N * ((LL)n * k + (LL)k * h + (LL)h * n)) {
        printf("%d %d %lld\n", n, h, k);
        return 0;
      }
      if (k > 0 && k < h) break;
    }
  return 0;
}


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


int main() {
    string s;
    cin >> s;
    int n = s.length();
    int ans = INF;
    rep(i,n-2){
        int num = (s[i]-'0')*100 + (s[i+1]-'0')*10 + s[i+2]-'0';
        ans = min(ans,abs(num-753));
    }
    cout << ans << endl;
    return 0;
}

/*
やっほい！
　　　　　　　やほほい！
　　　　+　　 　*
　　　 ∧∧　　. ∧∞∧　*
*　ヽ(=´ω｀)人(´ω｀*)ﾉ
　.～（ O x.） （ 　 O)～　+
。*　 　∪　　　　∪
*/

Measured memory_bytes: 256
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    N, K = map(int, readline().split())
    point = list(map(int, readline().split()))
    T = readline().strip()

    T = T.translate(str.maketrans('rsp', '012'))
    T = list(map(int, T))

    ans = 0
    for i in range(K):
        vec = T[i::K]
        M = len(vec)

        dp = [[0] * 3 for _ in range(M + 1)]
        for j in range(M):
            for k in range(3):
                dp[j + 1][k] = max(dp[j][(k + 1) % 3], dp[j][(k + 2) % 3])
                if (k + 1) % 3 == vec[j]:
                    dp[j + 1][k] += point[k]
        ans += max(dp[M])

    print(ans)
    return


if __name__ == '__main__':
    main()


Measured memory_bytes: 94304
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define mp make_pair
#define PI pair<ll,ll>
#define poly vector<ll>
#define mem(a) memset((a),0,sizeof(a))
#define For(i,l,r) for(int i=(int)(l);i<=(int)(r);i++)
#define Rep(i,r,l) for(int i=(int)(r);i>=(int)(l);i--)
#define pb push_back
#define fi first
#define se second
#define SZ(x) ((int)(x.size()))
inline char gc(){
    static char buf[100000],*p1=buf,*p2=buf;
    return p1==p2&&(p2=(p1=buf)+fread(buf,1,100000,stdin),p1==p2)?EOF:*p1++;
}
#define gc getchar
inline ll read(){
	ll x = 0; char ch = gc(); bool positive = 1;
	for (; !isdigit(ch); ch = gc())	if (ch == '-')	positive = 0;
	for (; isdigit(ch); ch = gc())	x = x * 10 + ch - '0';
	return positive ? x : -x;
}
inline void write(ll a){
    if(a<0){
    	a=-a; putchar('-');
	}
    if(a>=10)write(a/10);
    putchar('0'+a%10);
}
inline void writeln(ll a){write(a); puts("");}
inline void wri(ll a){write(a); putchar(' ');}
ll rnd(){
	ull ans=0;
	For(i,0,4)ans=ans<<15^rand();
	return ans%((ull)1<<63);
}
const int N=10005;
int a[N],b[N];
void GG(){
	puts("No"); exit(0);
}
char ask(int t){
	cout<<t<<endl;
	string s;
	cin>>s;
	if(s[0]=='V')exit(0);
	return s[0];
}
void solve(int l,int r,char L){
	int mid=(l+r)>>1;
	char t=ask(mid);
	if((t==L)^(l%2)^(mid%2))solve(mid,r,t); else solve(l,mid,L);
}
int main(){
	#ifdef Brollan
		//freopen("1.in","r",stdin);
	#endif
	int n=read();
	ask(n-1);
	solve(0,n-1,ask(0));
}

Measured memory_bytes: 3856
//package atcoder.beginner179;

import java.io.*;
import java.util.*;

public class Main {
    static InputReader in;
    static PrintWriter out;

    public static void main(String[] args) {
        //initReaderPrinter(true);
        initReaderPrinter(false);
        //solve(in.nextInt());
        solve(1);
    }

    static void solve(int testCnt) {
        for (int testNumber = 0; testNumber < testCnt; testNumber++) {
            int n = in.nextInt();
            int ans = 0;
            for(int a = 1; a < n; a++) {
                ans += (n - 1) / a;
            }
            out.println(ans);
        }
        out.close();
    }

    static void initReaderPrinter(boolean test) {
        if (test) {
            try {
                in = new InputReader(new FileInputStream("src/input.in"));
                out = new PrintWriter(new FileOutputStream("src/output.out"));
            } catch (IOException e) {
                e.printStackTrace();
            }
        } else {
            in = new InputReader(System.in);
            out = new PrintWriter(System.out);
        }
    }

    static class InputReader {
        BufferedReader br;
        StringTokenizer st;

        InputReader(InputStream stream) {
            try {
                br = new BufferedReader(new InputStreamReader(stream), 32768);
            } catch (Exception e) {
                e.printStackTrace();
            }
        }

        String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

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

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

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

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }

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

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




Measured memory_bytes: 25772
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.PrintStream;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
  public static void main(String[] args) {
    InputStream inputStream = System.in;
    OutputStream outputStream = System.out;
    Scanner in = new Scanner(inputStream);
    PrintWriter out = new PrintWriter(outputStream);
    B solver = new B();
    solver.solve(1, in, out);
    out.close();
  }

  static class B {
    public void solve(int testNumber, Scanner in, PrintWriter out) {
      int A = in.nextInt();
      int B = in.nextInt();
      int H = in.nextInt();
      int M = in.nextInt();

      double angleA = (H * 60 + M) * Math.PI / 360;
      double angleB = (M * Math.PI) / 30;
      double C = A * A + B * B - (2 * A * B * Math.cos(Math.abs(angleA - angleB)));
      System.out.println(Math.sqrt(C));
    }

  }
}



Measured memory_bytes: 36144
#include <bits/stdc++.h>
#define lsb(x) (x & (-x))
#define ll long long
#define ull unsigned long long



#if 0
const int MOD = ;

inline int lgput(int a, int b) {
    int ans = 1;
    while(b > 0) {
        if(b & 1) ans = (1LL * ans * a) % MOD;
        b >>= 1;
        a = (1LL * a * a) % MOD;
    }
    return ans;
}

inline void mod(int &x) {
    if(x >= MOD)
        x -= MOD;
}

inline void add(int &x, int y) {
    x += y;
    mod(x);
}

inline void sub(int &x, int y) {
    x += MOD - y;
    mod(x);
}

inline void mul(int &x, int y) {
    x = (1LL * x * y) % MOD;
}

inline int inv(int x) {
    return lgput(x, MOD - 2);
}
#endif

#if 0
int fact[], invfact[];

inline void prec(int n) {
    fact[0] = 1;
    for(int i = 1; i <= n; i++) {
        fact[i] = (1LL * fact[i - 1] * i) % MOD;
    }
    invfact[n] = lgput(fact[n], MOD - 2);
    for(int i = n - 1; i >= 0; i--) {
        invfact[i] = (1LL * invfact[i + 1] * (i + 1)) % MOD;
    }
}

inline int comb(int n, int k) {
    if(n < k) return 0;
    return (1LL * fact[n] * (1LL * invfact[k] * invfact[n - k] % MOD)) % MOD;
}
#endif

using namespace std;

const int MAXN = (int) 2e5;

vector <int> g[MAXN + 1];
int dp[MAXN + 1], dst[MAXN + 1];

void dfs(int nod, int par) {
    for(auto it : g[nod]) {
        if(it != par) {
            dst[it] = dst[nod] + 1;
            dfs(it, nod);
        }
    }
}


int main() {
#if 0
    ifstream cin("A.in");
    ofstream cout("A.out");
#endif
    int i, n;
    ios::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);

    cin >> n;
    for(i = 1; i < n; i++) {
        int x, y;
        cin >> x >> y;
        g[x].push_back(y);
        g[y].push_back(x);
    }

    if(n == 1) {
        cout << "First";
        return 0;
    }

    dp[0] = 1;
    dp[1] = 0;
    for(i = 2; i <= n; i++) {
        dp[i] = 1 - min(dp[i - 1], dp[i - 2]);
    }

    dfs(1, 0);
    int id, mx = 0;
    for(i = 1; i <= n; i++) {
        if(dst[i] > mx) {
            mx = dst[i], id = i;
        }
    }
    dst[id] = 0;
    dfs(id, 0);

    mx = *max_element(dst, dst + n + 1);
    if(dp[mx] == 1) {
        cout << "First";
    }
    else {
        cout << "Second";
    }


    return 0;
}



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

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

int main(void)
{
    int K = 0;
    int N = 0;
    int A[1000000];
    scanf("%d %d", &K,&N);
    int n = 0;//一時置き換え
    while (n < N)
    {
        scanf("%d",&A[n]);
        n++;
    }

    qsort(A,N, sizeof(int), compare);
    int dis[1000000];
    int i,MAX=0;
    for (i = 0; i < N; i++)
    {
        if(i!=N-1){
        dis[i] = A[i + 1] - A[i];
        }
        else
            dis[i] = K+A[0] - A[i];
        if(MAX<dis[i]){
            MAX = dis[i];
        }
    }

    printf("%d\n", K - MAX);
    return 0;
}

Measured memory_bytes: 3324
//============================================================================
// Name        : abc100.cpp
// Author      : 
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
using namespace std;

inline int func001() {

	int a, b;

	cin >> a >> b;

	if ((a <= 8) && (b <= 8)) {
		cout << "Yay!";
	} else {
		cout << ":(";
	}

	return 0;

}

inline int func002() {

	return 0;

}

//#define TEST 1

int main() {

#ifdef TEST
	while (1)
#endif
		func001();

	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

public static void main(String[] args) {

 Scanner in = new Scanner(System.in);
 int A = in.nextInt();
 int B = in.nextInt();
 int C = in.nextInt();
 int D = in.nextInt();

 int start = Math.max(A, C);
 int end = Math.min(B, D);

 if((A <= start)&&(start <= B)&&(C <= start)&&(start <= D)&&(A <= end)&&(end <= B)&&(C <= end)&&(end <= D)){
    System.out.println(end - start);
 }
 else{
	 System.out.println("0");
 }

 in.close();
}
}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pint pair<int, int>
#define pll pair<ll, ll>
#define vint vector<int >
#define vll vector<ll >
#define ALL(x) (x).begin(), (x).end()
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i,n) for (int i = 0; i < (n); ++i)
const int INF = 100100100;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;

#include <iostream>
#include <vector>
using namespace std;

vector<pair<long long, long long> > prime_factorize(long long N) {
    vector<pair<long long, long long> > res;
    for (long long a = 2; a * a <= N; ++a) {
        if (N % a != 0) continue;
        long long ex = 0; // 指数

        // 割れる限り割り続ける
        while (N % a == 0) {
            ++ex;
            N /= a;
        }

        // その結果を push
        res.push_back({a, ex});
    }

    // 最後に残った数について
    if (N != 1) res.push_back({N, 1});
    return res;
}
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    ll n;
    cin >> n;
    const auto &res = prime_factorize(n);
    ll ans = 0;
    for (auto p : res) {
        ll x = 1;
        ll cnt = 1;
        while(x <=  p.second){
            ans++;
            cnt++;
            x += cnt;
        }
    }
    cout << ans << "\n";
    return 0;
}

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

public class Main {

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

	    int n=gi();
	    long[] a=new long[n];
	    for(int i=0; i<n;i++) {
	    	a[i]=gl();
	    }
	    int c=0;
	    for(int i=1; i<n;i++) {
	    	if(a[i-1]==a[i]) {
	    		c++;
	    		a[i]=-1;
	    	}
	    }
//	    if (s>x) {
//	    	System.out.println(n-1);
//	    } else {
//	    	Arrays.parallelSort(a);
//
//	    	System.out.println(c);
//	    }
	    System.out.println(c);
	}

	// 文字列として入力を取得
	public static String gs() {
		return scanner.next();
	}

	// intとして入力を取得
	public static int gi() {
		return Integer.parseInt(scanner.next());
	}

	// longとして入力を取得
	public static long gl() {
		return Long.parseLong(scanner.next());
	}

	// doubleとして入力を取得
	public static double gd() {
		return Double.parseDouble(scanner.next());
	}
}

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

const char nl = '\n';

void solve()
{
    int n, m, k; cin >> n >> m >> k;
    vector<ll> a{0}, b{0};
    int val;
    for (int i = 0; i < n; ++i) {
        cin >> val;
        a.push_back(a[i] + val);
    }
    for (int i = 0; i < m; ++i) {
        cin >> val;
        b.push_back(b[i] + val);
    }
    int ans = 0, j = m;
    for (int i = 0; i <= n; ++i) {
        if (a[i] > k) break;
        while (b[j] > k - a[i]) --j;
        ans = max(ans, i + j);
    }
    cout << ans << nl;
}

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

Measured memory_bytes: 7936
import java.io.*;
public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String str = br.readLine();
		String[] strs = str.split(" ");
		int W = Integer.parseInt(strs[0]);
		int H = Integer.parseInt(strs[1]);
		int x = Integer.parseInt(strs[2]);
		int y = Integer.parseInt(strs[3]);
		int r = Integer.parseInt(strs[4]);
		if((x - r) < 0 || (x + r) > W || (y - r) < 0 || (y + r) > H){
			System.out.println("No");
		}else if((x - r) >= 0 && (x + r) <= W && (y - r) >= 0 && (y + r) <= H){
			System.out.println("Yes");
		}else{
			System.out.println("No");
		}//if
		br.close();
	}
}

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

typedef long long ll;
typedef vector<ll> vint;
typedef vector< vector<ll> > vvint;

#define rep(i,n) for(ll i=0;i<n;i++)
#define repf(i,f,n) for(ll i=f;i<n;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define mp make_pair
#define mt make_tuple
#define ALL(obj) (obj).begin(), (obj).end()
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

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

template< typename T >
struct Compress {
  vector< T > xs;

  Compress() = default;

  Compress(const vector< T > &vs) {
    add(vs);
  }

  Compress(const initializer_list< vector< T > > &vs) {
    for(auto &p : vs) add(p);
  }

  void add(const vector< T > &vs) {
    copy(begin(vs), end(vs), back_inserter(xs));
  }

  void add(const T &x) {
    xs.emplace_back(x);
  }

  void build() {
    sort(begin(xs), end(xs));
    xs.erase(unique(begin(xs), end(xs)), end(xs));
  }

  vector< int > get(const vector< T > &vs) const {
    vector< int > ret;
    transform(begin(vs), end(vs), back_inserter(ret), [&](const T &x) {
      return lower_bound(begin(xs), end(xs), x) - begin(xs);
    });
    return ret;
  }

  int get(const T &x) const {
    return lower_bound(begin(xs), end(xs), x) - begin(xs);
  }

  const T &operator[](int k) const {
    return xs[k];
  }
};


int main() {
    cout<<fixed<<setprecision(10);

    ll n; cin>>n;
    vint a(n), b(n);
    rep(i,n) cin>>a[i]>>b[i];

    sort(ALL(a)); sort(ALL(b));

    if(n%2==0){
        ll x = a[n/2-1] + a[n/2];
        ll y = b[n/2-1] + b[n/2];
        cout<<y-x+1<<endl;
    }else{
        ll x = a[n/2];
        ll y = b[n/2];
        cout<<y-x+1<<endl;
    }


    return 0;

}

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

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
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; }
const int INF = (1<<30) - 1;
const ll LINF = (1LL<<60) - 1;

int main(){
    int a1, a2, a3;
    cin >> a1 >> a2 >> a3;
    if (a1 + a2 + a3 >= 22) cout << "bust" << endl;
    else cout << "win" << endl;
}

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

using namespace std;

#define ll long long
#define vi  vector<int>
#define vvi vector<vi>
#define pi  pair<int,int>
#define mp  make_pair
#define pb  push_back
#define MOD int(1e9) + 7
#define PAI  3.1415
#define all(x) (x).begin(),(x).end()
#define chmax(x,y) x = max(x,y)
#define chmin(x,y) x = min(x,y)
#define pr(x) cout << x << endl
#define Endl endl
#define rep(i,n) for(int i = 0 ; i < n; i++)

const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
const int ddx[8] = {-1,0,1,-1,1,-1,0,1};
const int ddy[8] = {-1,-1,-1,0,0,1,1,1};
const int inf = 99999999;
const ll linf = 1LL << 62;

ll gcd(ll a,ll b){
  if(a < b)swap(a , b);
  if(a % b != 0) gcd(b, a%b);
  return b;
}

ll lcm(ll a,ll b){
  if(a < b)swap(a , b);
  return (a / gcd(a , b)) * b;
}

int main(){
 
  int n; cin >> n;
  string s; cin >> s;
  int red = 0;
  int blue = 0;

  for(int i = 0; i < n; i++){
    if(s[i] == 'R')
      red++;
    else
      blue++;
  }

  if(red > blue)
    pr("Yes");
  else
    pr("No");

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
using ll = long long;
using P = pair<int,int>;
const long long inf = 1000000001; // const 書き換え禁止
const double PI = 3.14159265358979323846; //M_PI はライブラリ

int main(void){
    int n;
    string s;
    cin >> n >> s;
    string t;
    string u;
    // for(int i= 0;i< n/2;i++){
    //     t += s[i];
    // }
    // for(int i = n/2;i<n;i++){
    //     u += s[i];
    // }
    // cout << t << endl;
    // cout << u << endl;
    t = s.substr(0,n/2);
    u = s.substr(n/2,n);
    if(t == u){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}   

Measured memory_bytes: 3628
# frozen_string_literal: true
n = gets
array = gets.split(' ').map(&:to_i)

range = 0
tmp = 0
array.each_with_index do |e, i|
  if array.size == i + 1
    tmp = range if range > tmp
    break
  end

  if e >= array[i + 1]
    range += 1
  else
    tmp = range if range > tmp
    range = 0
  end
end

p tmp


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

int main(void){
  cout << fixed << setprecision(12);
   
  double a,b,C;
  cin>>a>>b>>C;
 
  double PI=acos(-1.0);
 
  C=C/180.0*PI;
   
  cout<< a*b*sin(C)/2.0 <<endl;
   
  double cc=a*a+b*b-2*a*b*cos(C);
  cout<< a+b+sqrt(cc) <<endl;
   
  cout<< b*sin(C) <<endl;
   
  return 0;  
}



Measured memory_bytes: 3592
import sys

while True:
    data = sys.stdin.readline().strip().split(' ')
    a = int(data[0])
    b = int(data[2])
    op = data[1]
    if op == '?':
        break

    if op == '+':
        ans = a + b
    elif op == '-':
        ans = a -b
    elif op == '*':
        ans = a * b
    else:
        ans = a // b

    print(ans)
    

Measured memory_bytes: 7696
package main

import (
	"fmt"
)

func main() {
	var s string
	fmt.Scan(&s)

	t := make([]int, 26)
	for _, c := range s {
		i := c - 'a'
		t[i]++
	}
	for i, e := range t {
		if e == 0 {
			c := rune('a' + i)
			fmt.Printf("%c\n", c)
			return
		}
	}
	fmt.Println("None")
}


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

int main() {
  int X,N;
  cin >> X>>N;
  int p[N];
  for(int i = 0;i<N;i++){
    cin >> p[i];
  }
  int couho = X;
  int end = 0;
  int co_sei;
  int co_fu;
  for(int i = 0;;i++){
    //cout << i << endl;
    if(i == 0){
      co_fu = couho;
    }else{
      co_fu -= 1;
    }
    end = 0;
    for(int j = 0;j<N;j++){
      if(p[j] == co_fu){
        end = 1;
      }
    }
    if(end == 0){
      co_fu = co_fu;
      break;
    }
  }
  for(int i = 0;;i++){
    //cout << i << endl;
    if(i == 0){
      co_sei = couho;
    }else{
      co_sei += 1;
    }
    end = 0;
    for(int j = 0;j<N;j++){
      if(p[j] == co_sei){
        end = 1;
      }
    }
    if(end == 0){
      co_sei = co_sei;
      break;
    }
  }
 //cout << co_fu << " " << co_sei<<endl; 
  int di_fu = std::abs(couho-co_fu);
  int di_sei = std::abs(couho-co_sei);
 //cout << di_fu << " " << di_sei << endl;
  if(di_fu > di_sei){
    cout << co_sei << endl;
  }else{
    cout << co_fu << endl;
  }
  
}

Measured memory_bytes: 3624
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <cstring>
#include <iomanip>

using namespace std;
static const double EPS = 1e-5;
typedef long long ll;
int main(){
    int N;
    cin >> N;
    vector< pair<int, pair<int,int> > > vec;
    for(int i = 0 ; i < N; i++){
        int x,y,h;
        cin >> x >> y >> h;
        vec.push_back(make_pair(h, make_pair(x,y)));
    }
    sort(vec.begin(), vec.end());
    reverse(vec.begin(), vec.end());
    for(int x = 0; x <= 100; x++){
        for(int y = 0 ; y <= 100; y++){
            int ma = INT_MAX;
            bool ok = true;
            if(vec[0].first!=0){
                ma = vec[0].first + abs(vec[0].second.first-x) + abs(vec[0].second.second-y);
            }
            else{
                ma = 1;
            }
            for(int i = 0; i < N; i++){
                if(vec[i].first != 0){
                    int h = vec[i].first + abs(vec[i].second.first-x) + abs(vec[i].second.second-y);
                    if(h!= ma){
                        ok = false;
                        break;
                    }
                }
                if(vec[i].first == 0){
                    if(ma-abs(vec[i].second.first-x)-abs(vec[i].second.second-y)>0){
                        ok = false;
                        break;
                    }
                }
            }
            if(ok){
                cout << x << " " << y << " " << ma << endl;
            }
        }
    }
    return 0;
}

Measured memory_bytes: 256
# coding: utf-8
# Your code here!
import sys
sys.setrecursionlimit(10**6)
readline = sys.stdin.readline #文字列入力のときは注意

n = int(input())

g = [[] for _ in range(n)]
for i in range(n-1):
    a,b = [int(i) for i in readline().split()]
    g[a-1].append(b-1)
    g[b-1].append(a-1)

"""
def dfs(v,p,path):
    for c in g[v]:
        if c == p: continue
        if c == n-1:
            path.append(n-1)
            path.append(v)
            return True
        if dfs(c,v,path):
            path.append(v)
            return True
    return False            

path = []
dfs(0,-1,path)
path.reverse()
"""


from collections import deque

def bfs(g,root,memo):
    q = deque()
    #memo = [-1]*n: あらかじめ初期化しておく
    """初期化、キューに入れて使用済みにする"""
    memo[root] = 0
    q.append(root)
    """BFS"""
    while q: #キューが空になるまで
        v = q.popleft() #キューから情報を取り出す
        for c in g[v]:
            if memo[c] != -1: continue #確認済みならスキップ
            # 確認済みにしてキューに入れる
            memo[c] = memo[v] + 1
            q.append(c)

memo0 = [-1]*n
memo1 = [-1]*n

bfs(g,0,memo0)
bfs(g,n-1,memo1)

ans = 0
for i,j in zip(memo0,memo1):
    if i <= j: ans += 1

#print(memo0)
#print(memo1)

if ans > n - ans: print("Fennec")
else: print("Snuke")









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

using namespace std;

int main(){
    int A[3][3];
    bool found[3][3] = {false};

    for(int i=0; i<3; i++){
        for(int j=0; j<3; j++){
            cin>>A[i][j];
        }
    }

    int n;
    cin>>n;

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



    for(int i=0; i<3; i++){
        for(int j=0; j<3; j++){
            for(int k=0; k<n; k++){
                if(A[i][j]==b[k]){
                    found[i][j] = true;
                }
            }
        }
    }



    string ans = "No";
    for(int i=0; i<3; i++){
        if(found[i][0] && found[i][1] && found[i][2]){
            ans = "Yes";
        }
    }
    for(int i=0; i<3; i++){
        if(found[0][i] && found[1][i] && found[2][i]){
            ans = "Yes";
        }
    }

    if(found[0][0] && found[1][1] && found[2][2]){
        ans = "Yes";
    }
    if(found[0][2] && found[1][1] && found[2][0]){
        ans = "Yes";
    }

    cout<<ans<<endl;
}

Measured memory_bytes: 256
import java.util.*;
class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.nextLine();
        int n = S.length();
        int[] s = new int[n];
        for(int i = 0; i < n; i++) s[i] = Integer.parseInt(""+S.charAt(i));
        int ans = 1000;
        for(int i = 0; i <= n-3; i++) {
            int num = s[i]*100 + s[i+1]*10 + s[i+2];
            ans = Math.min(ans, Math.abs(num-753));
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 21332