akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <bits/stdc++.h>
#include <cstdint>
#include <iostream>
#include <iterator>
#include <vector>

// lib/util.hpp
#ifndef UTIL_HPP
#define UTIL_HPP


typedef ::std::int_fast64_t i64;
typedef ::std::uint_fast64_t u64;
typedef ::std::int_fast32_t i32;
typedef ::std::uint_fast32_t u32;

namespace tools {
  template <typename T>
  void read(::std::istream& is, ::std::vector<T>& vector, const typename ::std::vector<T>::size_type size) {
    vector.reserve(size);
    ::std::copy_n(::std::istream_iterator<T>(is), size, ::std::back_inserter(vector));
  }
  template <typename T>
  void read(::std::vector<T>& vector, const typename ::std::vector<T>::size_type size) {
    ::tools::read(::std::cin, vector, size);
  }

  template <typename T, ::std::size_t N>
  void read(::std::istream& is, ::std::array<T, N>& array) {
    ::std::copy_n(std::istream_iterator<T>(is), N, array.begin());
  }
  template <typename T, ::std::size_t N>
  void read(::std::array<T, N>& array) {
    ::tools::read(::std::cin, array);
  }
}

#endif

// main.cpp

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

  std::array<i64, 3> occurrences = {
    std::count(S.begin(), S.end(), 'a'),
    std::count(S.begin(), S.end(), 'b'),
    std::count(S.begin(), S.end(), 'c')
  };
  std::cout << (*std::max_element(occurrences.begin(), occurrences.end()) - *std::min_element(occurrences.begin(), occurrences.end()) <= 1 ? "YES" : "NO") << std::endl;
  return 0;
}

Measured memory_bytes: 512
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<cstring>
#include<string>
#include<math.h>
#include<vector>
using namespace std;
int main(){
    int a,b,c;
    cin>>a>>b>>c;
    if(a+b>=c)                                             
        cout<<"Yes"<<"\n";
    else
        cout<<"No"<<"\n";
    return 0;        

}


Measured memory_bytes: 256
#include<iostream>

int H, W;
char rect[500][500];
int a[500][500];

int main()
{
	while( std::cin >> H >> W, H | W )
	{
		for( int i = 0; i != H; ++i )
			for( int j = 0; j != W; ++j )
				std::cin >> rect[i][j];

		for( int i = 0; i != H; ++i )
		{
			for( int j = 0; j != W; ++j )
			{
				int k = j, cnt = 0;

				while( k < W && rect[i][k++] == '.' )
					++cnt;

				a[i][j] = cnt;
			}
		}

		int ans = 0;
		for( int i = 0; i != H; ++i )
		{
			for( int j = 0; j != W; ++j )
			{
				int w = 501;

				for( int k = 0; i + k < H; ++k )
				{
					w = std::min( w, a[i+k][j] );
					ans = std::max( ans, ( k + 1 ) * w );
				}
			}
		}

		std::cout << ans << std::endl;
	}

	return 0;
}

Measured memory_bytes: 2380
import java.util.Scanner;


public class Main {
	static String[] a = new String[] {"A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"};
	static String[] b = new String[] {"D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","A","B","C"};
	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		
		while (stdIn.hasNext()) {
			String tmp = stdIn.next();
			tmp = tmp.toLowerCase();
			int j = sorvj(tmp);
			int i = sorvi(tmp);
			System.out.println(j);
			System.out.println(i);
		}
	}
	
	static int sorvj(String a) {
		int ans = 0;
		for(int i = 0; i < a.length() - 2; i++) {
			IN:for(int j = 0; j < 3; j++) {
				switch(j) {
				case 0: if(a.charAt(i) != 'j') break IN; break;
				case 1: if(a.charAt(i + 1) != 'o') break IN; break;
				case 2: if(a.charAt(i + 2) == 'i') ans++; break;
				}
			}
		}
		return ans;
	}
	
	static int sorvi(String a) {
		int ans = 0;
		for(int i = 0; i < a.length() - 2; i++) {
			IN:for(int j = 0; j < 3; j++) {
				switch(j) {
				case 0: if(a.charAt(i) != 'i') break IN; break;
				case 1: if(a.charAt(i + 1) != 'o') break IN; break;
				case 2: if(a.charAt(i + 2) == 'i') ans++; break;
				}
			}
		}
		return ans;
		
	}
	
}

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


template <typename T>
struct Pt {
  T x, y;
  Pt() : x(0), y(0) {}
  Pt(const T x, const T y) : x(x), y(y) {}
  template <class F> explicit operator Pt<F> () const {
    return Pt<F>((F)x, (F)y); }

  Pt operator+(const Pt b) const { return Pt(x + b.x, y + b.y); }
  Pt operator-(const Pt b) const { return Pt(x - b.x, y - b.y); }
  template <class F> Pt<F> operator* (const F fac) {
    return Pt<F>(x * fac, y * fac); }
  template <class F> Pt<F> operator/ (const F fac) {
    return Pt<F>(x / fac, y / fac); }

  T operator&(const Pt b) const { return x * b.x + y * b.y; }
  T operator^(const Pt b) const { return x * b.y - y * b.x; }

  bool operator==(const Pt b) const {
    return x == b.x and  y == b.y; }
  bool operator<(const Pt b) const {
    auto a = *this;
    auto sgn = [](const Pt t) { return (t.y == 0? t.x: t.y) < 0; };
    if (sgn(a) != sgn(b)) return sgn(a) < sgn(b);
    return (a^b) > 0;
  }

  Pt operator-() const { return Pt(-x, -y); }
  T norm() const { return *this & *this; }
  Pt prep() const { return Pt(-y, x); }
};
template<class F> istream& operator>>(istream& is, Pt<F> &pt) {
  return is >> pt.x >> pt.y;
}
template<class F> ostream& operator<<(ostream& os, Pt<F> &pt) {
  return os << pt.x << ' ' << pt.y;
}

