akhauriyash/Code-Regression huggingface dataset:
// https://atcoder.jp/contests/abc175/tasks/abc175_c
#include <iostream>
#include <vector>
#include <deque>
#include <tuple>
#include <algorithm>
#include <iterator> // std::back_inserter

using namespace std;

int main()
{
    long long x;
    cin >> x;
    if (x >= 30) {
      cout << "Yes" << endl;
    }
    else {
      cout << "No" << endl;
    }
}


Measured memory_bytes: 3596
#include <bits/stdc++.h>
using namespace std;
int main(){
	int X; cin >> X; 	
	if(X < 600) cout << 8 << "\n"; 
	else if(X < 800) cout << 7 << "\n"; 
	else if(X < 1000) cout << 6 << "\n"; 
	else if(X < 1200) cout << 5 << "\n"; 
	else if(X < 1400) cout << 4 << "\n"; 
	else if(X < 1600) cout << 3 << "\n"; 
	else if(X < 1800) cout << 2 << "\n"; 
	else if(X < 2000) cout << 1 << "\n"; 
}

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

using ll = long long;
using ull = unsigned long long;

#define MOD 1000000007

int main(void) {
    ll N, K;
    ll mini = LONG_MAX;
    vector<ll> h;
    cin >> N >> K;
    h.resize(N);
    for(ll i = 0;i < N;i++) cin >> h[i];
    sort(h.begin(), h.end());
    for(ll i = 0;i < N - K + 1;i++) {
        mini = min(h[K + i - 1] - h[i], mini);
    }
    cout << mini << endl;
    return 0;
}


Measured memory_bytes: 1024
import java.util.Scanner;
public class Main{
	public static void main(String[] args){
    	Scanner scan = new Scanner(System.in);
      	Integer a = scan.nextInt();
      	String s = a.toString();
      	int count = 0;
      	for(int i=0; i<s.length(); i++){
        	if(s.charAt(i) == '1'){
            	count++;
            }
        }
      	System.out.println(count);
    }
}

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

int main() {
	int n;
	cin >> n;
	string s = to_string(n);
	bool f = false;
	for (int i = 0; i < s.size(); ++i) {
		int a = stoi(s.substr(i, 1));
		if (a == 7)
			f = true;
	}
	if (f) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
	return 0;
}


Measured memory_bytes: 3156
using System;
using System.Linq;
using System.Collections.Generic;
using System.IO;

namespace atcorder2
{
    class Program
    {
        public static long Read()
        {
            return long.Parse(Console.ReadLine());
        }

        public static long[] Reads()
        {

            return Console.ReadLine().Split().Select(long.Parse).ToArray();
        }

        public static long d(long sx,long sy,long gx,long gy)
        {
            return Math.Abs(gx - sx) + Math.Abs(gy - sy);
        }
      



        static void Main(string[] args)
        {
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);

            var xy = Reads();
            var x = xy[0];
            var y = xy[1];
            long ans = 1;
            while (x*2 <= y)
            {
                x *= 2;
                ans++;
            }
            Console.WriteLine(ans);

            Console.Out.Flush();
        }
    }
}




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

int main() {
    int a;
    int v;
    int b;
    int w;
    int t;
    
    cin >> a >> v >> b >> w >> t;
    
    int d = abs(a - b);
    int vv = v - w;
    
    bool ans = false;
    if (vv <= 0) {
        ans = false;
    }
    else if (d / (double)vv <= t) {
        ans = true;
    }
    
    if (ans) {
       cout << "YES" << endl; 
    }
    else {
       cout << "NO" << endl; 
    }
    
    return 0;
}


Measured memory_bytes: 3628
import java.util.*;

public class Main {
	private static final String TEST = "7 1 2 3 4 5 6 7";
	Scanner sc;
	
	int N;
	int[] p;
	
/*-------------
 * constructor
 */
	public Main() {
		sc = new Scanner(System.in);
	}
	public Main(String input) {
		sc = new Scanner(input);
	}
	
/*------------------
 * instance methods
 */
	void out(Object o) {
		System.out.println(o);
		System.out.flush();
	}
	
	public void exec() throws Exception {
		N = sc.nextInt();
		p = new int[N];
		for (int i = 0; i < N; i++) {
			p[i] = sc.nextInt();
		}
		
		int[] descendIndex = new int[3];
		int descendCnt = 0;
		
		for (int i = 0; i < N-1; i++) {
			if (p[i] > p[i+1]) { // 逆順
				descendIndex[descendCnt++] = i;
				if (descendCnt > 2) break;
			}
		}
//		for (int i = 0; i < N; i++) {
//			System.out.print(p[i]+" ");
//		}
//		System.out.println();
//		System.out.println("cnt : "+descendCnt);
//		for (int i = 0; i < descendCnt; i++) {
//			System.out.println(i + ":" + descendIndex[i]);
//		}
		
		int i, j;
		switch (descendCnt) {
		
		case 0:
			out("YES");
			break;
		
		case 1:	// この位置 p[i] と p[i+1] を変えてできればYES
			i = descendIndex[0];
			// p[i-1] ● p[i+1] p[i] ● p[i+2] が昇順ならYES
			if (i != 0) { // 左端でない→左があるので比較する
				if (p[i-1] > p[i+1]) {
					out("NO"); // ダメ
					return;
				}
			}
			if (i < N-2) { // 右端でない→右があるのでそれと比較
				if (p[i] > p[i+2]) {
					out("NO");
					return;
				}
			}
			out("YES");
			return;
		
		case 2: // 離れて２か所ある部分を入れ替えてできればYES
			i = descendIndex[0];
			j = descendIndex[1]; // i < j
			// i と j+1 が入れ替え対象
			// p[i-1] p[j+1] p[i+1] .... p[j] p[i] p[j+2]
			// が昇順であれば YES となる必要十分
			if (i != 0) {
				if (p[i-1] > p[j+1]) {
					out("NO");
					return;
				}
			}
			if (p[j+1] > p[i+1]) {
				out("NO");
				return;
			}
			if (j+1 < N-1) {
				if (p[i] > p[j+2]) {
					out("NO");
					return;
				}
			}
			if (p[j] > p[i]) {
				out("NO");
				return;
			}
			out("YES");
			return;
		
		default:	// 3箇所以上はNO
			out("NO");
			return;
		}
	}
	
/*------
 * main
 */
	public static void main(String[] args) throws Exception {
		Main m = new Main();
		m.exec();
	}
}

	

Measured memory_bytes: 21972
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
#define int         long long   
#define double      long double
#define endl        "\n"
#define pb          push_back
#define PI          3.1415926535897932384626433832795l
#define F           first
#define S           second
#define mp          make_pair
#define f(i,n)      for(int i=0;i<n;i++)
#define fastio      ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define all(v)      (v).begin(),(v).end()
#define sort(v)     sort((v).begin(),(v).end())
#define rall(v)     (v).rbegin(),(v).rend()
#define rsort(v)     sort((v).rbegin(),(v).rend())
#define gcd(a,b)    __gcd((a),(b))
#define minn(v)     *min_element(v.begin(), v.end());
#define maxx(v)     *max_element(v.begin(), v.end());
#define print(x)    cout<<(x)<<endl;
typedef pair<int,int> pii;  
typedef vector<int> vi;
//x.substr(start, length);
struct type{
    int k, i, j;
};
//to check if a no is prime or not?
bool isPrime(int n) 
{ 
    if (n <= 1) 
        return false; 
    if (n <= 3) 
        return true; 
    if (n % 2 == 0 || n % 3 == 0) 
        return false; 
  
    for (int i = 5; i * i <= n; i = i + 6) 
        if (n % i == 0 || n % (i + 2) == 0) 
            return false; 
  
    return true; 
}

