akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i,a,n) for (register int i=a;i<=n;i++)
#define per(i,a,n) for (register int i=n;i>=a;i--)
#define FOR(i,a,n,x) for (register int i=a;i<=n;i+=x)
#define ROF(i,a,n,x) for (register int i=n;i>=a;i-=x)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
#define pii pair<int, int>
#define pil pair<int, long long>
#define pll pair<long long, long long>
#define VI vector<int>
#define ll long long
#define ull unsigned long long
#define lowbit(x) ((x)&(-x))
#define mem(i, a) memset(i, a, sizeof(i))
#define sqr(x) ((x)*(x))
#define ls (p << 1)
#define rs (p << 1 | 1)
using namespace std;

template <typename T>

inline void read(T &X) {
  X = 0; char ch = 0; T op = 1;
  for(; ch > '9' || ch < '0'; ch = getchar())
    if(ch == '-') op = -1;
  for(; ch >= '0' && ch <= '9'; ch = getchar())
    X = (X << 3) + (X << 1) + ch - 48;
  X *= op;
}

const ll INF = 0x3f3f3f3f3f3f3f3f;
const int MAXN =  + 5;

ll n, k;
ll ans = INF;
map<ll, int> vis;

int main() {
#ifdef WiLe
  freopen ("input.txt", "rt", stdin);
#endif

  read(n), read(k);

  if (n > k) n %= k;

  while (vis.count(n) == 0) {
    vis[n] = 1;
    // cout << n << endl;
    ans = min(ans, n);
    n = abs(n - k);
  }

  cout << ans << endl;
  

#ifdef WiLe
  cerr << "\nTime elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
  return 0;
}
/*
# author : WiLe
# date : 2020/04/17
*/

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

int main(void) {
  using namespace std;

  int n;
  vector<int> v, c;

  cin >> n;
  for (int i = 0; i < n; i++) {
    int a;
    cin >> a;
    v.push_back(a);
  }
  for (int i = 0; i < n; i++) {
    int a;
    cin >> a;
    c.push_back(a);
  }

  int result = 0;
  for (int i = 0; i < n; i++) {
    int sub = v[i]-c[i];
    if (sub > 0) result += sub;
  }

  cout << result << endl;

  return 0;

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long n;
    cin>>n;
    vector <long long> vect(n,0);
    for(int i=0;i<n;i++)
    {
        cin>>vect[i];
    }
    sort(vect.begin(),vect.end());
    double sum=0;
    long long int j=2;
    sum=vect[0]+vect[1];
    for(int i=2;i<n;i++)
    {
        sum+=j*vect[i];
        j*=2;
    }
    double k=pow(2,n-1);
    cout<<setprecision(10)<<sum/k<<endl;
    return 0;
}


Measured memory_bytes: 256
n = int(input())
dp = [i for i in range(n+1)]

for i in range(n):
    dp[i+1] = min(dp[i+1],dp[i] + 1)
    cou = 1
    while True:
        if i + 6**cou <= n:
            dp[i+6**cou] = min(dp[i+6**cou],dp[i]+1)
            cou += 1
        elif i + 6**cou > n:
            break
    cou = 1
    while True:
        if i + 9**cou <= n:
            dp[i+9**cou] = min(dp[i+9**cou],dp[i]+1)
            cou += 1
        elif i + 9**cou > n:
            break
print(dp[n])

Measured memory_bytes: 7064
#include <bits/stdc++.h>
using namespace std;
#define INF 100000000
#define ll long long
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,m,n) for(int i=m;i<n;i++)
#define de cout << "debug" << endl;
 
int main() {
  int A, B, K;
  cin >> A >> B >> K;
  vector<int> T;
  if(A > B) swap(A,B);
  
  for(int i = 1; i < B+1; i++){
    if(A%i == 0 && B%i == 0){
      T.push_back(i);
    }
  }
  sort(T.begin(),T.end());
  reverse(T.begin(),T.end());
  cout << T[K-1] << endl;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main {

    static BufferedReader in;
    static PrintWriter out;
    static StringTokenizer tok;
    static int MOD = 1000000007;

    void solve() throws IOException {

    	int n = ni();
    	String s = ns();

    	int c = 0;
    	int ans = 0;

    	for(int i=0; i<n; i++){
    		if(s.charAt(i) == 'I'){
    			c++;
    			if(c > ans) ans = c;
    		}else{
    			c--;
    		}
    	}

    	out.println(ans);
    }

    String ns() throws IOException {
        while (!tok.hasMoreTokens()) {
            tok = new StringTokenizer(in.readLine(), " ");
        }
        return tok.nextToken();
    }

    int ni() throws IOException {
        return Integer.parseInt(ns());
    }

    long nl() throws IOException {
        return Long.parseLong(ns());
    }

    double nd() throws IOException {
        return Double.parseDouble(ns());
    }

    String[] nsa(int n) throws IOException {
        String[] res = new String[n];
        for (int i = 0; i < n; i++) {
            res[i] = ns();
        }
        return res;
    }

    int[] nia(int n) throws IOException {
        int[] res = new int[n];
        for (int i = 0; i < n; i++) {
            res[i] = ni();
        }
        return res;
    }

    long[] nla(int n) throws IOException {
        long[] res = new long[n];
        for (int i = 0; i < n; i++) {
            res[i] = nl();
        }
        return res;
    }

    int k(int n) throws IOException {
        if(n == 0) return 1;
        else return n * k(n-1);
    }

    long s(int a, int n) throws IOException {
        return (a+n) * (n-a+1) / 2;
    }

    public static void main(String[] args) throws IOException {
        in = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
        tok = new StringTokenizer("");
        Main main = new Main();
        main.solve();
        out.close();
    }
}

Measured memory_bytes: 8264
#include <bits/stdc++.h>
using namespace std;
int main() {
    int s, s1, s2, s3;
    cin >> s;
    s1 = s / 100;
    s2 = (s - 100 * s1) / 10;
    s3 = (s - 100 * s1) - s2 * 10;
    cout << s1 + s2 + s3 << endl;
}

Measured memory_bytes: 256
#define debug_interval ','
#define dump_interval ' '
#define debug_toggle 1

//{
#pragma GCC optimize ("O3","unroll-loops")
#pragma GCC target ("avx")
#include<bits/stdc++.h>
using namespace std;
#define hi cerr<<"hi"<<endl;
#define int long long
#define INT_MAX LLONG_MAX
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define fi first
#define se second
#define mp make_pair
#define rev reverse
#define dans dump(ans)
#define MOD 1000000007
#define amp(v,n) (v).count(n)?v[n]++:v[n]=1
#define sysp system("pause")
#define PI acos(-1)
#define ins insert
#define aer(v) (v).erase((v).begin(),(v).end()) 

//{
inline int toInt(string s){int v;istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x){ostringstream sout;sout<<x;return sout.str();}
template<class...A> inline void dump(){cout<<endl;}
template<class...A> inline void dump_rest() {cout<<endl;}
template<class T, class...A> inline void dump_rest(const T& first, const A&... rest){cout<<dump_interval<<first;dump_rest(rest...);}
template<class T,class...A> inline void dump(const T&first,const A&...rest){cout<<first;dump_rest(rest...);}
template<class...A> inline void debug(){cerr<<endl;}
template<class...A> inline void debug_rest() {cerr<<endl;}
template<class T, class...A> inline void debug_rest(const T& first, const A&... rest){cerr<<debug_interval<<first;debug_rest(rest...);}
template<class T,class...A> inline void debug(const T&first,const A&...rest){if(debug_toggle)cerr<<first,debug_rest(rest...);}
//}

typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}
template<int m>class mint{private:int i;public:mint() : i(0){}mint(int i): i((i%m+m)%m){}mint operator+(const mint& o){return o.i+i;}mint operator*(const mint& o){return o.i*i;}mint operator-(){return -i;}operator int() {return i;}};