int main () {
  ios_base::sync_with_stdio(false); cin.tie(0);
  int n; cin >> n;
  vector<Pt<long long>> A;
  for (int i = 0; i < n; ++i) {
    Pt<long long> b;
    cin >> b;
    if (not (b == Pt<long long>(0, 0))) A.push_back(b);
  }
  n = A.size();
  sort(A.begin(), A.end());
  long long ans = 0;
  for (int i = 0; i < n; ++i) {
    Pt<long long> cur;
    for (int j = i; j != i + n; ++j) {
      cur = cur + A[j % n];
      ans = max(ans, cur.norm());
    }
  }
  cout << fixed << setprecision(20) << sqrt(ans) << '\n';
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define SORT(c) sort((c).begin(),(c).end())
#define db(x) cout<<#x<<"="<<x<<endl
#define rep(i, n) for(int i = 0; i < n; i++)
#define repr(i, n) for(int i = n; i >= 0; i--)
#define reps(i, m, n) for(int i = m; i < n; i++)
#define reprs(i, m, n) for(int i = n; i >= m; i--)
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
using namespace std;
typedef long long ll;

int main(){

  ll S;
  cin >> S;

  ll r=1000000000;

  ll x3=0;
  ll y3=0;
  ll x1,x2,y1,y2;

  x1=(S+r-1)/r;
  if(S%(r)==0) x2=0;
  else {x2=r-(S%(r));}

  y1=1;
  y2=r;


  cout <<x1<<" "<< y1<<" "<<x2<<" "<<y2<<" "<<x3<< " "<<y3<<endl;

//  ll x;
//  x=(x1-x3)*(y2-y3)-(x2-x3)*(y1-y3);
//  cout << x <<endl;
  return 0;
}


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

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

	// 二分木としてなめて和をとり2で割っていく。そして、小要素値を何度も割って、大要素値をあまり割らないようにする
	sort(v.begin(), v.end());
	double ans = v[0];
	for (int i = 1; i < n; i++) {
		ans += v[i]; ans /= 2;
	}

	cout << fixed << setprecision(10) << ans << endl;
}


Measured memory_bytes: 256
def defeat_monster(a, b, i, j):
    defeated = min(a[i], b[j])
    a[i] -= defeated
    b[j] -= defeated
    return defeated

n = int(input())
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
count = 0
for i in range(n):
    count += defeat_monster(a, b, i, i)
    count += defeat_monster(a, b, i + 1, i)
print(count)

Measured memory_bytes: 19648
#include <bits/stdc++.h>
using namespace std;
int main(){
  int a,b,x;
  cin >> a >> b;
  for (int i=a; i<=b; i++){
    if((i / 10000) == (i % 10) && (i / 1000 % 10) == (i / 10 % 10)){
      x++;
    }
  }
  cout << x << endl;
}

Measured memory_bytes: 256
"use strict"
function main(arg) {
    let [L,R,d] = arg.trim().split("\n")[0].split(" ").map(Number)
    let ans = 0
    for (let i = L; i <= R; i++) {
        if (i % d === 0) {
            ans++
        }
    }
    console.log(ans)
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

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

int N;
vector<ll> a(10001);

int main(void){
    
    cin >> N;
    for(int i = 0; i < N; ++i) cin >> a[i];
    
    int ans = 0;
    for(int i = 0; i < N; ++i){
        while(a[i] % 2 == 0){
            a[i] /= 2;
            ++ans;
        }
    }
    
    cout << ans << endl;
    
    return 0;
}

Measured memory_bytes: 384
import java.util.LinkedList;
import java.util.Scanner;

public class Main {
	
	static int W,H;
		
	public static void main(String[] args){
		Scanner in = new Scanner(System.in);
			while(true){
			W = in.nextInt();
			H = in.nextInt();
			if(W==0&&H==0) break;
			String[] left = new String[H];
			String[] right = new String[H];
			int goal = 0;
			int start = 0;
			for(int i=0;i<H;i++){
				left[i] = in.next();
				right[i] = in.next();
				for(int j=0;j<W;j++){
					if(left[i].charAt(j)=='%'){
						goal += (100*j + i)*10000;
					}else if(left[i].charAt(j)=='L'){
						start += (100*j + i)*10000;
					}
					if(right[i].charAt(j)=='%'){
						goal += 100*j + i;
					}else if(right[i].charAt(j)=='R'){
						start += 100*j + i;
					}
				}
			}
			boolean[] pos = new boolean[100000000];
			LinkedList<Integer> stack = new LinkedList<>();
			stack.push(start);
			pos[start] = true;
			String ans = "No";
			while(!stack.isEmpty()){
				int now = stack.pop();
				//UP
				int up = now;
				if(!isWall(getLx(now),getLy(now)-1,left)){
					up -= 10000;
				}
				if(!isWall(getRx(now),getRy(now)-1,right)){
					up -= 1;
				}
				if(up==goal){
					ans = "Yes"; break;
				}
				if(!isGoal(getLx(up),getLy(up),left) &&
						!isGoal(getRx(up),getRy(up),right) &&
						!pos[up]){
					stack.add(up); pos[up] = true;
				}
				//DOWN
				int down = now;
				if(!isWall(getLx(now),getLy(now)+1,left)){
					down += 10000;
				}
				if(!isWall(getRx(now),getRy(now)+1,right)){
					down += 1;
				}
				if(down==goal){
					ans = "Yes"; break;
				}
				if(!isGoal(getLx(down),getLy(down),left) &&
						!isGoal(getRx(down),getRy(down),right) &&
						!pos[down]){
					stack.add(down); pos[down] = true;
				}
				//into
				int into = now;
				if(!isWall(getLx(now)+1,getLy(now),left)){
					into += 1000000;
				}
				if(!isWall(getRx(now)-1,getRy(now),right)){
					into -= 100;
				}
				if(into==goal){
					ans = "Yes"; break;
				}
				if(!isGoal(getLx(into),getLy(into),left) &&
						!isGoal(getRx(into),getRy(into),right) &&
						!pos[into]){
					stack.add(into); pos[into] = true;
				}
				//out
				int out = now;
				if(!isWall(getLx(now)-1,getLy(now),left)){
					out -= 1000000;
				}
				if(!isWall(getRx(now)+1,getRy(now),right)){
					out += 100;
				}
				if(out==goal){
					ans = "Yes"; break;
				}
				if(!isGoal(getLx(out),getLy(out),left) &&
						!isGoal(getRx(out),getRy(out),right) &&
						!pos[out]){
					stack.add(out); pos[out] = true;
				}
			}
			System.out.println(ans);
			System.gc();
		}	
	}
	
	public static int getLx(int pos){
		return pos/1000000;
	}
	public static int getLy(int pos){
		return pos/10000 %100;
	}
	public static int getRx(int pos){
		return pos/100 % 100;
	}
	public static int getRy(int pos){
		return pos%100;
	}
	public static boolean isWall(int x,int y,String[] map){
		return x<0 || x>=W || y<0 || y>=H || map[y].charAt(x) == '#';
	}
	public static boolean isGoal(int x,int y,String[] map){
		return !(x<0 || x>=W || y<0 || y>=H) && map[y].charAt(x) == '%';
	}
}

Measured memory_bytes: 292460
#include <stdlib.h>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <limits>
#include <numeric>
#include <queue>
#include <vector>

using namespace std;

bool compare_F(pair<int, int> a, pair<int, int> b) {
  if (a.first != b.first) {
    return a.first < b.first;
  } else {
    return a.second > b.second;
  }
}

bool compare_S(pair<int, int> a, pair<int, int> b) {
  if (a.second != b.second) {
    return a.second > b.second;
  } else {
    return a.first > b.first;
  }
}

template <typename T>
void ArrayInput(vector<T> &A) {
  for (auto itr = A.begin(); itr != A.end(); ++itr) {
    cin >> *itr;
  }
}
template <typename T>
void ArrayPut(vector<T> &A) {
  for (auto itr = A.begin(); itr != A.end(); ++itr) {
    cout << *itr << " ";
  }
  cout << endl;
}

using Graph = vector<vector<uint32_t>>;
vector<bool> seen;
vector<uint32_t> dis, A_dis, T_dis;

void dfs(Graph &G, uint32_t v) {
  seen[v] = true;

  for (auto itr = G[v].begin(); itr != G[v].end(); ++itr) {
    if (seen[*itr]) continue;
    dis[*itr] = dis[v] + 1;
    dfs(G, *itr);
  }
}

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

  cout << T << S;

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,N) for(int i=0;i<(N);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e12;
const int inf = 1e9;
const int mod = 1e9+7;
typedef long long ll;
typedef pair<ll,int> P;
typedef set<int> S;
int main(){
	cout << fixed << setprecision(10);
	ll ans = 0;
	int n;
	cin >> n;
	vector<int> a(n),b(n);
	rep(i,n) cin >> a[i] >> b[i];
	for(int i = n-1; i >= 0 ; i--){
		if((a[i]+ans)%b[i] == 0) continue;
		else{
			ll nn = b[i]*((a[i]+ans)/b[i]+1);
			ans += nn - a[i]-ans ;
		}
	}
	cout << ans << endl;
	return 0;
}

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

#define REP(i, e) for(int (i) = 0; (i) < (e); ++(i))
#define FOR(i, b, e) for(int (i) = (b); (i) < (e); ++(i))
#define ALL(c) (c).begin(), (c).end()
#define ACC(c) (accumulate(ALL(c), 0LL))
#define ENDL "\n"
#define PRINT(x) cout << (x) << ENDL

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

inline int in(int& a) {return scanf("%d", &a);}
inline void out(int n) {printf("%d\n", n);}
auto pint_compare = [](pint x, pint y) -> bool{return (x.first < y.first);};


signed main(){
    int N, D;
    int X[10][10];
    cin >> N >> D;
    REP(i, N) REP(j, D) cin >> X[i][j];
    int cnt = 0;
    REP(i, N - 1){
        FOR(j, i + 1, N){
            int d2 = 0;
            REP(k, D){
                d2 += (X[i][k] - X[j][k]) * (X[i][k] - X[j][k]);
            } 
            int d = (int)sqrt(d2);
            if(d * d == d2) cnt++;
        }
    }
    PRINT(cnt);
    return 0;
}

Measured memory_bytes: 256
N=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
C=list(map(int,input().split()))

ans=0
p=-100
for i in A:
	ans+=B[i-1]
	if (p+1)==i:
		ans+=C[p-1]
	p=i

print(ans)

Measured memory_bytes: 3064
n,p=map(int,input().split())
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])
    if temp!=1:
        arr.append([temp, 1])
    if arr==[]:
        arr.append([n, 1])
    return arr