// minimum subaaray sum of size k-sliding window approach
int findSubarray(int arr[], int n, int k)
{
	int window_sum = 0;
	int min_window = INT_MAX;
	int last = 0;
	for (int i = 0; i < n; i++)
	{
		window_sum += arr[i];
		if (i + 1 >= k)
		{
			if (min_window > window_sum)
			{
				min_window = window_sum;
				last = i;
			}
			window_sum -= arr[i + 1 - k];
		}
	}
	int sum=0;
	for(int i=last-k+1;i<=last;i++)
	{
	    sum+=arr[i];
	}
	return sum;
}
signed main() 
{
    fastio;
    int n;
    cin>>n;
    vi a(n);
    f(i,n)cin>>a[i];
    vi dp(n,0);
    dp[0]=0;
    dp[1]=abs(a[1]-a[0]);
    for(int i=2;i<n;i++)
    {
        dp[i]=min(dp[i-1]+abs(a[i]-a[i-1]),dp[i-2]+abs(a[i]-a[i-2]));    
    }
    cout<<dp[n-1]<<endl;
    
}


Measured memory_bytes: 1792
from collections import Counter


def main():

    N = int(input())
    lst = []

    for _ in range(N):
        lst.extend(input().split())

    c = dict(Counter(lst))


    for i in ["AC", "WA", "TLE", "RE"]:
        c.setdefault(i, 0)
        print(f"{i} x {c[i]}")


if __name__ == '__main__':
    main()

Measured memory_bytes: 16648
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <utility>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <cmath>
#include <cassert>
#include <queue>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
using PP = pair<ll, P>;
const int INF = 1<<30;
const int MOD = 1e9 + 7;
signed main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n; cin >> n;
    vector<PP> v;
    ll ans = 0;
    for(int i = 0; i < n; i++)
    {
        ll a, b; cin >> a >> b;
        v.push_back(PP(a + b, P(a, b)));
        ans += a;
    }
    sort(v.begin(), v.end(), greater<PP>());
    for(int i = 0; i < n; i++)
    {
        if(i % 2 == 0) continue;
        ans -= v[i].second.first + v[i].second.second;
    }
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 4980
import math