//}

int n,k;

main(){
	cin>>n>>k;
	if((n+1)/2>=k)dump("YES");
	else dump("NO");
}


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

public class Main {

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

	Scanner sc = new Scanner(System.in);

	void run() {
		for(;;){
			String buf = sc.nextLine();
			if(".".equals(buf)){
				break;
			}
			System.out.println(solve(buf)?"yes":"no");
		}
	}
	
	
	boolean solve(String s){
		String left = "[(";
		String right = "])";
		
		Stack<Integer> open = new Stack<Integer>(); 
		for(char ch: s.toCharArray()){
			int l = left.indexOf(ch);
			int r = right.indexOf(ch);

			if(l >= 0) open.push(l);
			if(r >= 0 && open.isEmpty()) return false;
			if(r >= 0 && open.pop() != r) return false;
		}
		return open.isEmpty();
	}	
}



Measured memory_bytes: 43368
#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 <numeric>
#include <string.h>
#include <cassert>

#ifdef _DEBUG
#define typeof(X) std::identity<decltype(X)>::type //C++0x (for vs2010)
#else
#define typeof(X) __typeof__(X) // for gcc
#endif

#define sz(a)  int((a).size())
#define FOREACH(it, c) for (typeof((c).begin()) it=(c).begin(); it != (c).end(); ++it)
#define FOR(i,count) for (int i = 0; i < (count); i++)
#define V_CIN(v) do{for(int i = 0; i < sz(v); i++) cin >> (v)[i];}while(0)
#define all(c) (c).begin(),(c).end()

using namespace std;
static const double EPS = 1e-5;
typedef long long ll;
const int MODULO = 1000000007;

typedef pair<int,int> Pii;

int main()
{
	string line;
	while(getline(cin,line),line[0] != '.'){
		stack<char> s;
		bool f= false;
		for(int i =0 ;line[i] != '.'; i++){
			if(line[i] == '(' || line[i] == '['){
				s.push(line[i]);
			} else if(line[i] == ')' || line[i] == ']'){
				if(s.empty() ||
				(line[i] == ')' && s.top() != '(') ||
				(line[i] == ']' && s.top() != '[')){
					f = true; break;
				}
				s.pop();
			}
		}
		if(!s.empty()) f = true;
		cout << (f?"no":"yes") << endl;
	}

	return 0;
}

Measured memory_bytes: 904
while True:
    m,f,r = map(int,input().split())

    if m == f == r == -1:
        break
    
    if m == -1 or f == -1 or (m + f) < 30:
        print ("F")
    elif (m + f) >= 80:
        print ("A")
    elif (m + f) < 80 and (m + f) >= 65:
        print ("B")
    elif (m + f) < 65 and (m + f) >= 50:
        print ("C")
    elif (m + f) < 50 and (m + f) >= 30 and r >= 50:
        print ("C")
    else:
        print ("D")


Measured memory_bytes: 5592
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ARC081
{
    public class C
    {
        private void Run()
        {
            Console.ReadLine();
            var g = Console.ReadLine().Trim().Split().Select(long.Parse)
                .GroupBy(x => x)
                .Where(x => x.Count() > 1)
                .SelectMany(x => Enumerable.Repeat(x.Key, x.Count() / 2))
                .OrderByDescending(x => x)
                .ToArray();
            Console.WriteLine(g.Length < 1 ? 0 : g[0] * g[1]);
        }

        public static void Main()
        {
            var old = Console.Out;
            using (var writer = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false })
            {
                Console.SetOut(writer);
                new C().Run();
                Console.Out.Flush();
                Console.SetOut(old);
            }
        }
    }
}


Measured memory_bytes: 34824
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define int long long
using namespace std;
typedef pair<int, int> P;
const int mod = 1000000007;
const int INF = 1e18;

signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<int> x(n), y(n);
    rep(i, 0, n){
        cin >> x[i] >> y[i];
    }
    int ans = n;
    rep(i, 0, n){
        rep(j, 0, n){
            if(i == j) continue;
            int p = x[i] - x[j];
            int q = y[i] - y[j];
            int tmp = n;
            rep(k, 0, n){
                rep(l, 0, n){
                    if(k == l) continue;
                    if(x[l] == x[k] - p && y[l] == y[k] - q){
                        tmp--;
                    }
                }
            }
            ans = min(ans, tmp);
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
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);
        TaskA solver = new TaskA();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskA {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            String str = in.nextLine();

            if (str.contains("000")) {
                out.print("Yes");
                return;
            }
            for (int i = 111; i < 1000; i += 111) {
                if (str.contains(String.valueOf(i))) {
                    out.print("Yes");
                    return;
                }
            }

            out.print("No");
        }

    }
}