l=factorization(p)
ans=1
for li in l:
    a=li[1]//n
    ans*=li[0]**a
print(ans)



Measured memory_bytes: 3188
//Use valgrind once if the submission doesn't go through. It can detect uninitialized variables and see where they could be an issue.
#include <bits/stdc++.h>
using namespace std;
int pCount(int n){
	int c=0;
	while(n){
		if(n&1) c++;
		n>>=1;
	}
	return c;
}
int main(){

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

	int N,p, p2=1, rp{0}, rm{0};
	string s;
	cin>>N>>s;
	vector<int> rem2p, rem2m, dp,ans;
	p=count(s.begin(),s.end(),'1');
	dp.resize(p+1);
	dp[0]=0;
	if(dp.size()>1)
		dp[1]=1;
	for(int i=2;i<dp.size();i++){
		dp[i]=1+dp[i%pCount(i)];
	}
	for(auto i=s.rbegin();i!=s.rend();i++){
		*i-='0';
		rem2p.push_back(p2);
		if(*i){
			rp+=p2;
			rp%=p+1;
		}
		p2<<=1;
		p2%=p+1;
	}
	if(p>1){
		p2=1;
		for(auto i=s.rbegin();i!=s.rend();i++){
			rem2m.push_back(p2);
			if(*i){
				rm+=p2;
				rm%=p-1;
			}
			p2<<=1;
			p2%=p-1;
		}
	}
	for(int i=0;i<s.size();i++){
		if(s[s.size()-1-i]&&p!=1){
			int t=rm-rem2m[i];
			if(t<0){
				t+=p-1;
			}
			ans.push_back(1+dp[t]);
		}
		else if(s[s.size()-1-i]&&p==1){
			ans.push_back(0);
		}
		else{
			int t=rp+rem2p[i];
			if(t>p){
				t-=p+1;
			}
			ans.push_back(1+dp[t]);
		}
	}
	for(auto i=ans.rbegin();i!=ans.rend();i++){
		cout<<*i<<'\n';
	}
}


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

int main(){
  int d=0;
  char a,b,c;
  cin>>a>>b>>c;
  if(a=='1')
    d++;
  if(b=='1')
    d++;
  if(c=='1')
    d++;
  cout<<d<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <utility>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <math.h>
#include <string.h>
#include <iomanip>
#include <numeric>
#include <cstdlib>
#include <cstdint>
#include <cmath>
#include <functional>
#include <limits>
#include <cassert>

using namespace std;

/* template */

using ll = long long;

void debug_out() { std::cout << std::endl; }
 
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cout << H << " ";
  debug_out(T...);
}

#ifdef LOCAL
#define debug(...) cout << "debug: "; debug_out(__VA_ARGS__)
#else
#define debug(...) 
#endif

#define rep(i, a, n) for (int i = (int)(a); i < (int)(n); i++)
#define rrep(i, a, n) for (int i = ((int)(n-1)); i >= (int)(a); i--)
#define Rep(i, a, n) for (long long i = (long long)(a); i< (long long)(n); i++)
#define RRep(i, a, n) for (long long i = ((long long)(n-1ll)); i>=(long long)(a); i--)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()

template <typename T>
std::ostream& operator<<(std::ostream& os, std::vector<T> vec) {
  for (std::size_t i = 0; i < vec.size(); i++)os << vec[i] << (i + 1 == vec.size() ? "" : " ");
  return os;
}