def f(n):
  s = ""
  if n <= 0:
    return 0
  for i in reversed(range(int(math.log2(n))+1)):
    if i == 0:
      s += "1" if ((n-1)//2)%2 == 0 else "0"
    else:
      s += "1" if (n//(2**i))%2 + (n+1)%2 == 2 else "0"
  return int(s,2)

a,b = map(int,input().split())
print( f(a-1) ^ f(b) )

Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stack>

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

using namespace std;

int main()
{
	int n;
	while(cin >> n && n)
	{
		string s;
		cin >> s;

		vector<int> v(n,0);
		int sum = 0;

		rep(i,100)
		{
			int id = i%n;
			if(s[i] == 'M')
			{
				v[id]++;
			}
			else if(s[i] == 'S')
			{
				sum += v[id]+1;
				v[id] = 0;
			}
			else if(s[i] == 'L')
			{
				v[id] += sum+1;
				sum = 0;
			}
		}

		sort(v.begin(),v.end());
		rep(i,n) cout << v[i] << " ";
		cout << sum << endl;
	}

	return 0;
}

Measured memory_bytes: 1228
#include<iostream>
#include<cstdio>
#include<string>
#include<algorithm>
using namespace std;

int k,n,ans=1e9;
int a[200005];

int main()
{
    cin>>k>>n;
    for(int i=1;i<=n;i++){
        cin>>a[i];
    }
    if(n>2)ans=min(ans,abs(a[1]-a[n]));
    for(int i=2;i<=n;i++){
        ans=min(ans,k-(a[i]-a[i-1]));
    }
    if(n==1)ans=a[1];
    if(n==2)ans=a[2]-a[1];
    cout<<ans;

    return 0;
}

Measured memory_bytes: 1152
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
 
typedef int _loop_int;
#define REP(i,n) for(_loop_int i=0;i<(_loop_int)(n);++i)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(ix,v.size())cout<<" "<<v[ix];cout<<endl
#define ALL(a) (a).begin(),(a).end()

#define CHMIN(a,b) a=min((a),(b))

const int INF = 2125252830;

int r,c,n;
pii ps[125252];
int val[125252];

int xmin[125252];
vector<pii> ys[125252];
vector<pii> g[125252];
ll dist[125252];
bool used[125252];

bool po[125252];
vi node;
int vere[125252];

bool check(){
  int a = node.size();
  REP(i,a)vere[node[i]] = i;
  REP(i,a)dist[i] = 0;
  REP(i,a)used[i] = false;
  dist[0] = 0;
  used[0] = true;
  queue<int> Q;
  Q.push(0);
  while(!Q.empty()){
    int p = Q.front(); Q.pop();
    int id = node[p];
    ll d = dist[p];
    REP(i,g[id].size()){
      int to = vere[g[id][i].first];
      ll cost = (ll)g[id][i].second;
      ll nd = d+cost;
      if(used[to]){
        if(dist[to]!=nd)return false;
      }else{
        dist[to] = nd;
        used[to] = true;
        Q.push(to);
      }
    }
  }
  // negative check
  ll sm = *min_element(dist,dist+a);
  REP(i,a){
    if(sm + (ll)xmin[node[i]] < 0){
      return false;
    }
    if(i==a-1)break;
    sm -= dist[i+1]-dist[i];
  }
  return true;
}
 
bool valid(int n){
  REP(i,125252)po[i]=false;
  REP(i,n){
    if(po[i])continue;
    node.clear();
    po[i] = true;
    node.push_back(i);
    queue<int> Q;
    Q.push(i);
    while(!Q.empty()){
      int p = Q.front(); Q.pop();
      REP(j,g[p].size()){
        int to = g[p][j].first;
        if(po[to])continue;
        po[to] = true;
        node.push_back(to);
        Q.push(to);
      }
    }
    sort(ALL(node));
    if(!check())return false;
  }
  return true;
}

int Sx[125252],Sy[125252];
int Mx[125252],My[125252];
 
int main(){
  scanf("%d%d%d",&r,&c,&n);
  REP(i,n){
    int x,y,a;
    scanf("%d%d%d",&x,&y,&a);
    ps[i] = pii(x,y);
    val[i] = a;
    Sx[i] = x;
    Sy[i] = y;
  }
  sort(Sx,Sx+n);
  sort(Sy,Sy+n);
  r = unique(Sx,Sx+n)-Sx;
  c = unique(Sy,Sy+n)-Sy;
  REP(i,r)Mx[Sx[i]]=i;
  REP(i,c)My[Sy[i]]=i;

  REP(i,125252)xmin[i] = INF;
  REP(i,n){
    int x,y;
    x=Mx[ps[i].first];
    y=My[ps[i].second];
    CHMIN(xmin[y],val[i]);
    ys[x].push_back(pii(y,val[i]));
    ps[i] = pii(x,y);
  }
  // graph
  REP(i,r){
    sort(ALL(ys[i]));
    vector<pii> &vec = ys[i];
    REP(j,vec.size()-1){
      int s,t;
      s = vec[j].first;
      t = vec[j+1].first;
      int sa = vec[j+1].second - vec[j].second;
      g[s].push_back(pii(t,sa));
      g[t].push_back(pii(s,-sa));
    }
  }
  if(!valid(r)){
    puts("No");
    return 0;
  }
  // ok
  puts("Yes");
  return 0;
}


Measured memory_bytes: 13952
#if 1
#include <iostream>
#include <cmath>
#include <string>
#include <vector>
#include <climits>
#include <algorithm>
#include <unordered_set>
#include <unordered_map>
#include <functional>
#include <set>
#include <map>
#include <numeric>
#include <cassert>
#include <iomanip>

using namespace std;
#define int long long
#define uint unsigned long long
constexpr int MOD = 1000000007;
//constexpr int MOD = 998244353;
constexpr int INF = 1145141919810893;

//
struct Edge {
	int next;
	int w = 1;
};
template<class T>
struct Vertex {
	std::vector<Edge>edges;
	T val = {};
};
template<class T>
struct Graph {
	std::vector<Vertex<T>> vertex;
public:
	Graph(size_t n = 0) :vertex(n) {
	}
	void setArray(int u, int v, int w = 1) {
		vertex[u].edges.push_back(Edge{ v ,w });
	}
	void setConnect(int u, int v, int w = 1) {
		setArray(u, v, w);
		setArray(v, u, w);
	}
	T& val(int u) {
		return vertex[u].val;
	}
	void dfsImpl(int pos, int prev, std::function<void(int now, int next, int w)> func) {
		for (auto& e : vertex[pos].edges) {
			if (e.next == prev) continue;
			func(pos, e.next, e.w);
			dfsImpl(e.next, pos, func);
		}
	}
	void dfs(int pos, std::function<void(int now, int next, int w)> func) {
		dfsImpl(pos, -1, func);
	}
	//graph.dfs(0, [](Vertex<int>& now, Vertex<int>& next, int w) {});
	pair<int, int> radiusImpl(int pos) {
		int farestID = -1;
		int far = -1;
		val(pos) = 0;
		dfs(pos, [&](int now, int next, int w) {
			val(next) = 1 + val(now);
			if (val(next) > far) {
				far = val(next);
				farestID = next;
			}
			});
		return { farestID, far };
	}
	int radius() {
		if (vertex.size() <= 1)return 0;
		auto res = radiusImpl(0);
		res = radiusImpl(res.first);
		return res.second;
	}
};

//////////////////////////////////
int gcd(int x, int y) { return y ? gcd(y, x % y) : x; }

std::vector<int> divisor(int n) {
	std::vector<int> ret;
	for (int i = 1; i * i <= n; ++i) {
		if (n % i == 0) {
			ret.push_back(i);
			if (i * i != n) {
				ret.push_back(n / i);
			}
		}
	}
	return ret;
}

////////////////////////



#define LOADVEC(type,name,N) std::vector<type>name(N); \
for (int nnn = 0; nnn < N; ++nnn) { \
	cin >> name[nnn]; \
}

#define LOADVEC2(type,name0,name1,N) std::vector<type>name0(N),name1(N); \
for (int nnn = 0; nnn < N; ++nnn) { \
	cin >> name0[nnn];cin >> name1[nnn]; \
}

#define LOADVEC3(type,name0,name1,name2,N) std::vector<type>name0(N),name1(N),name2(N); \
for (int nnn = 0; nnn < N; ++nnn) { \
	cin >> name0[nnn];cin >> name1[nnn];cin >> name2[nnn]; \
}

#define LOAD(type,name) type name; \
cin >> name;


void proc();

signed main() {
	ios::sync_with_stdio(false);
	proc();
	return 0;
}

/*
--------------------------------------------------------
--------------------------------------------------------
---------------    template      ----------------------
--------------------------------------------------------
--------------------------------------------------------
*/


void proc() {
	LOAD(int, r);
	LOAD(int, D);
	LOAD(int, x);
	//LOADVEC2(int, A, B, N);
	//
	for (int i = 0; i < 10; ++i) {
		x = x * r - D;
		cout << x << endl;
	}
}


#endif



Measured memory_bytes: 256
#include<stdio.h>
int a[8]={1,3,5,7,8,10,12};
int b[5]={4,6,9,11};
int main(){
	int x,y;
	int flag = 0;
	int Flag = 0;
	scanf("%d %d",&x,&y);
	if(y==2||x==2){
		printf("No\n");
	}
	else{
		for(int i = 0;i<7;i++){
			if(x==a[i]){
				flag ++;
			}
			if(y==a[i]){
				flag ++;
			}
			if(x==b[i]){
				Flag ++;
			}
			if(y==b[i]){
				Flag ++;
			}
		}
		if(flag == 2||Flag ==2){
			printf("Yes\n");
		}
		else{
			printf("No\n");
		}
	}
}

Measured memory_bytes: 128
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <vector>
using namespace std;
const int N=100010;
int tt;
int head[N],to[N*2],nxt[N*2];
inline int gi() {
    int x=0,o=1;
    char ch=getchar();
    while(ch!='-'&&(ch<'0'||ch>'9')) ch=getchar();
    if(ch=='-') o=-1,ch=getchar();
    while(ch>='0'&&ch<='9') x=x*10+ch-'0',ch=getchar();
    return x*o;
}
inline int dfs(int x,int fa) {
    int ret=0;
    for(int i=head[x];i;i=nxt[i])
	if(to[i]!=fa) ret+=dfs(to[i],x);
    if(ret>1) puts("First"),exit(0);
    return !ret;
}
int main() {
    int n;
    cin>>n;
    for(int i=1;i<n;i++) {
	int x=gi(),y=gi();
	to[++tt]=y,nxt[tt]=head[x],head[x]=tt;
	to[++tt]=x,nxt[tt]=head[y],head[y]=tt;
    }
    puts(dfs(1,0)?"First":"Second");
    return 0;
}

Measured memory_bytes: 2304
#include<bits/stdc++.h>
using namespace std;
#define ALL(x) x.begin(),x.end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define debug(v) cout<<#v<<":";for(auto x:v){cout<<x<<' ';}cout<<endl;
#define mod 1000000007
using ll=long long;
const int INF=1000000000;
const ll LINF=1001002003004005006ll;
int dx[]={1,0,-1,0},dy[]={0,1,0,-1};
// ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;}
template<class T>bool chmin(T &a,const T &b){if(b<a){a=b;return true;}return false;}
 
struct IOSetup{
    IOSetup(){
        cin.tie(0);
        ios::sync_with_stdio(0);
        cout<<fixed<<setprecision(12);
    }
} iosetup;
 
template<typename T1,typename T2>
ostream &operator<<(ostream &os,const pair<T1,T2>&p){
    os<<p.first<<" "<<p.second;
    return os;
}
 
template<typename T>
ostream &operator<<(ostream &os,const vector<T>&v){
    for(int i=0;i<(int)v.size();i++) os<<v[i]<<(i+1==(int)v.size()?"":" ");
    return os;
}

template<typename T1,typename T2>
istream &operator>>(istream &is,pair<T1,T2>&p){
    is>>p.first>>p.second;
    return is;
}

template<typename T>
istream &operator>>(istream &is,vector<T>&v){
    for(T &x:v)is>>x;
    return is;
}


signed main(){
    string s;cin>>s;
    int res=0;
    if(s=="RRR")res=3;
    else if(s=="SRR" or s=="RRS")res=2;
    else if(s[0]=='R' or s[1]=='R' or s[2]=='R') res=1;
    cout<<res<<endl;
    return 0;
}


Measured memory_bytes: 3648
l, r = list(map(int, input().split()))
mod = 2019

if (r - l >= mod):
	print(0)
	exit()

l = l % mod
r = r % mod
if r < l:
	r += mod 

ans = mod * mod
for i in range(l, r+1):
	for j in range(i+1, r+1):
		temp = i * j % 2019
		ans = min(temp, ans)

print(ans)


Measured memory_bytes: 3064
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int input = sc.nextInt();
        
        System.out.printf("%d:%d:%d\n", input / 3600, input % 3600 / 60, input % 3600 % 60);
    }
}