Measured memory_bytes: 21716
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define repr(i,x,n) for(int i=x; i<(n); i++)
#define ALL(x) (x).begin(),(x).end()
typedef long long ll;
#define INF 1e9
typedef vector<int> VI;
typedef vector<string> VS;
int main()
{
int x,ans=0;
cin>>x;
while (x>=500)
{
    x-=500;
ans+=1000;
}
while (x>=5)
{
   x-=5;
   ans+=5;
}

cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define INF 1e8;
typedef long long ll;
ll mod = 998244353;
long long fast_exp(long long a, long long b)
{
    if(b == 0)
	   return 1;
    else
    {
	   long long res = 1;
	   res = fast_exp(a,b/2);
	   res = (res*res)%mod;
	   if(b%2 == 1)
		  res = (res*a)%mod;
	   return res;
 
    }
}
const ll N = 1e6;




int main()
{
	//ios_base::sync_with_stdio(false);
	//cin.tie(NULL);
	int n,k;
	cin>>n>>k;
	string s;
	cin>>s;
	int sum = 0;
	char prev = '?';
	for(int i = 0; i<n ; i++)
	{
		if(prev != '?')
		{
			if(s[i]!=prev)
			{
				if(k==0)
					break;
				else
					while(i<n && s[i]!=prev)
						{
							s[i] = prev;
							i++;
						}
				i--;
				k--;
			}
		}
		prev = s[i];
	}
	int cur = 0;
	prev = s[0];
	for(int i = 1; i<n ; i++)
	{
		if(i<n && s[i] == s[i-1])
		{
			cur++;

		}
		else
		{
			sum += cur;
			cur = 0;
		}

		if(i == n-1)
			sum +=cur;
	}
	//cout<<s<<endl;
	cout<<sum<<endl;

	return 0;
	
}

Measured memory_bytes: 512
public class Main {
	public static void main(String[] args){
		java.util.Scanner scan = new java.util.Scanner(System.in);
			int n = scan.nextInt();
			int[] x = new int[n];
			int[] y = new int[n];


			for(int i = 0; i < n;i++){
				x[i] = scan.nextInt();
			}
			for(int i = 0;i < n;i++){
				y[i] = scan.nextInt();
			}

			double p1 = 0;
			double p2 = 0;
			double p3 = 0;
			double p4 = 0;
			for(int i = 0;i < n;i++){
				p1 += Math.abs(x[i] - y[i]);
				p2 += Math.pow(Math.abs(x[i]-y[i]),2);
				p3 += Math.pow(Math.abs(x[i]-y[i]),3);
				if(p4<Math.abs(x[i]-y[i])){
					p4 = Math.abs(x[i]-y[i]);
				}
			}

			System.out.println(p1);
			System.out.println(Math.sqrt(p2));
			System.out.println(Math.cbrt(p3));
			System.out.println(p4);


	}

}

Measured memory_bytes: 26516
def main():
    N = int(input())
    D,X = map(int, input().split())
    A = [int(input()) for _ in range(N)]

    ans = X
    for i in range(N):
        for j in range(1, D+1, A[i]):
            ans += 1

    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
#define _CRT_SECURE_NO_WARNINGS
#define MAX_DATA 200000
#define MIN_DATA 2

#include <stdio.h>
#include <stdlib.h>

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

	int NUM;
	scanf( "%d", &NUM );

	int *data;

	if ( NUM >= MIN_DATA && NUM <= MAX_DATA) {
		data = (int *)malloc(sizeof(int) * NUM);
	}
	else{
		return 1;
	}

	int max = -1000000000;
	int min = 0;
	int temp;

	scanf("%d", &min);

	for (int i = 1 ; i < NUM ; i++){
		scanf("%d", &temp);

		int sub = temp - min;

		if (sub > max) {
			max = sub;
		}

		if (temp < min){
			min = temp;
		}
	}



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

	return 0;
}

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

using namespace std;

#define fst(t) std::get<0>(t)
#define snd(t) std::get<1>(t)
#define thd(t) std::get<2>(t)

using P = std::tuple<int,int>;
using ll = long long;

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



int main(){
    //*
    std::cin.tie(nullptr);
    std::ios::sync_with_stdio(false);
    /*/
      /*/

    string S;
    std::cin >> S;

    int K;
    std::cin >> K;

    for(int i=0;i<S.size();++i){
        int cost = (26 - (S[i] - 'a')) % 26;
        if(cost <= K){
            S[i] = 'a';
            K -= cost;
        }
    }

    if(K > 0){
        S[S.size()-1] = (S[S.size()-1] - 'a' + K) % 26 + 'a';
    }

    std::cout << S << std::endl;
}


Measured memory_bytes: 592
def solve():
    x = int(input())
    n = x // 11
    
    if x == 6:
        return 1
    elif x == n * 11:
        return 2 * n
    elif n * 11 < x <= n * 11 + 6:
        return 2 * n + 1
    elif n * 11 + 6 < x <= (n + 1) * 11:
        return 2 * (n + 1)

print(solve())

Measured memory_bytes: 3060
h, w = map(int, input().split())
s = [list(input()) for _ in range(h)]

for i in range(h):
    for j in range(w):
        if s[i][j] == '#':
            continue
        cnt = 0
        for k in range(-1, 2):
            for l in range(-1, 2):
                if k == 0 and l == 0:
                    continue
                if 0 <= i + k < h and 0 <= j + l < w and s[i+k][j+l] == '#':
                    cnt += 1
        s[i][j] = cnt

for i in range(h):
    for j in range(w):
        print(s[i][j], end='')
    print()