struct Edge{
    int to;
    int weight;
    Edge(int t, int w) : to(t), weight(w){ }
};

struct edge{
    int from;
    int to;
    int weight;
    edge(int f,int t,int w) : from(f), to(t), weight(w){ }
};


using Graph = vector<vector<Edge>>;
using graph = vector<vector<int>>;
using edges = vector<edge>;

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;
}

template <class T>
T lcm(T a, T b){
    return (a*b)/gcd(a,b);
}

bool isPalindrome(string s){
    string t = s;
    reverse(all(t));
    return s==t;
}

constexpr ll LNF = 1e18+7;

constexpr int INF = 1e9+7;

vector<int> dx = {-1,0,1,0,-1,1,-1,1};
vector<int> dy = {0,-1,0,1,1,-1,-1,1};

/* template */

graph g;
vector<int> dp;

int rec(int v){
    if(dp[v]!=-1) return dp[v];
    int res = 0;
    for(auto nv : g[v]){
        chmax(res,rec(nv)+1);
    }
    return dp[v] = res;
}

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n,m; cin >> n >> m;
    g.resize(n);
    rep(i,0,m){
        int x,y; cin >> x >> y;
        x--; y--;
        g[x].emplace_back(y);
    }
    dp.assign(n,-1);
    int ans = 0;
    rep(i,0,n){
        chmax(ans,rec(i));
    }
    cout << ans << endl;
}

Measured memory_bytes: 8192
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string a,b;
  cin >> a >> b;
  if (a.size()<b.size()){
    cout << "LESS" << endl;
  }
  else if (a.size()>b.size()){
    cout << "GREATER" << endl;
  }
  else {
    if (a<b){
      cout << "LESS" << endl;
    }
    else if (a>b){
      cout << "GREATER" << endl;
    }
    else {
      cout << "EQUAL" << endl;
    }
  }
}

Measured memory_bytes: 256
N=raw_input()
l=len(N)
 
s="375"


def func(n):
	#print "func ::: ", n
	ret=0
	if len(n) == 0 :
		ret+=func(n+"3")
		ret+=func(n+"5")
		ret+=func(n+"7")
	elif  int(n)<=int(N):
		for i in s:
			if i not in n:
				ret=0
				break
		else:
			ret=1

		ret+=func(n+"3")
		ret+=func(n+"5")
		ret+=func(n+"7")
	return ret

print func("")

Measured memory_bytes: 34664
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <iomanip>
#include <queue>
#include <deque>
#include <map>
#include <unordered_map>
#define rep(i,n) for(int i=0;i<n;i++)
#define repn(i,n) for(int i=1;i<=n;i++)
#define repr(e,x) for(auto& e:x)
using namespace std;
typedef long long ll;
typedef long double ld;
//typedef pair<int,int> P;
int const INF=1001001001;
ll const LINF=1001001001001001001;
ll const MOD=1000000007;

ll N,M;
ll s[100001];
ll dp[100001];

int main(){
    cin>>N>>M;
    rep(i,M){
        ll a;
        cin>>a;
        s[a]++;
    }

    dp[0]=1;
    if(s[1]!=1) dp[1]=1;
    for(int i=2;i<=N;i++){
        if(s[i]!=1) dp[i]=dp[i-1]+dp[i-2];
        dp[i]%=MOD;
    }

    cout<<dp[N]<<endl;
}

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


void solve(std::string S){
    S.at(3) = '8';
    cout << S << endl;
}

// Generated by 1.1.5 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    std::string S;
    std::cin >> S;
    solve(S);
    return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        String line = sc.nextLine();
        String[] line1 = line.split(" ");
        int a = Integer.parseInt(line1[0]);
        int b = Integer.parseInt(line1[1]);
        int k;
        if((a + b) % 2 == 1)    System.out.println("IMPOSSIBLE");
        else{
            k = (a + b) / 2;
            System.out.println(k);
        }
    }
}

Measured memory_bytes: 21716
#!/usr/bin/env python3
#ABC127 C

import sys
import math
import bisect
sys.setrecursionlimit(1000000000)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

n,m = LI()
L,R = 1,n
for _ in range(m):
    l,r = LI()
    if L < l:
        L = l
    if r < R:
        R = r
if R - L < 0:
    print(0)
else:
    print(R-L+1)


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

int dfs(int u, vector<vector<int> > &g, vector<int> &vis) {
    vis[u] = 1;
    int ans = 1;
    for(int v: g[u]) {
        if(!vis[v])
            ans += dfs(v, g, vis);
    }
    return ans;
}

void solve() {
    int N;
    cin>>N;
    int E;
    cin>>E;
 
    vector<vector<int> > adj(N+1);
    vector<int> count(N+1, 0); 
    vector<int> colors(N+1, 1); 
    set<pair<int, int> > edges;

    for(int i=0; i<E; i++) {
        int u, v;
        cin>>u>>v;
        if(edges.find({min(u, v), max(u, v)}) != edges.end())
            continue;
        adj[u-1].push_back(v-1);
        adj[v-1].push_back(u-1);
    }
    int ans = 0;

    vector<int> viss(N+1, 0);
    for(int i=0; i<N; i++) {
        if(!viss[i]) {
            ans = max(ans, dfs(i, adj, viss));
            count[i] = 1;
        }
    }

   cout << ans << endl; 
} 

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

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


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

    int ans = count(s.cbegin(), s.cend(), 'o');

    cout<<700+100*ans<<endl;

    return 0;
}




Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <random>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <numeric>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <sstream>
#include <bitset>
#include <cassert>
#include <fstream>
#include <queue>

#define len(X) ((int)(X).size())

#ifdef __LOCAL
	#define DBG(X) cout << #X << "=" << (X) << '\n';
#else
	#define DBG(X)
#endif

using std::cin;
using std::cout;
using std::vector;
using std::string;
using std::pair;
using std::swap;
using std::sort;
using std::lower_bound;
using std::unique;

using int64 = long long int;
using pii   = pair<int, int>;
using pii64 = pair<int64, int64>;

const int NIL = -1;
const int INF = (int)2e9;
const int64 INF64 = (int64)2e18;

void init_IO() {
	std::ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
}

void solve() {
	int64 ab, bc, ca;
	cin >> ab >> bc >> ca;

	cout << (ab * bc) / 2 << '\n';
}