Measured memory_bytes: 26496
def main():
	L, R = map(int,input().split())
	K = R - L
	ans = 2019
	if K >= 2019:
		ans = 0
	else:
		for k in range(K+1):
			for d in range(k):
				ans = min(ans,(((L + k)%2019)*((L + d)%2019))%2019)
	print(ans)
main()

Measured memory_bytes: 3060
import java.util.*;
public class Main
{
  public static void main(String args[])
  {
    Scanner sc=new Scanner(System.in);
    double a=sc.nextInt();
    double b=sc.nextInt();
    double x=sc.nextInt();
    double S=x/a;
 
      if(S<=a*b/2)
      {
        double m=2*S/b;
        Math.atan(b/m);
        System.out.println(Math.toDegrees(Math.atan(b/m)));
      }
    else
      {
        double N=a*b-S;
        double o=2*N/a;
        System.out.println(Math.toDegrees(Math.atan(o/a)));
      }
    }
  }

Measured memory_bytes: 23892
def resolve():
    N = int(input())
    S = [int(i) for i in input().split()]
    Q = int(input())
    T = [int(i) for i in input().split()]

    ans = 0
    for t in T:
        ok = 0
        ng = N
        while abs(ok - ng) > 1:
            mid = (ok + ng) // 2
            if S[mid] <= t:
                ok = mid
            else:
                ng = mid
        if S[ok] == t:
            ans += 1
    print(ans)


resolve()



Measured memory_bytes: 16904
#include <stdio.h>
int main ()
{
    long s, m, h;
    scanf ("%d", &s);
    h = s / 3600;
    m = (s % 3600) / 60;
    s = s % 60;
    printf ("%d:%d:%d\n", h, m, s);
    return 0;
}


Measured memory_bytes: 2044
#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <map>
using namespace std;
inline int read()
{
	int f = 1, x = 0;
	char ch;

	do{
		ch = getchar();
		if (ch == '-')
			f = -1;
	}while(ch < '0' || ch > '9');
	do{
		x = x * 10 + ch - '0';
		ch = getchar();
	}while(ch >= '0' && ch <= '9');
	return f * x;
}
const int N = 1e5;

int n, x, cnt;
map<int, int> p;
int a[N + 1], b[N + 1];
struct Edge {
	int to, next;
} edge[(N << 1) + 1];
int start[N + 1], tot;
int vis[N + 1];
int ans;

inline void addedge(int u, int v)
{
	edge[++tot] = Edge{ v, start[u] };
	start[u] = tot;
	edge[++tot] = Edge{ u, start[v] };
	start[v] = tot;
	ans++;
	return;
}
inline void dfs(int u)
{
	vis[u] = 1;
	for (int i = start[u]; i; i = edge[i].next) {
		int v = edge[i].to;
		if (!vis[v])
			dfs(v);
	}
	return;
}
int main()
{
	n = read();
	for (int i = 1; i <= n; i++) {
		a[i] = read();
		p[a[i]]++;
		x ^= a[i];
	}
	p[x]++;
	for (int i = 1; i <= n; i++) {
		b[i] = read();
		p[b[i]]--;
	}
	for (map<int, int>::iterator it = p.begin(); it != p.end(); it++) {
		if ((*it).second < 0) {
			printf("-1\n");
			return 0;
		}
		(*it).second = ++cnt;
	}
	for (int i = 1; i <= n; i++)
		if (a[i] != b[i])
			addedge(p[a[i]], p[b[i]]);

	for (int i = 1; i <= cnt; i++) {
		if (start[i] && !vis[i]) {
			ans++;
			dfs(i);
		}
	}

	if (start[p[x]])
		ans--;
	printf("%d\n", ans);
	return 0;
}


Measured memory_bytes: 14552
#include <algorithm>
#include <cstdint>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#include <cfloat>

using namespace std;

using lint=int64_t;
using uint=uint32_t;
using ulint=uint64_t;

template<class T>
using vector2d=vector<vector<T>>;

template<class T>
bool UpdateMax(T &a, const T &b){
  if(a<b){
    a=b;
    return true;
  }else{
    return false;
  }
}

template<class T>
bool UpdateMin(T &a, const T &b){
  if(a>b){
    a=b;
    return true;
  }else{
    return false;
  }
}

template <class T>
void OutVec(const vector<T>& vec){
  for(int i = 0; i < vec.size() - 1; ++i){
    cout<<vec[i]<<" ";
  }
  cout<<vec.back()<<endl;
}

template <class T>
void OutVec2d(const vector2d<T>& vec){
  for(auto v:vec){
    OutVec(v);
  }
}

vector<int> vr{1,0,-1,0};
vector<int> vc{0,1,0,-1};

void BFS(int r, int c, int k, vector2d<int>& result, vector2d<char>& field, queue<pair<int,int>>& q){
  int next_res=result[r][c]+1;
  for(int vi=0;vi<4;vi++){
    for(int depth=1;depth<=k;depth++){
      int nr=r+depth*vr[vi];
      int nc=c+depth*vc[vi];
      if(field[nr][nc]=='@'){
        break;
      }
      if(result[nr][nc]<next_res){
        break;
      }
      if(result[nr][nc]>next_res){
        result[nr][nc]=next_res;
        q.push(make_pair(nr,nc));
      }
    }
  }
}