Measured memory_bytes: 75280
#include<iostream>
#include<algorithm>
#include<string>
#include<set>
#define int long long
#define mod 1000000007
#define for0(i, n) for(int i = 0; i < (n); i++)
#define for1(i, n) for(int i = 1; i <= (n);i++)
using namespace std;
string s; int k; bool b;
signed main() {
	cin >> s >> k;
	for1(i, s.size() - 1)if (s[i] != s[0])b = 1;
	if (!b) { cout << k * s.size() / 2 << endl; }
	else {
		if (s[0] != s.back()) {
			int cnt = 1, ans = 0;
			for1(i, s.size() - 1) if (s[i] == s[i - 1])cnt++; else { ans += cnt / 2; cnt = 1; }ans += cnt / 2;
			cout << ans*k << endl;
		}
		else {
			char c = s[0];
			int cnt = 1, ans = 0, a = 0, b = 0;
			while (s[0] == c) { s = s.substr(1, s.size() - 1); a++; }
			while (s.back() == c) { s.pop_back(); b++; }
			for1(i, s.size() - 1) if (s[i] == s[i - 1])cnt++; else { ans += cnt / 2; cnt = 1; }ans += cnt / 2;
			cout << ans * k + a / 2 + b / 2 + (a + b) / 2 * (k - 1) << endl;
		}
	}
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<vector>
#include<queue>
#include<algorithm>
#include<cmath>
#include<climits>
#include<string>
#include<set>
#include<numeric>
#include<map>
#include<iostream>
using namespace std;
#define rep(i,n) for(int i = 0;i<((int)(n));i++)
#define reg(i,a,b) for(int i = ((int)(a));i<=((int)(b));i++)
#define irep(i,n) for(int i = ((int)(n)-1);i>=0;i--)
#define ireg(i,a,b) for(int i = ((int)(b));i>=((int)(a));i--)
typedef long long ll;
typedef pair<ll, ll> mp;
ll mod=1e9+7;
ll inf=1e18;


int main(void){
	ll n,a,b;
	cin>>n;
	if(n==1){
		cout<<"Hello World"<<endl;
	}else{
		cin>>a>>b;
		cout<<a+b<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env python3
import sys


def solve(K: int, N: int, A: "List[int]"):
    r = -1
    for i in (range(len(A))):
        if i == 0:
            tmp = A[i] + (K - A[len(A)-1])
        else:
            tmp = A[i] - A[i-1]
        r = max(tmp, r)
    print(K-r)


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    K = int(next(tokens))  # type: int
    N = int(next(tokens))  # type: int
    A = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(K, N, A)

if __name__ == '__main__':
    main()


Measured memory_bytes: 26228
def solve():
  ans = 0
  N = int(input())
  A = [float('inf')]+list(map(int, input().split()))+[-float('inf')]
  updown = ['']*(N+1)
  updown[0] = 'down'
  for i in range(1,N+1):
    if A[i]>A[i+1]:
      updown[i] = 'down'
    elif A[i]<A[i+1]:
      updown[i] = 'up'
    else:
      updown[i] = updown[i-1]
  stock = 0
  money = 1000
  if 'up' not in updown:
    ind = -1
  else:
    ind = N-updown[::-1].index('up')
  for i in range(N):
    if updown[i]=='up' and updown[i+1]=='down':
      money += A[i+1]*stock
      stock = 0
      if i==ind:
        break
    elif updown[i]=='down' and updown[i+1]=='up':
      stock += money//A[i+1]
      money %= A[i+1]
  return money
print(solve())

Measured memory_bytes: 9252
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll dp[2005];
ll mod=1e9+7;
ll n;
ll fun(int pos)
{
    if(pos<0)
    {
        return 0;
    }
    if(pos==0)
    {
        return 1LL;
    }
    if(dp[pos]!=-1)
        return dp[pos];
    ll res=0;
    for(int i=3;i<=pos;i++)
    {
        res += fun(pos-i);
        if(res>=mod) res %=mod;
    }
    return dp[pos]=res;
}
int main()
{
    memset(dp,-1,sizeof dp);
    cin>>n;
    cout<<fun(n)<<endl;
    return 0;
}


Measured memory_bytes: 3660
#include <bits/stdc++.h>
#define pt(sth) cout << sth << "\n"
#define chmax(a, b) {if(a<b) a=b;}
#define chmin(a, b) {if(a>b) a=b;}
#define moC(a, s, b) (a)=((a)s(b)+MOD)%MOD
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
static const ll INF=1e18;
static const ll MAX=101010;
static const ll MOD=1e9+7;

/*
 for(i=0; i<N; i++)
   cin >> a[i];
*/



ll a[1111][1111];

int main(void) {
  ll i, j, k;
  ll N;
  cin >> N;
  
  for(i=0; i<N; i++) {
    for(j=0; j<N-1; j++) {
      cin >> a[i][j];
      a[i][j]--;
    }
  }
  
  ll pos[1111]={};
  queue<ll> q;
  for(i=0; i<N; i++) q.push(i);
  
  for(ll d=0; d<=N*(N-1)/2; d++) {
    ll used[1111]={};
    ll upd=0;
    
    queue<ll> tq;
    
    while(q.size()) {
      ll u=q.front(); q.pop();
      if(used[u]) continue;
      if(pos[u]==N-1) continue;
      
      ll e=a[u][pos[u]];
      if(used[e]) continue;
      
      if(a[e][pos[e]]==u) {
        used[u]=1; used[e]=1;
        pos[u]++; pos[e]++;
        upd=1;
        tq.push(u); tq.push(e);
      }
    }
    
    queue<ll> ttq;
    while(tq.size()) {
      q.push(tq.front());
      ttq.push(tq.front());
      tq.pop();
    }
    
    
    if(!upd) {
      pt(-1);
      return 0;
    }else {
      ll f=1;
      while(ttq.size()) {
        if(pos[ttq.front()]<N-1) f=0;
        ttq.pop();
      }
      
      if(f) {
        pt(d+1);
        return 0;
      }
    }
    
    
  }
  
  
}



Measured memory_bytes: 8960
#include <bits/stdc++.h>
#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define rep(i,n) for (int i = (0); i < (n); ++i)
#define rng(x) (x).begin(),(x).end()
#define rrng(x) (x).rbegin(),(x).rend()
#define debug(x) cout << #x << " = " << (x) << endl;
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define uni(x) x.erase(unique(rng(x)),x.end())
#define SP << " " <<
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using pii = pair<int, int>;
using tiii = tuple<int, int, int>;
const int mod = 1000000007;
const double EPS = 1e-9;
const int INF = 1<<30;
const ll INFLL = 1LL<<60;
//cout << fixed << setprecision(10);

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 () {
  int m1, d1;
  cin >> m1 >> d1;
  int m2, d2;
  cin >> m2 >> d2;
  if (d2 == 1) cout << 1 << endl;
  else cout << 0 << endl;
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<math.h>
#include<iomanip>
#include<vector>
#include<algorithm>
#include<queue>
#include<string>
#include<stdlib.h>
using namespace std;
#define PI 3.14159265358979
typedef unsigned long long ll;
#define rep(i,n) for(int i=0;i<n;i++)

//---------------------------------------------

ll n;
int main(void)
{

int k;
int x;

cin>>k>>x;

if(500*k>=x) cout<<"Yes"<<endl;
else cout<<"No"<<endl;

}

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

int main()
{
  int n, k;
  cin >> n >> k;
  int sum = 0, tmp = 300, x;
  int a[n];
  rep(i, n){
    a[i] = k + i;
    sum += a[i];
  }
  rep(i, n){
    if(abs(a[i]) < tmp){
      tmp = abs(a[i]);
      x = i;
    }
  }
  cout << sum - a[x] << endl;
  return 0;
}

Measured memory_bytes: 3600
import math

N, H = map(int, input().split())
a, b = [], []
for i in range(N):
    ai, bi = map(int, input().split())
    a.append(ai)
    b.append(bi)

a_max = sorted(a)[-1]
b_des = sorted(b, reverse=True)

res = 0
sum_b = 0
for bi in b_des:
    if bi <= a_max:
        break
    else:
        H -= bi
        res += 1
    if H <= 0:
        break

if H > 0:
    res += int(math.ceil(H / a_max))

print(res)

Measured memory_bytes: 88308
x1,y1,x2,y2 = map(int,input().split())
x3,y3,x4,y4  =0,0,0,0
x3 = x2+(y1-y2)
y3 = y2-(x1-x2)
x4 = x3 + (x1-x2)
y4 = y3 + (y1-y2)
print(x3,y3,x4,y4)


Measured memory_bytes: 2940
dt=[1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
in_1=int(input())
print(dt[in_1-1])

Measured memory_bytes: 2940
use std::io;

fn main() {
    let mut buf = String::new();
    io::stdin().read_line(&mut buf).unwrap();
    let _: usize = buf.trim().parse().unwrap();
    let mut buf = String::new();
    io::stdin().read_line(&mut buf).unwrap();
    let mut s = buf.trim().chars().collect::<Vec<_>>();

    let mut east_cost = vec![0];
    let mut west_cost = vec![0];

    let mut cost = 0;
    for &c in &s {
        if c == 'W' {
            cost += 1;
        }
        east_cost.push(cost);
    }
    cost = 0;
    s.reverse();
    for &c in &s {
        if c == 'E' {
            cost += 1;
        }
        west_cost.push(cost);
    }
    east_cost.pop();
    west_cost.pop();
    west_cost.reverse();
    println!("{}", east_cost.iter().zip(west_cost.iter()).map(|(a, b)| a + b)
             .min().unwrap());
}


Measured memory_bytes: 12540
#include <iostream>
#include <iomanip>
#include <fstream>
#include <string>
#include <vector>
#include <array>
#include <map>
#include <set>
#include <stack>
#include <cstdint>
#include <cmath>
#include <algorithm>
#include <utility>
#include <numeric>
#include <functional>
#include <cassert>

using namespace std;
using ll = int64_t;
using ull = uint64_t;

constexpr ll INF = 1000000000;/* 1e+9a */

void solve(istream &cin) {
    ll N;
    if (!(cin >> N)) { return; }
    vector<ll> L;
    ll sum = 0;
    for (int i =0; i < N; ++i) {
        ll tmp;
        cin >> tmp;
        L.push_back(tmp);
        sum += tmp;
    } // end i
    for (int i = 0; i < N; ++i) {
        if(2 * L[i] < sum) continue;
        cout << "No\n";
        return;
    } // end i
    cout << "Yes" << endl;

}

int main(int argc, char *argv[]) {
    cout << setprecision(16) << scientific;
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    while (cin) { solve(cin); }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define mod 1000000007
using namespace std;
int n,m,a[100005],dp[100005];
main(){
cin>>n>>m;
for(int k=1;k<=m;k++){
    int p;
    cin>>p;
    a[p]=1;
}
if(a[1]==0)
    dp[1]=1;
if(a[2]==0){
    dp[2]=1+dp[1];
}
for(int k=3;k<=n;k++){
        if(a[k]==1)
        continue;
    if(a[k-1]==0){
        dp[k]+=(dp[k-1]%mod);
        dp[k]+=mod;
        dp[k]%=mod;
    }
    if(a[k-2]==0){
         dp[k]+=(dp[k-2]%mod);
        dp[k]+=mod;
        dp[k]%=mod;
    }
}
cout<<dp[n]%mod;
return 0;
}


Measured memory_bytes: 1792
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "math.h"
#include "utility"
#include "string"
#include "map"
#include "unordered_map"
#include "iomanip"
#include "random"

using namespace std;
const long long int MOD = 1000000007;

long long int N, T;
long long int num[200000];
long long int ans;

int main() {
	ios::sync_with_stdio(false);
	cin >> N >> T;
	for (int i = 0; i < N; i++)cin >> num[i];
	for (int i = 1; i < N; i++) ans += min(T, num[i] - num[i - 1]);
	ans += T;
	cout << ans << endl;
}

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

using namespace std;

vector<int>tree[100005];
long long int dp[100005][2];
int MOD = 1e9+7;


void dfs(int v, int pv){

    dp[v][0] = 1;
    dp[v][1] = 1;

    for(auto u : tree[v]){

        if(u != pv){
            dfs(u, v);
            dp[v][0] = (dp[v][0] * (dp[u][0] + dp[u][1]) % MOD) % MOD;
            dp[v][1] = (dp[v][1] * dp[u][0]) % MOD;
        }
    }
}

int main(){

    int N, a, b;
    cin >> N;

    for(int i = 0; i < N-1; i++){

        cin >> a >> b;
        tree[a].push_back(b);
        tree[b].push_back(a);

    }

    dfs(1, 0);

    cout << (dp[1][0] + dp[1][1]) % MOD ;

    return 0;
}


Measured memory_bytes: 12800
#include<bits/stdc++.h>
using namespace std;
#define ll long long
typedef pair<ll,ll> P;
#define M 1000000007
int main(){
  ll n,d;
  cin>>n;
  d=n;
  vector<ll> b(n),a;
  for(int i=0;i<n;i++){
    cin>>b[i];
  }
  while(n!=0){
    bool f=true;
    for(int i=n;i>0;i--){
      if(i==b[i-1]){
        a.push_back(i);
        b.erase(b.begin()+i-1);
        f=false;
        break;
      }
    }
    if(f){
      cout<<-1;
      return 0;
    }
    n--;
  }
  for(int i=d-1;i>=0;i--) cout<<a[i]<<endl;
}

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

int main() {
	ll a, b, c, d; cin >> a >> b >> c >> d;
	ll res = LONG_MIN;
	res = max(res, a * c);
	res = max(res, a * d);
	res = max(res, b * c);
	res = max(res, b * d);
	cout << res << '\n';
    return 0;
}


Measured memory_bytes: 3616
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Scanner;

public class Main {
	
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        
        
        int N = sc.nextInt();
        int M = sc.nextInt();
        
        Map<Integer, Node> map = new HashMap<>();
        
        for (int i = 1; i <= N; i++) {
        	Node node = new Node(i);
        	map.put(i, node);
        }
        
        for (int i = 0; i < M; i++) {
        	int from = sc.nextInt();
        	int to = sc.nextInt();
        	
    		Node node = map.get(from);
    		node.list.add(to);
    		
    		node = map.get(to);
    		node.list.add(from);
        }
        
        Node start = map.get(1);
        
        System.out.println(dfs(map, start, new int[N]));
    }
    
    static int dfs(Map<Integer, Node> map, Node node, int[] history) {
    	if (history[node.number - 1] == 1) {
    		return 0;
    	} else {
    		history[node.number - 1] = 1;
    	}
    	
    	if (Arrays.stream(history).sum() == history.length) {
    		return 1;
    	}
    	
    	
    	int ans = 0;
    	for (Integer to : node.list) {
    		
    		int[] tmpHistory = new int[history.length];
        	for (int i = 0; i < history.length; i++) {
        		tmpHistory[i] = history[i];
        	}
    		
    		ans += dfs(map, map.get(to), tmpHistory);
    	}
    	
    	return ans;
    }
    
    static class Node {
    	List<Integer> list;
    	int number;
    	
    	public Node(int number) {
    		this.number = number;
    		list = new ArrayList<>();
    	}
    }
        
}	

Measured memory_bytes: 31760
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int N = sc.nextInt();

		// スペース区切りの整数の入力
		List<Long> list = new ArrayList<Long>();
		for (int i = 0; i < N * 3; i++) {
			long a = sc.nextInt();
			list.add(a);
		}

		Collections.sort(list);

		long ans = 0;
		for (int i = 0; i < N; i++) {
			ans += list.get(3 * N - 2 - i * 2);
		}
		// 出力
		System.out.println(ans);
		// System.out.println("Hello");
	}
}

Measured memory_bytes: 101492
#include<bits/stdc++.h>
using namespace std;
static const int N=100;
int main(){
    int n,p[N+1],m[N+1][N+1];
    cin>>n;
    for(int i=1;i<=n;i++){
        cin>>p[i-1]>>p[i];
    }
    for(int i=1;i<=n;i++)m[i][i]=0;
    for(int l=2;l<=n;l++){
        for(int i=1;i<=n-l+1;i++){
            int j=i+l-1;
            m[i][j]=(1<<21);
            for(int k=i;k<=j-1;k++){
                m[i][j]=min(m[i][j],m[i][k]+m[k+1][j]+p[i-1]*p[k]*p[j]);
            }
        }
    }
    cout<<m[1][n]<<endl;
    return 0;
}


Measured memory_bytes: 3148
#include <iostream>

   using namespace std;
     
    int main()
      
  {
 	int a,b;
 	cin>>a>>b;
 	if(a<=9 && b<=9)
 	{
 		cout<<a*b<<endl;
	 }
	 else
	 {
	 	cout<<-1<<endl;
	 }
 }

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int A, B, C, D;

		A = sc.nextInt();
		B = sc.nextInt();
		C = sc.nextInt();
		D = sc.nextInt();

		int l,m;
		if(C%B==0) l=C/B;
		else l=C/B+1;
		
		if(A%D==0) m=A/D;
		else m=A/D+1;
		if (l<=m)
			System.out.println("Yes");
		else
			System.out.println("No");

	}
}


Measured memory_bytes: 35668
n,m,c = map(int,input().split(" "))
b = list(map(int,input().split(" ")))

count = 0

for i in range(n):
	a = list(map(int,input().split(" ")))
	s = 0
	for i in range(m):
		s += a[i]*b[i]
	if(s+c>0):
		count += 1



print(count)

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
using P = pair<ll, ll>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep1(i, n) for(ll i=1;i<=(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
#define ALL(obj) (obj).begin(), (obj).end()
#define MOD 1000000007
#define INF 1000000000

// 最大公約数
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}

// 最小公倍数
ll lcm(ll a, ll b) {
	return a * b / gcd(a, b);
}

void solve_abc148_c() {
	ll A, B;

	cin >> A >> B;

	ll ans = 0;

	ans = lcm(A, B);
	
	cout << ans << "\n";
}

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

	solve_abc148_c();

	return 0;
}

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

using namespace std;
using Int = long long;
Int INF = 1LL << 60;
const Int MOD = 1000000007;

struct city {
	Int pref;
	Int year;
	Int num;
	Int id;

};


int main() {

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

	Int N, M;
	cin >> N >> M;

	vector<city> cities(M);
	for (Int i = 0; i < M; i++) {
		cin >> cities[i].pref >> cities[i].year;
		cities[i].id = i;
	}

	
	sort(cities.begin(), cities.end(), [](const city& x, const city& y) {return x.year < y.year; });

	vector<Int> Pre(100001);
	for (Int i = 0; i < M; i++) {
		Pre[cities[i].pref]++;
		cities[i].num = Pre[cities[i].pref];
	}

	
	sort(cities.begin(), cities.end(), [](const city& x, const city& y) {return x.id < y.id; });

	for (Int i = 0; i < M; i++) {
		printf("%06lld", cities[i].pref);
		printf("%06lld\n", cities[i].num);
	}
}

Measured memory_bytes: 5504
#include <bits/stdc++.h>
//#include <ext/numeric>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
#define oo 0x3f3f3f3f
#define OO 0x3f3f3f3f3f3f3f3f
#define popcount(n) __builtin_popcount(n)
#define popcountll(n) __builtin_popcountll(n)

using namespace std;
//using namespace __gnu_cxx;
using namespace __gnu_pbds;
template<typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

typedef pair<int, int> ii;
typedef pair<long long, pair<int, int>> iii;
typedef pair<ii, ii> iiii;

const double PI = acos(-1.0), EPS = 1e-6;
const int N = 200005, M = 100005, mod = 998244353 , mxLog = 20;

int main() {
#ifndef ONLINE_JUDGE
//    freopen("input.txt", "rt", stdin);
//    freopen("output.txt", "w", stdout);
#endif
    ios::sync_with_stdio(false), cin.tie(0), cout.tie(0), cout.precision(6), cout << fixed;

    int n;
    cin >> n;
    vector<int> v(n);
    for (int i = 0; i < n; ++i) {
        cin >> v[i];
    }
    sort(v.begin(), v.end());

    for (int i = 1; i < n - 1; ++i) {
        v[i] += v[i - 1];
    }

    if (v[n - 2] > v[n - 1]) {
        cout << "Yes\n";
    } else {
        cout << "No\n";
    }


    return 0;
}

Measured memory_bytes: 256
from sys import exit
n, K = map(int, input().split())
A = list(map(lambda x: int(x) - 1, input().split()))
done = [-1 for _ in range(n)]
tmp = 0
done[0] = 0
for k in range(1, K + 1):
    tmp = A[tmp]
    if done[tmp] >= 0:
        for i in range((K - done[tmp]) % (k - done[tmp])):
            tmp = A[tmp]
        print(tmp + 1)
        exit()
    else:
        done[tmp] = k
print(tmp + 1)


Measured memory_bytes: 32376
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define endl '\n'

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	string s;cin>>s;
	sort(s.begin(), s.end());
	if(s[0]==s[1] && s[2]==s[3] && s[1]!=s[2]){
		cout<<"Yes\n";
	} else{
		cout<<"No\n";
	}
	return 0;
}