int main() {
	init_IO();
	solve();

	return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics;

namespace Aoj.ALDS.Chapter5B
{
    class Program
    {
        public static int counter = 0;
        public static void Merge<T>(List<T> array, int left, int mid, int right)
        where T : IComparable<T>
        {
            int n1 = mid - left;
            int n2 = right - mid;

            if (n1 < 0 || n2 < 0)
            {
                throw new System.ArgumentException("");
            }

            var leftArray = new List<T>();
            var rightArray = new List<T>();
            for (int i = 0; i < n1; i++)
            {
                leftArray.Add(array[left + i]);
            }
            for (int i = 0; i < n2; i++)
            {
                rightArray.Add(array[mid + i]);
            }

            int lc = 0;
            int rc = 0;
            for (int i = left; i < right; i++)
            {
                // TODO ???????????§?????????????????§??????????????¨??????????????¨??\????????????????????¢??????????????????
                counter++;

                if (rc >= n2 || (lc < n1 && leftArray[lc].CompareTo(rightArray[rc]) <= 0))
                {
                    array[i] = leftArray[lc];
                    lc++;
                }
                else
                {
                    array[i] = rightArray[rc];
                    rc++;
                }
            }
        }

        public static void MergeSort<T>(List<T> array, int left, int right)
        where T : IComparable<T>
        {
            if (left + 1 < right)
            {
                int mid = (left + right) / 2;
                MergeSort(array, left, mid);
                MergeSort(array, mid, right);
                Merge(array, left, mid, right);
            }
        }

        public static void Solve()
        {
            Console.ReadLine();

            var list = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse).ToList();

            MergeSort(list, 0, list.Count());

            string answer = string.Join(" ", list.Select(i => i.ToString()).ToArray());
            Console.WriteLine(answer);
            Console.WriteLine(counter);
        }

        public static void Main()
        {
            // Console.SetIn(new System.IO.StreamReader("Aoj/AlgorithmsAndDataStructures/Input/05_Recursion_B_01.txt"));
            // var sw = new Stopwatch();
            // sw.Start();
            Solve();

            // Console.WriteLine("{0}ms", sw.ElapsedMilliseconds);
        }
    }
}

Measured memory_bytes: 101160
#include <stdio.h>

int tai(int x,int y){
		x = x*x+y*y;
		return x;
	}