int main(){
  cout << std::fixed << std::setprecision(16);
  cin.tie(nullptr);
  std::ios::sync_with_stdio(false);

  int h,w,k;
  cin>>h>>w>>k;
  int sx,sy,gx,gy;
  cin>>sx>>sy>>gx>>gy;
  vector2d<char> field(h+3, vector<char>(w+3, '@'));
  for(int r=1;r<=h;r++){
    for(int c=1;c<=w;c++){
      cin>>field[r][c];
    }
  }
  const int INF=INT32_MAX/2;
  vector2d<int> result(h+3, vector<int>(w+3,INF));
  result[sx][sy]=0;
  queue<pair<int,int>> q;
  q.push(make_pair(sx,sy));
  while(!q.empty()){
    pair<int,int> curr=q.front();
    q.pop();
    BFS(curr.first,curr.second,k,result,field,q);
  }
  if(result[gx][gy]==INF){
    cout<<-1<<endl;
  }else{
    cout<<result[gx][gy]<<endl;
  }






}




Measured memory_bytes: 26812
#include <iostream>
#include <map>
using namespace std;
typedef pair<int, int> P;
map<P, int> mp;
int n, k, l, par1[210000], par2[210000], p, q;

int root1(int x) {
    if (par1[x] == x) return x;
    return par1[x] = root1(par1[x]);
}

int root2(int x) {
    if (par2[x] == x) return x;
    return par2[x] = root2(par2[x]);
}

void unite1(int x, int y) {
    if (root1(x) == root1(y)) return;
    x = root1(x);
    y = root1(y);
    par1[x] = y;
}

void unite2(int x, int y) {
    if (root2(x) == root2(y)) return;
    x = root2(x);
    y = root2(y);
    par2[x] = y;
}

int main(void){
    // Your code here!
    cin >> n >> k >> l;
    for (int i = 0; i < n; i++) {
        par1[i] = i;
        par2[i] = i;
    }
    for (int i = 0; i < k; i++) {
        cin >> p >> q;
        unite1(p - 1, q - 1);
    }
    for (int i = 0; i < l; i++) {
        cin >> p >> q;
        unite2(p - 1, q - 1);
    }
    for (int i = 0; i < n; i++) {
        mp[P(root1(i), root2(i))]++;
    }
    for (int i = 0; i < n; i++) {
        cout << mp[P(root1(i), root2(i))] << ' ';
    }
}


Measured memory_bytes: 13568
# -*- coding: utf-8 -*-
"""
Created on Thu Jan  3 10:20:42 2019

@author: Yamazaki Kenichi
"""

N = int(input())

prime = [2]
for j in range(3,100):
    if all(j % i != 0 for i in prime) :
        prime.append(j)

N1 = 1
for i in range(1,N+1):
    N1 *= i 

prime1 = []
for j in prime:
    temp = 0
    while N1 % pow(j,temp) ==0:
        temp += 1
    prime1.append(temp-1)

def num(m):
    return len(list(filter(lambda x: x>=m-1,prime1)))

ans = num(75)+ num(25)*(num(3)-1)+ num(15)*(num(5)-1)+ num(5)*(num(5)-1)//2*(num(3)-2)

print(ans)


Measured memory_bytes: 3064
s = str(input())
nexts = ''
flag1 = 0
count1 = 0
count2=0
ans = 0
que1 = ''
bigque = []
for i in range(len(s)):
    if flag1 == 1:
        if s[i] == 'A':
            flag1 = 0
            nexts += 'b'
            nexts += 'a'
        if s[i] == 'B':
            nexts += 'b'
        if s[i] == 'C':
            nexts += 'd'
            flag1 = 0
    else:
        if s[i] == 'A':
            nexts += 'a'
        if s[i] == 'B':
            flag1 += 1
        if s[i] == 'C':
            nexts += 'c'
for i in range(len(nexts)):
    if nexts[i] == 'a':
        que1 += 'a'
        count2+=1
    elif nexts[i] == 'd':
        que1 += 'd'
        count2+=1
    else:
        if count2>0:
            bigque.append(que1)
            count2=0
        que1 = ''
if len(que1)!=0:
  bigque.append(que1)
for i in range(len(bigque)):
    for j in range(len(bigque[i])):
        if bigque[i][j] == 'a':
            count1+=1
        if bigque[i][j] == 'd':
            ans += count1
    count1 = 0
print(ans)

Measured memory_bytes: 5220
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a1,a2,a3;
    cin>>a1>>a2>>a3;
    if(a1+a2+a3>=22)
        cout<<"bust"<<endl;
    else
        cout<<"win"<<endl;
        
    return 0;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include<math.h>
using namespace std;
int main(){
  long N;
  cin>>N;

  vector<long> a(5);
  for (int i = 0; i < 5; i++) {
    cin >> a.at(i);
  }
  sort(a.begin(), a.end());
  
    cout<<(N-1)/a.at(0)+5<<endl;
  
}
  

Measured memory_bytes: 256
#include<bits/stdc++.h>
typedef long long ll;
#define INF 100000000
#define MOD 1000000007
int dx[4]={1,0,-1,0},dy[4]={0,-1,0,1};
using namespace std;
int main(void){
    int n,k;
    cin>>n>>k;
    int h[n];
    int ans=0;
    for(int i=0;i<n;i++){
        cin>>h[i];
        if(h[i]>=k){
            ans++;
        }
    }
    cout<<ans<<endl;

}

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

using namespace std;

#define ll long long
#define endl '\n'

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    double r, pi = 3.14159265;
    cin >> r;
    cout << fixed << setprecision(6) << 2.00 * r * pi << endl;
    return 0;
}

Measured memory_bytes: 3796
#include <iostream>
using namespace std;
 
int main(){

    int a1, a2, a3;

	cin >> a1 >> a2 >> a3;


    if(a1 + a2 + a3 >= 22){
        cout << "bust" << endl;
        return 0;
    }
    else{
        cout << "win" << endl;
        return 0;
    }
}

Measured memory_bytes: 256
N, A, B, C, D = [int(i) for i in input().split()]
S = input()
ans = True
# check if there are two connected rocks
for i in range(A-1, max(C, D)):
    if S[i:i+2] == "##":
        ans = False
        break
else:
    if D < C:
        # check if there are three dots between B and D
        for i in range(B-2, D-1):
            if S[i:i+3] == "...":
                break
        else:
            ans = False
if ans:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3572
#include<stdio.h>
int main()
{
    int a,b,ave,acu_ave;
    scanf("%d %d",&a,&b);
    if((a+b)%2==0)
    {
        ave=(a+b)/2;
        printf("%d\n",ave);
    }
    else
    {
        ave=(a+b)/2;
        acu_ave=ave+1;
        printf("%d\n",acu_ave);
    }

    return 0;
}



Measured memory_bytes: 128
#include <bits/stdc++.h>
//#include "./libb/lib.hpp"

using namespace std;
const uint64_t MOD = 1000000007;
const double PI = acos(-1);