Measured memory_bytes: 256
import heapq
N, K, Q = [int(_) for _ in input().split()]
A = [int(_) for _ in input().split()]
sA = sorted(A)
A += [-1]
ans = float('inf')
for amin in sA:
    cand = []
    dp = []
    for i in range(N + 1):
        a = A[i]
        if a >= amin:
            heapq.heappush(dp, a)
        if len(dp) and a < amin:
            m = len(dp) - K + 1
            for _ in range(m):
                heapq.heappush(cand, heapq.heappop(dp))
            dp = []
    y = float('inf')
    if len(cand) < Q:
        break
    for _ in range(Q - 1):
        heapq.heappop(cand)
    ans = min(ans, heapq.heappop(cand) - amin)
print(ans)


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

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

int main() {
	int n, a[100050], b[100050];
	ll ans = 0;
	cin >> n;
	rep(i, n+1) cin >> a[i];
	rep(i, n) cin >> b[i];
	for(int i = 0; i < n; i++){
		//左を全力で倒す
		int left = min(a[i], b[i]);
		ans += left;
		a[i] -= left;
		b[i] -= left;
		//残った戦力で右を全力で倒す
		int right = min(a[i+1], b[i]);
		ans += right;
		a[i+1] -= right;
		b[i] -= right;
	}
	cout << ans << endl;
}

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