int main(){
	int h,w,h1,w1;
	while(1){
		int ha=151,wa=151;
		scanf("%d %d",&h1,&w1);
		if((h1==0)&&(w1==0)){
			return 0;
		}

		for(h=1;h<150;h++){
			for(w=h+1;w<=150;w++){
				if(((tai(w,h) > tai(w1,h1)) && (tai(h,w) < tai(ha,wa)))  ||  
				  ((tai(w,h) > tai(w1,h1)) && (tai(h,w) == tai(ha,wa)) && (h<ha)) ||
				  ((tai(w,h) == tai(w1,h1)) && (tai(h,w) < tai(ha,wa)) && (h1<h)) ||
				  ((tai(w,h) == tai(w1,h1)) && (tai(h,w) == tai(ha,wa)) && (h1<h) && (h<ha))){
					ha = h;
					wa = w;
				}
				

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

	}
	return 0;
}

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

int dp[8001][16001];
int a[8001];

int main(){
	string s;
	int x,y;
	cin>>s>>x>>y;
	
	int k=0;
	int w=0;
	for(int i=0;i<s.size();i++){
		if(s[i]=='T'){
			k++;
			a[k]=w;
			w=0;
		}
		else{
			w++;
		}
	}
	k++;
	a[k]=w;
	
	//for(int i=1;i<=k;i++)cout<<a[i]<<endl;
	dp[1][a[1]+8000]=1;
	
	for(int i=3;i<=k;i+=2){
		for(int j=0;j<=16000;j++){
			if(j+a[i]<=16000)
				dp[i][j]=dp[i-2][j+a[i]];
			if(j-a[i]>=0)
				dp[i][j]=dp[i][j]||dp[i-2][j-a[i]];
		}
	}
	
	dp[0][8000]=1;
	for(int i=2;i<=k;i+=2){
		for(int j=0;j<=16000;j++){
			if(j+a[i]<=16000)
			dp[i][j]=dp[i-2][j+a[i]];
			if(j-a[i]>=0)
			dp[i][j]=dp[i][j]||dp[i-2][j-a[i]];
		}
	}
	
	int ans;
	if(k%2==0){ 
		ans=dp[k][y+8000]&&dp[k-1][x+8000];
	}
	else{
		ans=dp[k][x+8000]&&dp[k-1][y+8000];
	}
	
	cout<<(ans==0?"No":"Yes");
	return 0;
}

Measured memory_bytes: 497792
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
#define debug(a) cout<<a<<endl
#define clr(a) memset(a,0,sizeof(a))
#define clrne(a) memset(a,-1,sizeof(a))
#define clrinf(a) memset(a,0x3f,sizeof(a))
#define clrneinf(a) memset(a,0xc0,sizeof(a))
#define pb(a) push_back(a)
#define maxn 10001
#define mod 1000000007
#define eps 1e-9
#define inf 0x7fffffff
int a;
char s[100];
int main()
{
//  freopen("in.txt","r",stdin);
//  freopen("out.txt","w",stdout);
    cin>>a>>s;
    cout<<2018<<s<<endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
using namespace std;
int s,n,a[100000001],sum;
int main()
{
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		cin>>a[i];
	}
	for(int i=1;i<=n;i++)
	{
		if(a[i]==i)
		{
			if(i==1)
			{
				s=a[i];
				a[i]=a[i+1];
				a[i+1]=s;
				sum++;
			}
			if(i==n)
			{
				s=a[i];
				a[i]=a[i-1];
				a[i-1]=s;
				sum++;
			}
			if(i!=1&&i!=n)
			{
				s=a[i];
				a[i]=a[i+1];
				a[i+1]=s;
				sum++;
			}
		}
		//cout<<sum<<endl;
	}
	cout<<sum;
	return 0;
}


Measured memory_bytes: 640
typedef long long ll;

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

#include <queue>
#include <iostream>
#include <cstdio>
inline int getInt(){ int s; scanf("%d", &s); return s; }

#include <set>
using namespace std;

ll dp[100001][10];
int dbl[10] = {
  0, 2, 4, 6, 8, 1, 3, 5, 7, 9
};

int main(){
  const int n = getInt();
  string s;
  cin >> s;

  const int m = getInt();
  vector<int> a(10);
  REP(i,m) a[getInt()] = 1;

  dp[0][0] = 1;
  REP(i,n) REP(j,10){
    REP(k,10) if((s[i] == '*' && a[k]) || s[i] == '0' + k){
      int next = j;
      if((n - i) % 2 == 0){
	next += dbl[k];
      }else{
	next += k;
      }
      dp[i + 1][next % 10] += dp[i][j];
    }
  }

  cout << dp[n][0] << endl;

  return 0;
}

Measured memory_bytes: 9172
#include <iostream>
#include <iomanip>
#include <bits/stdc++.h>
#include <vector>
#include <iterator>
#include <string>
#define pan(i,n) for(int i=0;i<n;i++)
#define ll long long int
#define vi vector<int>
#define pb push_back
#define INF 1e9+7
#define PI 3.141592653
using namespace std; 
 


int main() {
    int n,count=0,m2=0;
    cin>>n;
    ll a[n];
    pan(i,n) {cin>>a[i];
        if(a[i]%4==0) count++;
        if(a[i]%2==0 && a[i]%4!=0) m2++;
    }
    int ans=(2*count)+m2;
    if(m2==0 && count>=n/2) cout<<"Yes";
    else if(count==0 && m2==n) cout<<"Yes";
    else if(count!=0 && m2!=0 && ans>=n) cout<<"Yes";
    else cout<<"No";
} 

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

using ll = long long;
using db = double;
using pii = pair < int, int >;
using pll = pair < ll, ll >;
const int N = 2e5 + 10;
const ll inf = 1e15 + 42;
#define endl "\n"
int n;
int arr[3005];

void testCase() {
    cin >> n;
    for (int i=1; i<=n; i++)
        cin >> arr[i];
    ll dp[n+2][n+2];
    for (int i=1; i<=n; i++) {
        for (int j=1; j<i; j++)
            dp[i][j] = 0;
        dp[i][i] = arr[i];
    }    
    for (int len=1; len<n; len++) {
        int i=1;
        int j=i+len;
        while (j<=n) {
            dp[i][j] = max (arr[i]-dp[i+1][j], arr[j]-dp[i][j-1]);
            i++;
            j++;
        }
    }
    cout << dp[1][n] << endl;
}

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

Measured memory_bytes: 70656
import sys

input = sys.stdin.readline


def main():
    s = input().rstrip()

    idx_A = s.find("A")
    idx_Z = (len(s) - 1) - s[::-1].find("Z")
    ans = idx_Z - idx_A + 1
    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 3516
#include <iostream>
#include <string>
#include <algorithm>
#include <ctime>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <cassert>
#include <bitset>
#include <list>
#include <cstdio>
#include <stdio.h>
#include <string.h>
#include <limits.h>
#include <math.h>
#include <cmath>
#define rep(i,m,n) for(int i=m; i<(n); i++)
#define rrep(i,n,m) for(ll i=n;i>=m;i--)
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pll;
typedef pair<int, int> pii;
ll inf=1LL<<60;
double eps=1e-14;

int main()
{
    double w, h, x, y;
    cin >> w >> h >> x >> y;
    double ans1 = w/2*h;
    int ans2;
    if(x==w/2 && y==h/2) ans2=1;
    else ans2=0;
    cout << ans1 << " " << ans2 << endl;
    return 0;
}


Measured memory_bytes: 256
import Foundation

let input = readLine()!.split(separator: " ").map { Double($0)! }
let A = input[0]
let B = input[1]
let H = input[2]
let M = input[3]

let angleH = 30 * H + 0.5 * M
let angleM = 6 * M
var angle = abs(angleH - angleM)
angle = min(angle, 360 - angle)

let result: Double = (A * A + B * B - 2 * A * B * cos(angle * Double.pi / 180)).squareRoot()
print(result)


Measured memory_bytes: 13668
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
int main() {
    int N,M,X;
    cin >> N >> M >> X;
    vector<int> a(M);
    for(int i=0; i<M; i++){
        cin >> a.at(i);
    }
    int ans_0 = 0;
    int ans_N = 0;
    for(int i=0;i<M;i++){
        if(a.at(i) < X){
            ans_0 += 1;
        }
        else{
            ans_N += 1;
        }
    }
    if(ans_0 < ans_N){
        cout << ans_0 << endl;
    }
    else{
        cout << ans_N << endl;
    }
}



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

using namespace std;
using ll = long long;

#pragma region Macros
#define FOR(i, m, n) for (ll i = (ll)(m); i < (ll)(n); i++)
#define rep(i, n) FOR(i, 0, n)

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 (a > b) { a = b; return true; } return false; }

template <class T> string join(const T &v, const string delim = ",")
{
    if (v.empty())
        return "";

    ostringstream res;
    res << v[0];
    for (int i = 1; i < v.size(); i++)
    {
        res << delim << v[i];
    }
    return res.str();
}

#pragma endregion Macros

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

    int N = S.size() + 1;
    vector<int> ans(N,-1);

    if (S[0] == '<') ans[0] = 0;
    if (S[S.size() - 1] == '>') ans[ans.size() - 1] = 0;

    for(int i=0;i<S.size()-1;i++){
//        cerr << S[i] << "," << S[i + 1] << endl;
        if (S[i] == '>' && S[i + 1] == '<') {
            ans[i + 1] = 0;
        }
    }
//    cerr << join(ans) << endl;

    for(int i=0;i<S.size();i++){
        if (S[i] == '<' && ans[i] >= 0) ans[i + 1] = ans[i] + 1;
    }

//    cerr << join(ans) << endl;

    for (int i = S.size()-1;i>=0;i--){
        if (S[i] == '>' && ans[i + 1] >= 0) chmax(ans[i], ans[i + 1] + 1);
    }

//    cerr << join(ans) << endl;

    ll res = 0;
    for(auto n : ans){
        res += n;
    }

    cout << res << endl;

}


Measured memory_bytes: 5780
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var stdInScanner = bufio.NewScanner(os.Stdin)

func nextInt() int {
	stdInScanner.Scan()
	i, _ := strconv.Atoi(stdInScanner.Text())
	return i
}

func main() {
	stdInScanner.Split(bufio.ScanWords)

	N := nextInt()

	var a int
	for i := 0; i < N; i++ {
		a = nextInt()
		if a%2 == 0 {
			if a%3 != 0 && a%5 != 0 {
				fmt.Println("DENIED")
				return
			}
		}
	}
	fmt.Println("APPROVED")
}


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

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

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

bool check(ll n, ll x) {
    while (n % x == 0)
        n /= x;
    return (n % x == 1);
}