int main()
{
    uint32_t nn;
    uint32_t kk;
    uint32_t sum_ans = 0;
    cin >> nn >> kk;

    vector<uint32_t> ans(nn, 0);
    vector< vector<uint32_t> > ddary(kk, vector<uint32_t>(nn));
    vector< vector<uint32_t> > sumary(kk, vector<uint32_t>(nn));

    uint32_t tempd = 0;

    for(int i = 0; i < kk; i++){
        cin >> tempd;
        for(int l = 0; l < tempd; l++){
            cin >> ddary[i][l];
        }
    }

    /* for(int i = 0; i < kk; i++){
        for(int l = 0; l < nn; l++){
            cout << ddary[i][l]  <<" ";
        }
        cout << endl;
    } */

    for(int i = 0; i < kk; i++){
        for(int l = 0; l < nn; l++){
            if(ddary[i][l] != 0){
                ans[ddary[i][l] - 1] = 1;
            }
        }
    }

    /* for(int k = 0; k < nn; k++){
        cout << ans[k] << " " ;
    }

    cout << endl; */

    for(int k = 0; k < nn; k++){
        if(ans[k] == 0){
            sum_ans++;
        }
    }

    cout << sum_ans << endl;
    return 0;
}


Measured memory_bytes: 3688
#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <numeric>
#define rep(i, m, n) for(int i = m;i < n;i++)
#define repr(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define INF 999999999
using namespace std;

int main(){
    long long n; cin >> n;
    long long a[n] = {0};
    int ans = n;
    rep(i, 0, n){
        cin >> a[i];
    }

    SORT(a, n);

    int temp = 1;
    rep(i, 0, n){
        if(a[i] == a[i+1]){
            temp += 1;
        }
        if(a[i] != a[i+1]){
            if(temp % 2 == 0) ans -= temp;
            else if (temp % 2 == 1) ans += (1-temp);
            //cout << "case1  = " << temp << endl;
            temp = 1;
        }
        else if(i == n-1){
            if(temp % 2 == 0) ans -= temp;
            else if (temp % 2 == 1) ans += (1-temp);
            //cout << "case2 = " << temp << endl;
            temp = 1;
        }
    }

    cout << ans << endl;

    return 0;
}


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

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);  
	ll n;
	cin>>n;
	if(400<=n && n<=599){
		cout<<"8"<<"\n";
	}
	else if(600<=n && n<=799){
		cout<<"7"<<"\n";
	}
	else if(800<=n && n<=999){
		cout<<"6"<<"\n";
	}
	else if(1000<=n && n<=1199){
		cout<<"5"<<"\n";
	}
	else if(1200<=n && n<=1399){
		cout<<"4"<<"\n";
	}
	else if(1400<=n && n<=1599){
		cout<<"3"<<"\n";
	}
	else if(1600<=n && n<=1799){
		cout<<"2"<<"\n";
	}
	else{
		cout<<"1"<<"\n";
	}
	return 0;
}

Measured memory_bytes: 3644
#include <stdio.h>

int main(void){

    int W,H,x,y,r;
    
    scanf("%d %d %d %d %d", &W,&H,&x,&y,&r);
   
    if(x>=r && x<=W-r && y>=r && y<=H-r){
      printf("Yes\n");
    } else {
      printf("No\n");
    }

    return 0;
}

Measured memory_bytes: 584
# /usr/bin/python
# -*- coding: utf-8 -*-
import sys
import math



def main(x,y):
	if x < y:
		return '<'
	elif x > y:
		return '>'
	else:
		return '='


if __name__ == "__main__":
	X,Y = map(str, input().split())
	print(main(X,Y))

Measured memory_bytes: 3060
#define _CRT_SECURE_NO_DEPRECATE
#include<bits/stdc++.h>
#define Rint register int
#define MP make_pair
#define fi first
#define se second
#define PB push_back
using namespace std;
typedef long long ll;
typedef pair<int, int> pii; // 注意必要时改类型
typedef vector<int> vi;
const int N = 1e5 + 5;
int n, m, ans;
vi e[N];
queue<int> q;
int dp[N], in[N];

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
#ifdef _DEBUG
	int tt = clock();
	// freopen("in.txt", "r", stdin);
#endif 

	scanf("%d%d", &n, &m);
	for (int i = 1, a, b; i <= m; i++) {
		scanf("%d%d", &a, &b);
		e[a].push_back(b); // directed
		in[b]++;
	}
	for (int i = 1; i <= n; i++) if (!in[i]) q.push(i);
	while (!q.empty()) {
		int now = q.front(); q.pop();
		for (int i = 0; i < e[now].size(); i++) {
			int to = e[now][i];
			in[to]--;
			if (!in[to]) {
				dp[to] = dp[now] + 1;
				q.push(to);
			}
		}
	}
	cout << *max_element(dp + 1, dp + n + 1) << endl;


#ifdef _DEBUG
	cerr << "\nTIME = " << clock() - tt << endl;
	tt = clock();
#endif

	return 0;
}


Measured memory_bytes: 6528
import sys
import numpy as np 

n = int(sys.stdin.readline().rstrip())
a = np.array(sys.stdin.read().split(), dtype=np.int64)

def main():
    b = np.sort(a)
    m1 = b[-1]
    m2 = b[-2]
    res = np.zeros(n, dtype=np.int64)
    res[a <= m2] = m1
    res[res == 0] = m2
    return res
    
if __name__ == '__main__':
    ans = main()
    print(*ans, sep='\n')

Measured memory_bytes: 34000
#pragma GCC optimize("O2")
#include <bits/stdc++.h>
using namespace std;

#define dbg(x) cerr << #x"=" << x << endl;
typedef long long LL;

int main(){
	//freopen("in.txt", "r", stdin);
    LL w,h;
    LL x,y;
    scanf("%lld%lld", &w, &h);
    scanf("%lld%lld", &x, &y);
    bool f1 = (x == w/2.0);
    bool f2 = (y == h/2.0);
    printf("%f ", (w*h)/2.0);
    printf("%d\n", f1&&f2);
    return 0;
}


/*
ans <= (w*h)/2.0

*/


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<cmath>
#include<algorithm>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
#define N 1001
using namespace std;

int main(){
	int V,d;
	while(cin>>V){
		cin>>d;
		int rank[V+1],parent[V+1],label[V+1];
		label[0]=1;
		label[1]=2;
		rep(i,V+1){
			rank[i]=1;
			parent[i]=i;
			if(i>=2)label[i]=(label[i-1]+label[i-2])%N;
		}
		loop(i,1,V+1){
			loop(j,1,V+1){
				if(abs(label[i]-label[j])<d){
					int now1=i,now2=j;
					while(parent[now1]!=now1){
						now1=parent[now1];
					}
					while(parent[now2]!=now2){
						now2=parent[now2];
					}
					if(rank[now1]>rank[now2]){
						parent[now2]=now1;
					}else if(rank[now1]<rank[now2]){
						parent[now1]=now2;
					}else{
						parent[now2]=now1;
						rank[now1]++;
					}
				}
			}
		}
		int cnt=0;
		loop(i,1,V+1){
			if(parent[i]==i)cnt++;
		}
		cout<<cnt<<endl;
	}
	return 0;
}

Measured memory_bytes: 1172
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <time.h>