int main(void)
{
    int H, W, K;
    char c[10][10];
    cin >> H >> W >> K;
    for (int i=0; i<H; i++){
        for(int j=0; j<W; j++) cin >> c[i][j];
    }
    vector<int> v(H,0);
    vector<int> v2(W,0);

    int ans=0;

    for(int i=0; i <= H; i++){
        for(int j =0; j < i; j++)v[j] = 1;

        do{
        for(int q=0; q <= W; q++){
            vector<int> v2(W,0);
            for(int j =0; j < q; j++)v2[j] = 1;
            do{
                int count=0;
                for (int l=0; l<H; l++){
                    for(int m=0; m<W; m++){
                        if(v[l] + v2[m] == 0 && c[l][m] == '#') count++;
                    }
                }
                if(count == K) ans++;

            }while(prev_permutation(v2.begin(), v2.end()));
        }
        }while(prev_permutation(v.begin(), v.end()));

    }

    cout << ans << endl;
}


Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
const double pi=acos(-1.0);
int n,x[105],y[105];
double ang[105];
int main()
{
 	scanf("%d",&n);
	for(int i=1;i<=n;i++)scanf("%d%d",&x[i],&y[i]);
	for(int i=1;i<=n;i++)
	{
		int c=0;
		for(int j=1;j<=n;j++)if(i^j)ang[c++]=atan2(y[j]-y[i],x[j]-x[i]);
		sort(ang,ang+c);
		double mx=0;
		ang[c]=ang[0]+2*pi;
		for(int j=0;j<c;j++)mx=max(mx,ang[j+1]-ang[j]);
		mx-=pi;
		if(mx<0)mx=0;
		printf("%.10lf\n",mx/(2*pi));
	}
 	return 0;
}

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