int main() {
    ios::sync_with_stdio(false);cin.tie(nullptr);
    ll n; cin >> n;
    if (n == 2) {
        cout << 1;
        return 0;
    }
    set<ll> ans;
    ll t = n - 1;
    ans.insert(n - 1);
    for (ll i = 2; i * i <= t; ++i) {
        if (t % i == 0) {
            ans.insert(i);
            ans.insert(t / i);
        }
    }

    ans.insert(n);
    for (ll i = 2; i * i <= n; ++i) {
        if (n % i == 0) {
            if (check(n, i))
                ans.insert(i);
            if (check(n, n / i))
                ans.insert(n / i);
        }
    }
    assert(!ans.count(1));
    cout << ans.size() << '\n';
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
template <typename X> ostream& operator << (ostream& x,const vector<X>& v){for(ll i=0;i<v.size();++i) x<<v[i]<<" ";return x;}
template <typename X> ostream& operator << (ostream& x,const set<X>& v){for(auto it:v) x<<it<<" ";return x;}
template <typename X, typename Y> ostream& operator << (ostream& x, const pair<X,Y>& v) {x<<v.ff<<" "<<v.ss;return x;}
template <typename T, typename S> ostream& operator << (ostream& os, const map<T, S>& v) { for (auto it : v) os << it.first << "=>" << it.second << endl; return os; }
struct pair_hash {inline std::size_t operator()(const std::pair<ll, ll> & v) const {return v.first*31+v.second;}};
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define speed ios_base::sync_with_stdio(false);cin.tie(NULL)
#define pb push_back
#define fr first
#define sc second
#define prnt(m) for(auto it = m.begin() ; it != m.end() ; ++it){cout<<*it<<endl;}
#define tra(it,m) for(auto it=m.begin();it!=m.end();++it)
#define DBG(x) cout<<"# # #     "<<x<<'\n';
#define fri(i,s,n) for(long long i=s;i<n;i++)
#define mod 1000000007LL
#define mod2 998244353
#define vct2 vector<vector<ll>>
#define vct vector<ll>
#define pll pair<ll,ll>
#define rz(n) resize(n)
#define all(v) v.begin(),v.end()
#define mkp make_pair
#define arrin(a,n) for(ll i = 0; i < n ; i++){cin>>a[i];}
#define arrout(a,n) for(ll i = 0;i < n; i++){cout<<a[i]<<" ";}
#define ex(s) cout<<s<<endl,exit(0);
#define infy 2e18
#define five 100005;
#define six 1000005;
#define printclock cerr<<"Time : "<<1000*(ld)clock()/(ld)CLOCKS_PER_SEC<<"ms\n";
//___________________________________________________________________________________________________________________________________________________________
int main(){
       int n,m;
       cin>>n>>m;
       int xx = n*(n-1)/2;
       xx += (m)*(m-1)/2;
       cout<<xx<<endl;
}


Measured memory_bytes: 256
using System;


public class D{
	
	public static void Main(){
	
		string[] args;
		
		args = Console.ReadLine().Split(' ');
		int N = Int32.Parse( args[0] );
		int M = Int32.Parse( args[1] );
		int Q = Int32.Parse( args[2] );
		
		int[,] train = new int[N+1, N+1];
		int[,] csum = new int[N+1, N+1];
		for( int i = 0; i <= N; i++ ){
			for( int j = 0; j <= N; j++ ){
				train[i,j] = 0;
				csum[i,j] = 0;
			}
		}
		
		for( int i = 0; i < M; i++ ){
			args = Console.ReadLine().Split(' ');
			int L = Int32.Parse( args[0] );
			int R = Int32.Parse( args[1] );
			train[L,R]++;
		}
				
		for( int i = 1; i <= N; i++ ){
			for( int j = 1; j <= N; j++ ){
				csum[i,j] = csum[i,j-1] + train[i,j];
			}
		}
		for( int i = 1; i <= N; i++ ){
			for( int j = 1; j <= N; j++ ){
				csum[i,j] += csum[i-1,j];
			}
		}
		
		int[] result = new int[Q];
		for( int i = 0; i < Q; i++ ){
			args = Console.ReadLine().Split(' ');
			int p = Int32.Parse( args[0] );
			int q = Int32.Parse( args[1] );
			result[i] = csum[q,q] + csum[p-1,p-1] - csum[p-1,q] - csum[q,p-1];
		}
		
		for( int i = 0; i < Q; i++ ){
			Console.WriteLine(result[i]);
		}
		
	}

}

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

#define int long long
#define fi first
#define se second
#define pb push_back
#define ins insert
#define er erase

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

const int oo = 1e18 + 7, mod = 1e9 + 7;

int k, a, b;

signed main(){
	ios_base::sync_with_stdio(0);
	cin >> k >> a >> b;
	if(!(a % k)){
		cout << "OK";
		return 0;
	}
	a = (a/k + 1) * k;
	if(a <= b) cout << "OK\n";
	else cout << "NG\n";
}

/*
TEST HERE
INPUT #1

OUTPUT #1

INPUT #2

OUTPUT #2

INPUT #3

OUTPUT #3
*/


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

public class Main {

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

		while(true){
			double n_1 = sc.nextDouble();
			double e_1 = sc.nextDouble();
			double n_2 = sc.nextDouble();
			double e_2 = sc.nextDouble();
			
			if(n_1 == -1 && e_1 == -1 && n_2 == -1 && e_2 == -1){
				break;
			}
			
			System.out.println((int)((6378.1 * Math.acos((Math.cos((90 - n_1) / 180 * Math.PI) * 
			Math.cos((90 - n_2) / 180 * Math.PI) + 
			Math.sin((90 - n_1) / 180 * Math.PI) * 
			Math.sin((90 - n_2) / 180 * Math.PI) *
			Math.cos((e_2 - e_1) / 180 * Math.PI))) + 0.5)));
		}
	}
}

Measured memory_bytes: 12000
#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 >= 0 && x + r <= W && y - r >= 0 && y + r <= H){
		printf("Yes\n");
	} else{
		printf("No\n");
	}

	return 0;
}

Measured memory_bytes: 1816
#include <stdio.h>