#define _CRT_SECURE_NO_WARNINGS
#define TLong long long 

// fact(n)
int fact(int n){
	if(n == 1)	return 1;
	else return (n * fact(n - 1));
}

// combination(n,r)
int combination(int n, int r){

	if(r == 0 || r == n)	return 1;
	else if(r == 1)	return n;
	return (combination(n - 1, r - 1) + combination(n - 1, r));
}

// gcd(a,b)
int gcd(int a,int b){
	int ret;
	ret = (b == 0) ? a : gcd(b, a % b);
	return ret;
}

// lcm(a.b)
int lcm(int a,int b){
	return (a * b) / gcd(a,b);
}

// qsort(array, size, sizeof(int),comp);
int comp(const int *a,const int *b){
	return (*a - *b);
}

// append(array,*size,addNum)
void append(int *array,int *size,int num){
	realloc(array, sizeof(int) * (*size + 1));
	array[(*size)] = num;
	++(*size);
}

// pop(array,*size) & nongetpop(array,*size)
int pop(int *array,int *size){
	int temp = array[(*size - 1)];
	realloc(array,sizeof(int) * (*size - 1));
	--(*size);
	return temp;
}

void nongetpop(int *array,int *size){
	realloc(array,sizeof(int) * (*size - 1));
	--(*size);
}

int main(int argc, char const *argv[]){
	int a,b;
	scanf("%d%d",&a,&b);
	if(a == 1)	a += 13;
	if(b == 1)	b += 13;
	printf("%s\n", a > b ? "Alice" : (a == b ? "Draw" : "Bob"));
}


Measured memory_bytes: 128
#include<iostream>
using namespace std;
#define INF 10000000000;

int cnt = 0;

void merge(int A[], int left, int mid, int right){
  int n1 = mid - left;
  int n2 = right - mid;
  int l[n1+1], r[n2+1];
  for ( int i = 0; i < n1; i++){ l[i] = A[left + i]; }
  for ( int i = 0; i < n2; i++){ r[i] = A[mid + i]; }
  l[n1] = INF;
  r[n2] = INF;

  int i = 0, j = 0;
  for ( int k = left; k < right; k++){
    if ( l[i] < r[j]){
      A[k] = l[i];
      i ++;
    } else {
      A[k] = r[j];
      j ++;
    }
    cnt ++;
  }
}

void mergeSort(int A[], int left, int right){
  if ( left + 1 < right){
    int mid = (left + right) / 2;
    mergeSort(A, left, mid);
    mergeSort(A, mid, right);
    merge(A, left, mid, right);
  }
}

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

  mergeSort(A, 0, n);

  for ( int i = 0; i < n; i++){
    if (i) cout << " ";
    cout << A[i];
  }
  cout << endl;
  
  cout << cnt << endl;

  return 0;
}


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

using namespace std;

int n;
string ans;

int main(){
	cin >> n;
	while(n != 0){
		if(n % 2 == 0){
			ans = "0"+ans;
		}else{
			n--;
			ans = "1"+ans;
		}
		n /= -2;
	}
	if(ans == "") ans = "0";
	cout << ans << endl;
}

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

void solve(){
    int n; cin >> n;
    bool ok = false;
    for (int i = 1; i <= 9; i++){
        for (int j = 1; j <= 9; j++){
            if (i * j == n) ok = true;
        }
    }
    cout << (ok ? "Yes" : "No") << endl;
}

int main(){
    ios_base::sync_with_stdio(false); cout.tie(0); cin.tie(0);
    solve();
    return 0;
}


Measured memory_bytes: 256
n, y = gets.split.map(&:to_i)

(0..n).each do |i|
  (0..(n - i)).each do |j|
    if i * 10000 + j * 5000 + ((n - i - j) * 1000) == y
      puts "#{i} #{j} #{n - i - j}"
      exit
    end
  end
end

puts "-1 -1 -1"


Measured memory_bytes: 1788
import collections
N = int(input())
G = [[0 for _ in range(N)] for _ in range(N)]
for i in range(N):
    u,k,*varray = map(int,input().split())
    for v in varray:
        G[u-1][v-1] = 1


D=[-1 for i in range(N)]
D[0] = 0
Q = collections.deque()
Q.append(0)

while len(Q) > 0:
    cur = Q.popleft()
    for dst in range(N):
        if G[cur][dst]==1 and D[dst] == -1:
            D[dst] = D[cur]+1
            Q.append(dst)

for v in range(N):
    print(v+1, D[v])



Measured memory_bytes: 6096
#include <bits/stdc++.h>
#define REP(i, n) for(ll i = 0; i < (ll)n; i++)
#define FOR(i, a, b) for(ll i = (a); i < (ll)b; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF (1ll << 60)
#define sz(x) int(x.size())
using namespace std;
typedef long long ll;
using vl = vector<ll>;
using vvl = vector<vl>;
typedef double db;
typedef string str;
typedef pair<ll, ll> p;
constexpr int MOD = 1000000007;
using ll = long long;
template <class T> inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}
template <class T> inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}

void print(const std::vector<int> &v) {
    std::for_each(v.begin(), v.end(), [](int x) { std::cout << x << " "; });
    std::cout << std::endl;
}

int main() {
    ll N;
    cin >> N;
    ll a, b;
    for(ll i = sqrt(N); i >= 1; i--) {
        if(N % i == 0) {
            a = i;
            b = N / i;
            break;
        }
    }

    cout << a + b - 2LL << endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
  int i, x, y, s;

  for (i = 1; i < 3001; i++){
    scanf("%d %d", &x, &y);
    if (!x && !y)
      break;
    if (x > y){
      s = x;
      x = y;
      y = s;
    }
    printf("%d %d\n", x, y);
  }

  return 0;
}

Measured memory_bytes: 1028
import java.util.*;

public class Main {

    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        String pre = sc.next();
        HashMap<String, Integer> map = new HashMap<>();
        map.put(pre, 1);
        boolean ok = true;
        for (int i = 1; i < n; i++) {
            String tk = sc.next();
            if (pre.charAt(pre.length() - 1) != tk.charAt(0))
                ok = false;
            if (map.containsKey(tk))
                ok = false;
            map.put(tk, 1);
            pre = tk;
        }

        System.out.println(ok ? "Yes" : "No");

    }

}


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

using namespace std;

int pm(int i) {
    if (i == 0) return 1;
    else return -1;
}

char cpm(int i) {
    if (i == 0) return '+';
    else return '-';
}

int main() {
    string S; cin >> S;

    int A, B, C, D;
    A = S[0] - '0';
    B = S[1] - '0';
    C = S[2] - '0';
    D = S[3] - '0';

    int b, c, d;
    for (int i = 0; i < 2; i++) {
        for (int j = 0; j < 2; j++) {
            for (int k = 0; k < 2; k++) {
                int tr = A + pm(i)*B + pm(j)*C + pm(k)*D;
                if (tr == 7) {
                    b = i; c = j; d = k;
                    break;
                }
            }
        }
    }

    cout << A << cpm(b) << B << cpm(c) << C << cpm(d) << D << "=7" << endl;
    return 0;
}