using namespace std;

#define int long long

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

bool check(vector<int> a){
    int g = 0;
    int su = 0;
    for(auto u: a){
        g = gcd(g, u);
        su += u;
    }
    if(g != 1) return false;
    for(auto u: a){
        if(gcd(u, su - u) == 1){
          return false;
        }
    }
    return true;
}

main()
{
    ios_base::sync_with_stdio(false);
    int n;
    cin >> n;
    //for(int i = 15000; i <= 30000; i++){
    //n/ = i;
    int init = n;
    if(n == 3){
        cout << "2 5 63" << endl;
        exit(0);
    }
    vector<int> an;
        an.push_back(3);
        an.push_back(9);
        int lo = 2;
        for(int i = 2; i + 3 <= n && lo < 30000; i += 3){
            an.push_back(lo);
            an.push_back(lo + 2);
            an.push_back(lo + 4);
            lo += 6;
        }
        if(n > 15002){
            if(n % 2 == 1 && an.size() % 3 == 2){
                an.pop_back();
            }
            if(n % 2 == 0 && n != 20000){
                an.pop_back();
                an.pop_back();
                an.pop_back();
                an.push_back(30000);
            }
            n -= an.size();
            for(int j = 15; n; j += 6){
                an.push_back(j);
                n--;
            }
        }
        else{
            if((n - an.size()) % 3 == 1) an.push_back(lo + 4);
            else if((n - an.size()) % 3 == 2){
                an.push_back(lo);
                an.push_back(lo + 2);
            }
        }
    assert(check(an) && an.size() == init);
    for(auto u: an) cout << u << ' '; cout << endl;
    //cout << i << endl;
    //}
}