int main(void)
{
  char code[15],str[15];
  int i;

  scanf("%s",code);

  for(i = 0;i < 4;i++)
    str[i] = code[i];

  str[4] = ' ';

  for(i = 5;i < 13;i++)
    str[i] = code[i - 1];

  str[13] = '\0';

  printf("%s\n",str);

  return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<math.h>
#include<algorithm>
#include<utility>
#include<queue>
#include<string.h>
#include<string>
#include<set>
#include<map>
#include<vector>
using namespace std;
typedef long long LL;
typedef pair<int, int> P;
int H,W;
int c[11][11];

int Calc(int h1,int w1,int h2,int w2){
    int minWall=10;
    for(int i=w1;i<=w2;i++){//上辺
        minWall=min(minWall,c[h1][i]);
    }
    for(int i=h1;i<=h2;i++){//右辺
        minWall=min(minWall,c[i][w2]);
    }
    for(int i=w1;i<=w2;i++){//下辺
        minWall=min(minWall,c[h2][i]);
    }
    for(int i=h1;i<=h2;i++){//左辺
        minWall=min(minWall,c[i][w1]);
    }
    int ans=0;
    for(int i=h1+1;i<h2;i++){
        for(int j=w1+1;j<w2;j++){
            if(c[i][j]>=minWall){
                return 0;
            }else{
                ans+=minWall-c[i][j];
            }
        }
    }
    return ans;
}
int main(){
    
    while(cin>>H>>W,H!=0){
        for(int i=0;i<H;i++){
            for(int j=0;j<W;j++){
                cin>>c[i][j];
            }
        }
        int ans=0;
        for(int i=0;i<H-2;i++){
            for(int j=0;j<W-2;j++){
                for(int k=i+2;k<H;k++){
                    for(int l=j+2;l<W;l++){
                        ans=max(ans,Calc(i,j,k,l));
                    }
                }
            }
        }
        cout<<ans<<endl;
    }
    return 0;
}


Measured memory_bytes: 3068
import java.util.*;
import java.io.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
		String s = sc.next();
		if (s.toUpperCase() == s) {
			System.out.println('A');
		} else {
			System.out.println('a');
		}
	}
}

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

// @@ !! LIM()

int main(/* int argc, char *argv[] */) {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout << setprecision(20);

  ll N; cin >> N;
  vector<ll> A(N+1);
  for (ll i = 1; i <= N; i++) cin >> A[i];
  vector<ll> v(N+1);
  ll nball = 0;
  for (ll i = N; i >= 1; i--) {
    ll cnt = 0;
    for (ll j = i + i; j <= N; j += i) {
      cnt += v[j];
    }
    if (A[i] != cnt % 2) {
      v[i] = 1;
      nball++;
    }
  }
  cout << nball << endl;
  bool first = true;
  for (ll i = 1; i <= N; i++) {
    if (!v[i]) continue;
    if (first) {
      first = false;
    }else {
      cout << " ";
    }
    cout << i;
  }
  cout << endl;

  return 0;
}



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

#define ll long long
int main() {
  ll W, H, x, y;
  cin >> W >> H >> x >> y;
  
  printf("%lf", (double)W * (double)H /2);
  cout << " ";
  
  if (W % 2 == 0 && x == W/2 && H % 2 == 0 && y == H/2) {
    cout << 1 << endl;
  } else {
    cout << 0 << endl;
  }
    
}

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

ll mod = 1e9 + 7;
ll mul[300005];

ll binpow(ll a,ll n) {
	if(n==0) return 1ll;
	if(n==1) return a;
	ll t = binpow(a,n/2);
	t = (t * t) % mod;
	if(n%2==1) return (t*a)%mod;
	else return t%mod; 
}

void prepare() {
	mul[0] = mul[1] = 1ll;
	for(ll i=2;i<=300000;i++) {
		mul[i] = (mul[i-1]*i)%mod;
	}
}

ll C(ll k,ll n) {
	ll div = (binpow(mul[k],mod - 2) * binpow(mul[n-k],mod - 2)) % mod;
	return (mul[n] * div) % mod;	
}

main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	prepare();
	ll w,h,a,b;	cin>>h>>w>>a>>b;
	ll i=h-a;
	ll ans = 0;
	for(ll j=b+1;j<=w;j++) {
		ans += (C(j-1,i+j-2)*C(w-j,w+h-i-j-1))%mod;
	}
	cout<<ans%mod;
}

Measured memory_bytes: 2560
n,k,q = map(int,input().split())

scores = {}
for i in range(n):
    scores[i+1] = k-q
for elem in [int(input()) for i in range(q)]:
    scores[elem] += 1

for k,v in scores.items():
    if v > 0:
        print('Yes')
    else:
        print('No')

Measured memory_bytes: 19432
def dijkstra():
    N = input()
    M = [ [float('inf')] * N for i in xrange(N)]
    color = [0] * N
    d = [float('inf')] * N
    p = [-1] * N

    d[0] = 0
    p[0] = -1

    for i in xrange(N):
        l = map(int, raw_input().split())

        for j in xrange(l[1]):
            M[i][l[2 * (j+1)]] = l[2 * (j+1) + 1]

    while 1:
        mincost = float('inf')
        for i in xrange(N):
            if color[i] != 2 and d[i] < mincost:
                mincost = d[i]
                u = i

        if mincost == float('inf'):
            break

        color[u] = 2

        for v in xrange(N):
            if color[v] != 2 and M[u][v] != float('inf'):
                if d[u] + M[u][v] < d[v]:
                    d[v] = d[u] + M[u][v]
                    p[v] = u
                    color[v] = 1

    for i in xrange(N):
        if d[i] == float('inf'):
            d[i] = -1
        print i,d[i]

if __name__ == '__main__':
    dijkstra()

Measured memory_bytes: 6548
#include <iostream>
#include <iomanip>
#include <cmath>
#include <vector>
#include <queue>
#include <limits>
#include <algorithm>
#include <set>
#include <string>
using namespace std;

static int32_t A, B, C, D;
static vector<vector<double>> memo;

static double get_concentration(int32_t water, int32_t sugar)
{
	return water + sugar == 0 ? 0.0 : sugar / (water * 100.0 + sugar);
}

static double dp(int32_t water, int32_t sugar)
{
	if (memo[water][sugar] >= 0.0)
		return memo[water][sugar];

	double res = get_concentration(water, sugar);
	res = max(res, dp(water + A, sugar));
	res = max(res, dp(water + B, sugar));
	res = max(res, dp(water, sugar + C));
	res = max(res, dp(water, sugar + D));
	memo[water][sugar] = res;
	return memo[water][sugar];
}

int main()
{
	int32_t E, F;
	cin >> A >> B >> C >> D >> E >> F;

	memo.resize(F + 1);
	for (int32_t i = 0; i < F + 1; i++) {
		memo[i].resize(F + 1);
		fill(begin(memo[i]), end(memo[i]), -1.0);
	}
	for (int32_t water = 0; water < F + 1; water++) {
		for (int32_t sugar = 0; sugar < F + 1; sugar++) {
			if (water * 100 + sugar > F || water * E < sugar)
				memo[water][sugar] = 0.0;
		}
	}

	double _max = dp(0, 0);
	for (int32_t water = 0; water < F + 1; water++) {
		for (int32_t sugar = 0; sugar < F + 1; sugar++) {
			if (memo[water][sugar] == _max && get_concentration(water, sugar) == _max) {
				if (water == 0 && sugar == 0)
					water = A;
				cout << (water * 100 + sugar) << " " << sugar << endl;
				return 0;
			}
		}
	}

	return 0;
}

Measured memory_bytes: 65280