Measured memory_bytes: 256
def cal1(x):
    c=int(x/0.08)
    if x*100%8==0:
        return c 
    else:
        return c+1
      
def cal2(x):
    c=int(x/0.1)
    return c
      
A,B=map(int,input().split())
a,b,c,d=cal1(A),cal1(A+1)-1,cal2(B),cal2(B+1)-1

if  b<c or d<a:
    print("-1")
else:
    print(max(a,c))


Measured memory_bytes: 3316
//#define NDEBUG
#include <algorithm>
#include <cstddef>
#include <cstdint>
#include <iostream>
#include <utility>
#include <vector>

namespace n91 {

using i8 = std::int_fast8_t;
using i32 = std::int_fast32_t;
using i64 = std::int_fast64_t;
using u8 = std::uint_fast8_t;
using u32 = std::uint_fast32_t;
using u64 = std::uint_fast64_t;
using isize = std::ptrdiff_t;
using usize = std::size_t;

struct rep {
  struct itr {
    usize i;
    constexpr itr(const usize i) noexcept : i(i) {}
    void operator++() noexcept { ++i; }
    constexpr usize operator*() const noexcept { return i; }
    constexpr bool operator!=(const itr x) const noexcept { return i != x.i; }
  };
  const itr f, l;
  constexpr rep(const usize f, const usize l) noexcept
      : f(std::min(f, l)), l(l) {}
  constexpr auto begin() const noexcept { return f; }
  constexpr auto end() const noexcept { return l; }
};
struct revrep {
  struct itr {
    usize i;
    constexpr itr(const usize i) noexcept : i(i) {}
    void operator++() noexcept { --i; }
    constexpr usize operator*() const noexcept { return i; }
    constexpr bool operator!=(const itr x) const noexcept { return i != x.i; }
  };
  const itr f, l;
  constexpr revrep(const usize f, const usize l) noexcept
      : f(l - 1), l(std::min(f, l) - 1) {}
  constexpr auto begin() const noexcept { return f; }
  constexpr auto end() const noexcept { return l; }
};
template <class T> auto md_vec(const usize n, const T &value) {
  return std::vector<T>(n, value);
}
template <class... Args> auto md_vec(const usize n, Args... args) {
  return std::vector<decltype(md_vec(args...))>(n, md_vec(args...));
}
template <class T> constexpr T difference(const T &a, const T &b) noexcept {
  return a < b ? b - a : a - b;
}
template <class T> void chmin(T &a, const T &b) noexcept {
  if (b < a)
    a = b;
}
template <class T> void chmax(T &a, const T &b) noexcept {
  if (a < b)
    a = b;
}
template <class F> class rec_lambda {
  F f;

public:
  rec_lambda(F &&f) : f(std::move(f)) {}
  template <class... Args> auto operator()(Args &&... args) const {
    return f(*this, std::forward<Args>(args)...);
  }
};
template <class F> auto make_rec(F &&f) { return rec_lambda<F>(std::move(f)); }
template <class T> T scan() {
  T ret;
  std::cin >> ret;
  return ret;
}

} // namespace n91

namespace n91 {

void main_() {
  /*
  std::ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  //*/
  const usize n = scan<usize>();
  std::vector<u32> a(n);
  for (auto &e : a) {
    e = scan<char>() - '1';
  }
  bool twof = false;
  if (std::all_of(a.begin(), a.end(), [](u32 x) { return x == 0 || x == 2; })) {
    twof = true;
    for (auto &e : a)
      e /= 2;
  }
  for (auto &e : a)
    e &= 1;
  u32 ans = 0;
  const usize m = n - 1;
  for (const usize i : rep(0, n)) {
    if ((m & i) == i) {
      ans ^= a[i];
    }
  }
  if (twof)
    ans *= 2;
  std::cout << ans << std::endl;
}

} // namespace n91

int main() {
  n91::main_();
  return 0;
}


Measured memory_bytes: 8064
#include<iostream>
#include<string>
#include<stdio.h>
#include<cctype>
#include<algorithm>
#include<climits>
#include<cmath>
#include<map>
#include<vector>
#define INF INT_MAX
using namespace std;

int a, b, c;
int ans;
string s;

int main() {
	cin >> s;

	if (s[2] == s[3] && s[4] == s[5]) {
		cout << "Yes" << endl;
		return 0;
	}

	cout << "No" << endl;
	
	return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
char s[50005];
int root,last,sz,ch[50005][26],fa[50005],sum[50005],l[50005];
int n,m,b[50005],cnt[50005];
void extend(int x) 
{
    int c=s[x]-'a';
    int p=last,np=++sz; last=np;
    l[np]=x+1;
    for (;p&&!ch[p][c];p=fa[p]) ch[p][c]=np;
    if (!p) fa[np]=root;
    else 
    {
        int q=ch[p][c];
        if (l[p]+1==l[q]) fa[np]=q;
        else 
        {
            int nq=++sz; l[nq]=l[p]+1;
            memcpy(ch[nq],ch[q],sizeof(ch[q]));
            fa[nq]=fa[q]; fa[np]=fa[q]=nq;
            for (;p&&q==ch[p][c];p=fa[p]) ch[p][c]=nq;
        }
    }
}
void calc() 
{
    for (int i=1; i<=sz; i++) cnt[l[i]]++;
    for (int i=1; i<=n; i++) cnt[i]+=cnt[i-1];
    for (int i=1; i<=sz; i++) b[cnt[l[i]]--]=i;
    for (int i=sz; i; i--) 
    {
        int p=b[i]; sum[p]=1;
        for (int j=0; j<26; j++) sum[p]+=sum[ch[p][j]];
    }
}

int main() 
{
    scanf("%s",s);
    n=strlen(s);
    root=last=++sz;
    for (int i=0; i<n; i++) extend(i);
    calc();
    int x,p=root; 
    scanf("%d",&x);
    while (x) 
    {
        for (int c=0; c<26; c++)
            if(ch[p][c]) 
            {
                if(sum[ch[p][c]]>=x) 
                {
                    putchar(c+'a');
                    x--; p=ch[p][c];
                    break;
                }
                else x-=sum[ch[p][c]];
            }
    }
    puts("");
    return 0;
}

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

const int N = 1e6 + 10;
const int inf = INT_MAX;

#define ll long long
#define FOR(i,a,b) for(int i = a;i <= b;i++)
#define _FOR(i,a,b) for(int i = a;i >= b;i--)

template<typename T> void read(T &x)
{
    x = 0;int f = 1;
    char c = getchar();
    for(;!isdigit(c);c = getchar()) if(c == '-') f = -1;
    for(;isdigit(c);c = getchar()) x = x * 10 + c - '0';
    x *= f;
}

int n,num[N];
int main()
{
    //freopen(".in","r",stdin);
    //freopen(".
    read(n);
    FOR(i,1,100)
    	FOR(j,1,100)
    		FOR(k,1,100)
    			num[i * i + j * j + k * k + i * j + i * k + j * k]++;
	FOR(i,1,n)
		printf("%d\n",num[i]);
    return 0;
}




Measured memory_bytes: 3992