Measured memory_bytes: 764
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
char s[101][101];
int n,m,a[100][100],c;
using namespace std;
int dfs(int y,int x){
  if(a[y][x]++)return 0;
  if(s[y][x]=='.'){cout<<x<<' '<<y<<endl;c++;}
  else if(s[y][x]=='^')dfs(y-1,x);
  else if(s[y][x]=='v')dfs(y+1,x);
  else if(s[y][x]=='>')dfs(y,x+1);
  else if(s[y][x]=='<')dfs(y,x-1);
  if(c)return 1;
  return 0;
}
int main(){
  while(cin>>n>>m,n){c=0;
    rep(i,100)rep(j,100)a[i][j]=0;
    rep(i,n)rep(j,m)cin>>s[i][j];
    if(!dfs(0,0))cout<<"LOOP"<<endl;
  }
}

Measured memory_bytes: 3076
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

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

// 自動でmodを取ってくれる整数型
// auto mod int
// https://youtu.be/L8grWxBlIZ4?t=9858
// https://youtu.be/ERZuLAxZffQ?t=4807 : optimize
// https://youtu.be/8uowVvQ_-Mo?t=1329 : division
const int mod = 1000000007;
// const int mod = 998244353;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const { // ans=mint(a).pow(b); // a^b
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

mint f(int n){ // 2のn乗
    if(n==0) return 1;
    mint x=f(n/2);
    x*=x;
    if(n%2==1) x*=2;
    return x;
}

// a^n mod を計算する
long long modpow(long long a, long long n) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

//////////////////////////
int main(){
    int n;
    cin>>n;
    vector<ll> a(n);
    mint sum=0;
    rep(i,n){ 
        cin>>a[i];
        sum+=a[i];
    }
    mint ans=0;
    rep(i,n-1){
        sum-=a[i];
        ans+=(mint)a[i]*sum;
    }
    cout<<ans<<endl;
}


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

typedef long long ll;
#define FOR(i, m, n) for (ll i = m; i < n; i++)

int main() {
    ll n;
    cin >> n;
    FOR(x,1,3500){
        FOR(y,x,3500){
            ll p = n*x*y, q = 4*x*y - n*(x+y);
            if(q>0 && p>q && p%q==0){
                cout << x << " " << y << " " << p/q << endl;
                return 0;
            }
        }
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <map>
#include <set>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <fstream>
#include <bitset>
#include <queue>
#include <stack>
#include <deque>
#include <complex>
#include <iomanip>
#include <stdio.h>
#include <string.h>
#include <random>
#include <functional>

using std::cin;
using std::cout;
using std::cerr;
using std::endl;

using std::map;
using std::set;
using std::bitset;
using std::vector;
using std::string;
using std::multimap;
using std::multiset;
using std::deque;
using std::queue;
using std::stack;
using std::pair;
using std::iterator;

using std::sort;
using std::stable_sort;
using std::reverse;
using std::max_element;
using std::min_element;
using std::unique;
using std::ios_base;
using std::swap;
using std::fill;

using std::setprecision;
using std::fixed;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<long long> vl;
typedef string S;

ll min(ll a, ll b) {return a < b ? a : b;}
ll min(int a, ll b) {return a < b ? a : b;}
ll min(ll a, int b) {return a < b ? a : b;}
ll min(int a, int b) {return a < b ? a : b;}

ll max(ll a, ll b) {return a > b ? a : b;}
ll max(int a, ll b) {return a > b ? a : b;}
ll max(ll a, int b) {return a > b ? a : b;}
ll max(int a, int b) {return a > b ? a : b;}

namespace MySpace{

};

#define F(i, n) for (int (i) = 0; (i) != (n); (i)++)
#define fi first
#define se second
#define re return
#define all(x) (x).begin(), (x).end()

const int MOD = 1e9 + 7;

long long inq(long long a, long long b)
{
    if (b == 0) return 1;
    long long l = inq(a, b / 2);
    if (b % 2) return l * l % MOD * a % MOD;
    return l * l % MOD;
}

int n;
int a[500000];
long long ans = 0;

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin >> n;
    for (int i = 0; i < n; i++) cin >> a[i];
    int d = 0;
    for (int i = n - 1; i >= 0; i--)
    {
        if (a[i] > i) cout << -1, exit(0);
        if (a[i] + 1 == a[i + 1]) continue;
        else if (a[i] + 1 < a[i + 1]) cout << -1, exit(0);
        else ans += a[i];
    }
    cout << ans;
}


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

int main(){
  int n;
  cin>>n;
  vector<int> a(n);
  int res=0;
  rep(i,n){
    cin>>a[i];
    res=res^a[i];
  }
  rep(i,n){
    int ans=res^a[i];
    cout<<ans<<endl;
  }
}

Measured memory_bytes: 3876