akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <queue>
#include <map>
#include <numeric>
#include<iomanip>

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define all(x) (x).begin(),(x).end()

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

typedef long long ll;

using namespace std;

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  //cout<<setprecision(10);
  int H,W,h,w;
  cin>>H>>W;
  cin>>h>>w;
  cout<<(H-h)*(W-w)<<endl;

  return 0;

}


Measured memory_bytes: 892
#include<cstdio>
#include<cstring>
#include<vector>
using namespace std;
  int n,box[30];
  char s[200010],t[200010];
int main(){

  vector<int> vs[30];
  vector<int> vt[30];
  scanf("%s",s);
  scanf("%s",t);
  n=strlen(s);
  for(int i=0;i<n;i++){
    vs[s[i]-'a'].push_back(i);
    vt[t[i]-'a'].push_back(i);
  }
  for(int i=0;i<30;i++){
    for(int j=1;j<vs[i].size();j++)
      if(t[vs[i][0]]!=t[vs[i][j]]){
        printf("No\n");
        return 0;
      }
    for(int j=1;j<vt[i].size();j++)
      if(s[vt[i][0]]!=s[vt[i][j]]){
        printf("No\n");
        return 0;
      }
  }
  printf("Yes\n");
}
  

Measured memory_bytes: 3072
#include<iostream>
#include<cstdio>

using namespace std;

int main()
{
    long long N, A, B, counter = 0;
    scanf("%lld %lld %lld", &N, &A, &B);
    if(A == 0)
    {
        printf("0\n");
        return 0;
    }

    long long t = N / (A + B);
    counter = t * A;
    if((N - t * (A + B)) / A > 0)
    {
        counter += A;
    }
    else
    {
        counter += N - t * (A + B);
    }

    printf("%lld\n", counter);
    return 0;
}


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

using namespace  std;

bool c[26];
int xc[100002];
int main() {
  string s;

  cin >> s;

  string tmp;
  int k = 0;

  for(int i = 0; i < s.size(); i++) {
    if(s[i] != 'x') {
      tmp += s[i];
      k++;
    }
  }
  string s1,s2;
  if(tmp.size() % 2 == 1) {
  s1 = tmp.substr(0,k/2); 
  s2 = tmp.substr(k/2+1);
  }
  else {
  s1 = tmp.substr(0,k/2);
  s2 = tmp.substr(k/2);
  }

  reverse(s2.begin(),s2.end());

  if(s1 != s2) {
    cout << "-1" << endl;
    return 0;
  }

  int t = 0;
  for(int i = 0; i < s.size(); i++) {
    if(s[i] != 'x') { t++; continue; }
    xc[t]++;
    }
  int ans = 0;

  for(int i = 0; i <= t / 2; i++) {
    if(tmp.size() % 2 == 0 && i == t / 2) continue;
    ans += max(xc[i],xc[t-i]) - min(xc[i],xc[t-i]);
  }

  cout << ans<< endl;
}

    
   
    


Measured memory_bytes: 768
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000
#define int long long

signed main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N; cin >> N;
    int a[51];
    rep(i, N) cin >> a[i];
    int ans = 0;
    while(true) {
        int idx = 0;
        rep(i, N) {
            if (a[idx] < a[i]) 
                idx = i;
        }
        if (a[idx] < N) {
            cout << ans << endl;
            return 0;
        }
        int cnt = a[idx]/N;
        ans += cnt;
        a[idx] -= cnt * N;
        rep(i, N) {
            if (i != idx) a[i] += cnt;
        }
    }

    return 0;
}


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

#define rep(i,n) for(int i=0 ; i<(n) ; i++)
#define repr(i,n) for(int i=(n) ; i>=0 ; i--)
#define ALL(x) (x).begin(),(x).end()

using ll = long long;
using ull = unsigned long long;
 
const ll INF = 1LL<<60;
const int MINF = 1e9;
const int MOD = 1e9+7;

using vi = vector<int>;
using vii = vector<vi>;

template<typename T> bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<typename T> bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

template<typename T>
T GCD(T a,T b){ return b ? GCD(b,a%b) : a ;}
template<typename T>
T LCM(T a,T b){ return a*b / GCD(a,b) ;}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int n,m;cin >> n >> m;
    vi h(n);
    rep(i,n){
        cin >> h[i];
    }
    vii edge(n);
    rep(i,m){
        int a,b;cin >> a >> b;
        a--;b--;
        edge[a].push_back(b);
        edge[b].push_back(a);
    }

    int ans = 0;
    for(int i=0;i<n;i++){
        if(edge[i].size() == 0){
            ans++;
            continue;
        }
        bool flag = true;
        for(int j=0;j<edge[i].size();j++){
            if(h[i]<=h[edge[i][j]]){
                flag = false;
                break;
            }
        }
        if(flag)ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 8740
#include <algorithm>
#include <iostream>
#include <math.h>
#define ll long long int
#define FOR(i, a, b) for (ll i = (ll)(a); i < (ll)(b); i++)
#define REP(i, n) FOR(i, 0, n)
#define REP1(i, n) FOR(i, 1, n)

using namespace std;

int main() {
    int n, d;
    cin >> n >> d;
    if (n % (d * 2 + 1) == 0)
        cout << n / (d * 2 + 1) << endl;
    else
        cout << n / (d * 2 + 1) + 1 << endl;

    return 0;
}


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

int main(){
  int N;
  cin >> N;
  vector<int> X(N);
  for(int i=0;i<N;i++){
    cin >> X[i];
  }
  
  int sum=0;
  
  for(int i=0;i<N;i++){
    sum=sum+X[i];
  }
  
  
  int a=sum/N;
  
  int ans=0;
  
  int anss=0;
  
  for(int i=0;i<N;i++){
    ans=ans+(a-X[i])*(a-X[i]);
  }
  
  for(int i=0;i<N;i++){
    anss=anss+(a-X[i]+1)*(a-X[i]+1);
  }
  
  cout << min(ans,anss) << endl;
}
  

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

using namespace std;

int main() {
    cin.tie(0);
    cout.tie(0);
    ios_base::sync_with_stdio(0);
    string s;
    cin >> s;
    if(s == "AAA" || s== "BBB")
        cout<< "No\n";
    else
        cout<<"Yes\n";
}

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

#define printl(s) cout << s << endl;
#define print(s) cout << s << endl; return 0;
#define printFix(n,i) cout << fixed << setprecision(i) << n << endl; return 0;
#define yes cout << "Yes" << endl; return 0;
#define no cout << "No" << endl; return 0;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rep2(i,n) for (int i = 1; i < (n)+1; ++i)
#define bitrep(i,n) for (int i = 0; i < (1<<(n));i++)
#define isOne(bit,i) (bit & (1 << i))
using ll = long long;
using pii = pair<int, int>;
using si = set<int>;

const ll modSeed = pow(10,9) + 7;
const int INF = 100'000'000;

template <typename T>
vector<T> getValues(ll num){
    vector<T> values(num);
    for(ll i=0;i<num;i++){
        cin >> values.at(i);
    }
    return values;
}

string S;
ll X,K,D,ans;

int main(){
  cin >> K;
  if(K%2==0){
    print(-1);
  }
  ll tg = 0;

  for(ll i=1;i<=K;i++){
    tg = (tg * 10 + 7) %K;
    ans++;
    if(tg==0){
      print(ans);
    }
  }
  print(-1);
}


Measured memory_bytes: 3608
import java.util.*;

public class Main 
{
	static List<Integer> list = new ArrayList<Integer>();
	static void primeCalc()
	{
		boolean[] isPrime = new boolean[1000000];
		for(int i = 0; i < isPrime.length; ++i)
		{
			isPrime[i] = true;
		}
		isPrime[0] = isPrime[1] = false;
		for(int i = 2; i < isPrime.length; ++i)
		{
			if(isPrime[i])
			{
				list.add(i);
				for(int j = 2 * i; j < isPrime.length; j += i)
				{
					isPrime[j] = false;
				}
			}
		}
	}
	
	public static void main(String[] args) 
	{
		primeCalc();
		Scanner stdIn = new Scanner(System.in);
		while(stdIn.hasNext())
		{
			int n = stdIn.nextInt();
			int ans = 0;
			for(int i = 0; i < list.size(); ++i)
			{
				if(list.get(i) <= n)
				{
					++ans;
				}
				else
				{
					break;
				}
			}
			System.out.println(ans);
		}
	}
}

Measured memory_bytes: 15000
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <iomanip>
using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<string> VS;
typedef vector< vector<int> > VVI;
typedef vector< vector<ll> > VVL;
typedef pair<int,int> PII;
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(a) (a).begin(),(a).end()
#define pb push_back
#define mp make_pair
#define ub upper_bound
#define lb lower_bound
 
int main(){
  string S;
  cin>>S;
  if(S[0]=='0' or S[S.size()-1]=='1'){
    cout<<-1<<endl;
    return 0;
  }
  rep(i,(S.size()-1)/2){
    if(S[i]!=S[S.size()-2-i]){
      cout<<-1<<endl;
      return 0;
    }
  }
  int X=1;
  rep(i,S.size()-1){
    cout<<X<<" "<<i+2<<endl;
    if(S[i]=='1') X=i+2;
  }
}

Measured memory_bytes: 1664
#input of int(split by space)
def get_i()
  return gets.chomp.split(" ").map(&:to_i)
end
#input of float(split by space)
def get_f()
  return gets.chomp.split(" ").map(&:to_f)
end
#input of string(split by space)
def get()
  return gets.chomp.split(" ")
end
#input of string(split per one character)
def get_nsp()
  return gets.chomp.split("")
end
#yes or no decision
def yn_judge(bool,y="Yes",n="No")
  return bool ? y : n 
end
#create of array
def array(size1,init=nil,size2=-1)
  if size2==-1
      return Array.new(size1){init}
  else
      return Array.new(size2){Array.new(size1){init}}
  end
end

def max(a,b)
    return a>b ? a : b
end

def min(a,b)
    return a>b ? b : a
end

INF=Float::INFINITY

N=gets.to_i
a=array(N)
N.times do|i|
    a[i]=gets.to_i
end
a.sort!{|x,y| y<=>x}
if N==3
  puts max(a[0]-a[2]+a[1]-a[2],a[0]-a[1]+a[0]-a[2])
  exit
end
ans=0
if N.odd?
    ans=max(ans,(a[0..N/2-1].inject(:+)*2-(a[N/2..N-1].inject(:+)*2-a[N/2]-a[N/2+1])).abs)
else
    ans=max(ans,((a[0..N/2-1].inject(:+)*2-a[N/2-1])-(a[N/2..N-1].inject(:+)*2-a[N/2])).abs)
end
a.reverse!
if N.odd?
    ans=max(ans,(a[0..N/2-1].inject(:+)*2-(a[N/2..N-1].inject(:+)*2-a[N/2]-a[N/2+1])).abs)
else
    ans=max(ans,((a[0..N/2-1].inject(:+)*2-a[N/2-1])-(a[N/2..N-1].inject(:+)*2-a[N/2])).abs)
end
puts ans

Measured memory_bytes: 15888
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;

class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());

        for (int i = 0; i < n; i++) {
            String res = "NA";
            String sna = br.readLine();

            if (sna.length() < 6) {
                System.out.println(res);
                continue;
            }

            if (sna.startsWith(">\'")) {
                sna = sna.substring(2);
                if (sna.startsWith("=")) {
                    int eq1 = 0;
                    for (char c : sna.toCharArray()) {
                        if (c == '=')
                            eq1++;
                        else
                            break;
                    }
                    sna = sna.substring(eq1);
                    if (sna.startsWith("#")) {
                        sna = sna.substring(1);
                        int eq2 = 0;
                        for (char c : sna.toCharArray()) {
                            if (c == '=')
                                eq2++;
                            else
                                break;
                        }

                        if (eq1 == eq2) {
                            sna = sna.substring(eq2);
                            if (sna.equals("~")) {
                                res = "A";
                            }
                        }
                    }
                }
            } else if (sna.startsWith(">^")) {
                sna = sna.substring(2);
                int q = 0;
                while (sna.startsWith("Q=")) {
                    sna = sna.substring(2);
                    q++;
                }
                if (q > 0) {
                    if (sna.equals("~~")) {
                        res = "B";
                    }
                }
            }

            System.out.println(res);
        }
    }
}


Measured memory_bytes: 31536
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
#define rep(i, begin, n) for (int i = begin; i < n; i++)
#define repe(i, begin, n) for (int i = begin; i <= n; i++)
#define repr(i, begin, n) for (int i = begin; i > begin - n; i--)
#define repre(i, begin, end) for (int i = begin; i >= end; i--)

template <class T>
inline bool chmax(T &a, T b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}

template <class T>
inline bool chmin(T &a, T b)
{
    if (a > b)
    {
        a = b;
        return 1;
    }
    return 0;
}

const int inf = 1000000007;
const int MOD = 1000000007;
const long long INF = 1000000000000000007;

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

ll N, K;
ll x[101010];

int main()
{
    cin >> N >> K;
    int neg = 0;
    int pos = 0;
    rep(i, 0, N)
    {
        cin >> x[i];
        if (x[i] < 0)
        {
            neg++;
        }
        else if (x[i] == 0)
        {
            neg++;
            pos++;
        }
        else
        {
            pos++;
        }
    }
    ll ans = INF;
    for (int i = 0; i < N - (K - 1); i++)
    {
        ll l = x[i];
        ll r = x[i + K - 1];
        if (r < 0)
        {
            chmin(ans, abs(l));
        }
        else if (l > 0)
        {
            chmin(ans, abs(r));
        }
        else
        {
            chmin(ans, min(2 * abs(l) + abs(r), abs(l) + 2 * abs(r)));
        }
    }
    cout << ans << endl;
}


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

static long long N = 200000, M, L = -1, R = 1000000001, A[100010] = {}, BIT[200010] = {};
vector<long long> V;

void Add(int X, long long Y) {
	for (int i = X; i <= N + 1; i += i & -i) BIT[i] += Y;
}

long long Sum(int X) {
	long long Ret = 0;
	for (int i = X; i > 0; i -= i & -i) Ret += BIT[i];
	return Ret;
}

int main() {
	cin >> M;
	for (int i = 0; i < M; i++) cin >> A[i];
	while (R - L > 1) {
		long long MID = (L + R) / 2, COUNT = 0;
		static long long X[100010] = {};
		X[0] = 100001;
		for (int i = 0; i < M; i++) {
			if (A[i] < MID) X[i + 1] = X[i] - 1;
			else X[i + 1] = X[i] + 1;
		}
		for (int i = 0; i <= 200000; i++) BIT[i] = 0;
		for (int i = 0; i <= M; i++) {
			COUNT += Sum(X[i]);
			Add(X[i], 1);
		}
		if (COUNT < M * (M + 1) / 2 - COUNT) R = MID;
		else L = MID;
 	}
	cout << L << endl;
}

Measured memory_bytes: 3328
X,K,D=map(int,input().split())

X=abs(X)

q=X//D
r=X%D

if r < D-r:
    n=q
    ans1=r
    ans2=D-r
else:
    n=q+1
    ans1=D-r
    ans2=r

if K <= n:
    ans=X-K*D
    ans=abs(ans)
else:
    d=K-n
    if d%2==0:
        ans = ans1
    else:
        ans = ans2
print(ans)

Measured memory_bytes: 9196
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <cmath>
#include <climits>
#include <math.h>

#define X first
#define Y second
#define vsort(v) sort(v.begin(), v.end())
#define vrev(v) reverse(v.begin(), v.end())
#define P pair

// stoi(s): string to int
// stod(s): string to double

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

// A-Z: 65~90
// a-z: 97~122
// |a-z| = 26

using namespace std;
using ll = long long;

int main(int argc, const char *argv[])
{
    char c;
    cin >> c;
    switch (c)
    {
    case 'A':
        cout << 'T' << endl;
        break;
    case 'C':
        cout << 'G' << endl;

        break;
    case 'G':
        cout << 'C' << endl;

        break;
    case 'T':
        cout << 'A' << endl;

        break;
    }
}


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

int main() {
  int N;
  cin >> N;
  int sum;
  sum = 0;

  // ここにプログラムを追記
  for (int i = 0; i < N; i++){
    int l, r;
    cin >> l >> r;
    
    sum += r - l + 1;
  } 
  
  cout << sum << endl;
}


Measured memory_bytes: 256
n,k = map(int, input().split())
x = list(map(int, input().split()))

# 頭の体操

# 一次元部分探索: N-K+1 通り
# 右から辿る：|xr| + |xl - xr|
# 左から辿る：|xl| + |xr - xl|

distance = []
for i in range(n-k+1):
    distance.append(abs(x[i]) + abs(x[k+i-1]-x[i]))
    distance.append(abs(x[k+i-1]) + abs(x[i]-x[k+i-1]))

if not len(distance) == 0:
    print(min(distance))
else:
    print(0)

Measured memory_bytes: 14224
S = input()
T = input()

d = dict()
dst = set()
for i, c in enumerate(S):
    if d.get(c) is None:
        if T[i] not in dst:
            d[c] = T[i]
            dst.add(T[i])
        else:
            print('No')
            exit(0)
    elif d[c] == T[i]:
        continue
    else:
        print('No')
        exit(0)
print('Yes')

Measured memory_bytes: 3632
#include"bits/stdc++.h"
using namespace std;
#define LL long long
#define PB push_back
#define MP make_pair
#define MOD 1000000007

int H, W;
char C[1000][1000];
int cost[1000][1000];

int main(){
	cin >> H >> W;
	queue<pair<int, int>> que;
	for(int i=0; i<H; i++){
		for(int j=0; j<W; j++){
			cin >> C[i][j];
			if(C[i][j] == '.') cost[i][j] = INT_MAX;
			else{
				cost[i][j] = 0;
				que.push(MP(i,j));
			}
		}
	}
	while(!que.empty()){
		int y = que.front().first;
		int x = que.front().second;
		que.pop();
		if(y-1 >= 0 && cost[y-1][x] > cost[y][x]+1){
			cost[y-1][x] = cost[y][x]+1;
			que.push(MP(y-1,x));
		}
		if(y+1 < H && cost[y+1][x] > cost[y][x]+1){
			cost[y+1][x] = cost[y][x]+1;
			que.push(MP(y+1, x));
		}
		if(x-1 >= 0 && cost[y][x-1] > cost[y][x]+1){
			cost[y][x-1] = cost[y][x]+1;
			que.push(MP(y, x-1));
		}
		if(x+1 < W && cost[y][x+1] > cost[y][x]+1){
			cost[y][x+1] = cost[y][x]+1;
			que.push(MP(y, x+1));
		}
	}
	int ans = 0;
	for(int i=0; i<H; i++){
		for(int j=0; j<W; j++){
			ans = max(ans, cost[i][j]);
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 13328
#include <bits/stdc++.h>
#define int long long
#define ALL(v) (v).begin(),(v).end()
#define pb push_back
#define rep(i,a,n) for(int i=a;i<n;i++)
#define repr(i,a,n) for(int i=a;i>n;i--)
#define leng(n) (int)(log10(n)+1)
#define INF 9000000000000000000
using namespace std;

int gcd(int a,int b){return b?gcd(b,a%b):a;}  //  最大公約数gcd
int lcm(int a,int b){return a/gcd(a,b)*b;}  //  最小公倍数lcm

signed main() {
  int a, b;
  cin >> a >> b;
  if(a+b >= 10) cout << "error" << endl;
  else cout << a+b << endl;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(){
  int n;
  int count = 0;
  cin >> n;
  for(int i=1;i<10;i++){
    if(n%i==0 && n/i<10) {
      cout << "Yes" <<endl;
      break; 
    }else count++;
  }
  if(count==9) cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <math.h>
#include <cmath>
#include <limits.h>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <functional>
#include <stdio.h>
using namespace std;

long long MOD = 1000000007;

int N,M;
int done[50];
vector< vector<int> > path;

#define MAX_N 50
int uf_par[MAX_N];
int uf_rank[MAX_N];

void uf_init( int n ) {
    for ( int i = 0; i < n; i++ ) {
        uf_par[i] = i;
        uf_rank[i] = 0;
    }
}

int uf_find( int x ) {
    if ( uf_par[x] == x ) { return x; }
    else { return uf_par[x] = uf_find(uf_par[x]); }
}

void uf_unite( int x, int y ) {
    x = uf_find( x );
    y = uf_find( y );
    if ( x == y ) { return; }
    
    if ( uf_rank[x] < uf_rank[y] ) {
        uf_par[x] = y;
    }
    else {
        uf_par[y] = x;
        if ( uf_rank[x] == uf_rank[y] ) { uf_rank[x]++; }
    }
    
}

bool uf_same( int x, int y ) {
    return ( uf_find(x) == uf_find(y) );
}


void dfs( int a, int b, int c ) {
    
    done[c] = 1;
    
    for ( int i = 0; i < path[c].size(); i++ ) {
        int n = path[c][i];
        if ( a == c && b == n ) { continue; }
        if ( b == c && a == n ) { continue; }
        if ( !done[n] ) { dfs( a, b, n ); }
    }
    
}

void bfs( int a, int b ) {
    
    fill( done, done+50, 0 );
    
    queue<int> Q;
    for ( int i = 0; i < path[0].size(); i++ ) {
        if ( ( a == 0 && b == path[0][i] ) || ( a == path[0][i] && b == 0 ) ) { continue; }
        Q.push(path[0][i]);
        done[path[0][i]] = 1;        
    }
    
    while ( !Q.empty() ) {
        int c = Q.front();
        Q.pop();
        
        for ( int i = 0; i < path[c].size(); i++ ) {
            int n = path[c][i];
            if ( ( a == c && b == n ) || ( a == n && b == c ) ) { continue; }
            if ( !done[n] ) {
                Q.push(n);
                done[n] = 1;
            }
        }
    }
    
}

bool is_all() {
    for ( int i = 0; i < N; i++ ) {
        if ( !done[i] ) { return false; }
    }
    return true;
}

int main() {
    
    cin >> N >> M;
    path.resize(N);
    vector< pair<int, int> > P;
    for ( int i = 0; i < M; i++ ) {
        int a,b;
        cin >> a >> b;
        a--; b--;
        path[a].push_back(b);
        path[b].push_back(a);
        P.push_back( make_pair(a,b) );
    }
    
    
    int ans = 0;
    
    for ( int i = 0; i < M; i++ ) {
        uf_init(N);
        for ( int j = 0; j < M; j++ ) {
            if ( i == j ) { continue; }
            uf_unite( P[j].first, P[j].second );
        }
        for ( int k = 0; k < N-1; k++ ) {
            if ( !uf_same( k, k+1 ) ) { ans++; break; }
        }
    }
    
    // for ( int i = 0; i < M; i++ ) {
        // fill( done, done+50, 0 );
        // bfs( P[i].first, P[i].second );
        // dfs( P[i].first, P[i].second, 0 );
        // if ( !is_all() ) { ans++; }
    // }
    
    cout << ans << endl;
    
    return 0;
}

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

int main() {
    int x, y;
    cin >> x >> y;
    
    bool ok = false;
    rep(i, x+1){
        if (i * 2 + (x-i) * 4 == y) {
            ok = true;
        }
    }

    if (ok) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }

    return 0;
}

Measured memory_bytes: 3604
Imports System.Collections.Generic
Imports System.Console

Module Program
    Sub Main()
        Dim N As Integer = NextInt()

        Dim Lucas As Long() = New Long() {2, 1}

        For i As Integer = 2 To N
            Lucas(i Mod 2) = Sum(Lucas)
        Next

        WriteLine(Lucas(N Mod 2))
    End Sub

    Function Sum(arr As Long()) As Long
        Dim result As Long
        For Each i As Long In arr
            result += i
        Next
        Return result
    End Function

    Function NextInt() As Integer
        Return CInt(NextString())
    End Function

    Function NextString() As String
        Dim result As New List(Of Char)
        Do
            Dim tmp As Integer = Read()
            If tmp < 0 Then Exit Do
            Dim nextChar As Char = Chr(tmp)

            If Not Char.IsWhiteSpace(nextChar) Then
                result.Add(nextChar)
            ElseIf nextChar <> vbCr Then
                Exit Do
            End If
        Loop
        Return New String(result.ToArray())
    End Function

End Module


Measured memory_bytes: 19920
#include<bits/stdc++.h>
#define r(i,n) for(int i=0;i<n;i++)
using namespace std;
bool used[100001];
int main(){
	int n,k;
	cin>>n>>k;
	int a[n];
	r(i,n)cin>>a[i];
	sort(a,a+n);
    int s=0;
	r(i,k)s+=a[n-1-i];
	cout<<s<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <complex>
#include <math.h>
#include <set>
#include <vector>
#include <map>
#include <queue>
#include <stdio.h>
#include <stack>
#include <algorithm>
#include <list>
#include <ctime> 
#include <memory.h>
#include <assert.h>

using namespace std;

using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
const int INF = 1e9 + 1;
const ll LLINF = 1e18 + 1;

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

    // 尺取り法
    int ans = 0;
    int left = 0;
    int right = 0;
    while(right < N) {
        // '1'が続く区間分進める
        while(right < N && S[right] == '1') ++right;
        ans = max(ans, right - left);

        // '0'が続く区間分進める。この区間をK回置き換えることができる。
        while(right < N && S[right] == '0') ++right;
        --K;

        // 変換できる回数がなくなったら1回分ずらして続ける。
        if(K < 0) {
            while(left < N && S[left] == '1') ++left;
            while(left < N && S[left] == '0') ++left;
        }
        ans = max(ans, right - left);
    }

    cout << ans << endl;

    return 0;
}

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


int main(){
    int n;
    cin>>n;
    vector<int> a(n+1);
    rep(i,n) cin>>a[i];

    int cnt = 0;
    rep(i,n) if(a[i] != i) ++cnt;

    cout<< (cnt<=2 ? "YES" : "NO") <<endl;

    return 0;
}



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

int n,e,t,a[100010],dp[100010];

signed main()
{
	ios::sync_with_stdio(false);
	cin>>n>>e>>t;
	for(int i=1;i<=n;i++) cin>>a[i];
	int minv=INF,pos=0;
	for(int i=1;i<=n;i++){
		while(2*(a[i]-a[pos+1])>t){
			minv=min(minv,dp[pos]-2*a[pos+1]);
			pos++;
		}
		dp[i]=min(minv+2*a[i],dp[pos]+t);
	}
	cout<<dp[n]+e<<endl;
	return 0;
}

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

int main(void){
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    if(b < c || d < a){
        cout << "0" << endl;
        return 0;
    }
    int s, g;
    if(a <= c){
        s = c;
    }else{
        s = a;
    }
    if(b <= d){
        g = b;
    }else{
        g = d;
    }
    cout << g-s << endl;
    return 0;
}

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


void solve(long long N, long long M, std::vector<long long> L, std::vector<long long> R){
  long long mymax = 0;
  long long mymin = INT_MAX;
  REP(i, M) {
    mymax = max(mymax, L[i]);
    mymin = min(mymin, R[i]);
  }

  cout << ((mymax <= mymin) ? ((mymin - mymax) + 1) : 0) << endl;
  return;
}

// Generated by 1.1.6 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(){
    long long N;
  scanf("%lld",&N);
  long long M;
  scanf("%lld",&M);
  std::vector<long long> L(M);
  std::vector<long long> R(M);
  for(int i = 0 ; i < M ; i++){
    scanf("%lld",&L[i]);
    scanf("%lld",&R[i]);
  }
    solve(N, M, std::move(L), std::move(R));
    return 0;
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
const long long MOD = 1e9+7;
#define rep(i,n) for(int i=0;i<n;++i)
typedef long long int ll;
typedef unsigned long long ull;
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;}
typedef pair<ll,ll> P;


int main()
{
    int n;
    cin >> n;
    map<int,int>mp;
    vector<int> twe;
    rep(i,n)
    {
        int a;
        cin >> a;
        mp[a]++;
        if(mp[a]%2==0) twe.push_back(a);
    }
    sort(twe.begin(),twe.end());
    int l=twe.size();
    if(l<2)cout<<0<<endl;
    else cout<<(ll)twe[l-1]*twe[l-2]<<endl;
 
    return 0;
}

Measured memory_bytes: 4992
import java.io.*;
public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));

        char[] A = br.readLine().toCharArray();

        char[] B = br.readLine().toCharArray();

        int cnt = 0;
        for(int i=0;i<A.length;i++){
            if(A[i] != B[i])cnt++;
        }

        System.out.println(cnt);


    }
}


Measured memory_bytes: 37328
#include <iostream>
using namespace std;
typedef long long  ll;

#define rep(i,s,n)for(ll i=s;i<n;i++)
#define repe(i,s,n)for(ll i=s;i<=n;i++)

int main()
{
	ll a, b, x; cin >> a >> b >> x;
	ll ans = b / x - a / x;

	if (a % x == 0) {
		ans++;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <string>
#include <cmath>
#include <limits>
#include <algorithm>
#include <memory>
#include <climits>
#include <bitset>

constexpr long long MOD = 1000000007;

int main()
{
  long long N;
  std::cin >> N;
//  int ans1 = 0;
//  for (long long i = N - 1; 0 < i; --i)
//  {
//    if (N / i == N % i)
//      ans1 += i;
//  }
  if (N < 3)
  {
    std::cout << 0 << std::endl;
    return 0;
  }
  long long  ans = N - 1;
  long long limit = std::sqrt(N) + 1LL;
  for (long long i = 2; i <= limit; ++i)
  {
    long long left = 1;
    long long right = N;
    long long n = -1;
    while (left < right)
    {
      long long mid = left + ((right - left) / 2LL);
      long long quot = N / mid;
      if (i < quot)
        left = mid + 1;
      else if (quot < i)
        right = mid;
      else
      {
        long long res = N % mid;
        if (res == quot)
        {
          n = mid;
          break;
        }
        else if (res < i)
          right = mid;
        else
          left = mid + 1;
      }
    }
    if (0 < n)
    {
//      std::cout << n << ": " << i << std::endl;
      ans += n;
    }
  }
  std::cout << ans << std::endl;
  return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const long long INF = 1LL<<60;

ll GCD(ll x,ll y){
    if(y == 0) return x;
    else return GCD(y,x%y);
}

ll LCM(ll a,ll b){
    return a / GCD(a,b) * b;
}

const int MOD = 1000000007;



int main() {
    ll a,b,x; cin >> a >> b >> x;
    if(a != 0){
        ll s = (a-1) / x,t = b / x;
        cout << t-s ;
    }else{
        cout << b/x + 1;
    }
}


Measured memory_bytes: 3592
#include <stdio.h>

int main() {
    int i,H,W,a[100][100];
    scanf("%d %d",&H,&W);
    for(i=0;i<W+2;i++){printf("#");}
    printf("\n");
    for(i=0;i<H;i++){
        scanf("%s",a[i]);
        printf("#%s#\n",a[i]);}
    for(i=0;i<W+2;i++){printf("#");}

    return 0;
}

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


A_hash = {}

for i in A:
    if i in A_hash:
        A_hash[i] += 1
    else:
        A_hash[i] = 1

count = 0
for k, v in A_hash.items():
    if k == 0:
        continue
    if A_hash[k] != 2:
        print(0)
        exit()
    else:
        count += 1


ans = 1
for i in range(count):
    ans = ans * 2 % 1000000007
print(ans)


Measured memory_bytes: 55404
#include <stdio.h>
#include <algorithm>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main() {
    double a = 1e100, b = -1e100, t;
    while (scanf("%lf", &t) != EOF) a = min(a, t), b = max(b, t);
    printf("%.6f\n", b-a);
    return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <queue>
#include <string>
#include <set>
#define INF 1000000000
#define LLINF 2000000000000000
using namespace std;
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define LOOP(i,N) for(int i=0;i<N;i++)
#define LOOP1(i,N) for(int i=1;i<=N;i++)
typedef pair<int,int> P;
typedef pair<int,pair<int,int> > PP;
#define int long long

signed main(){
  int n;
  P rob[100000];
  cin >> n;
  LOOP(i,n){
    int x,l;
    cin >> x >> l;
    rob[i].first = x+l;
    rob[i].second = x;
  }
  sort(rob,rob+n);
  int left = -LLINF;
  int ans = 0;
  LOOP(i,n){
    int x = rob[i].second;
    int r = rob[i].first;
    int l = x-(r-x);
    if(left > l)continue;

    ans++;
    left = r;
  }
  cout << ans << endl;
}


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

public class Main {

	public static void main(String[] args)
			throws java.io.IOException{
		Scanner scan = new Scanner(System.in);
		int[] delta=new int[5];
		
			for(int j=0;j<5;j++){
				delta[j] = scan.nextInt();	
			}
			Arrays.sort(delta);
			System.out.print(delta[4]+" ");
System.out.print(delta[3]+" ");
System.out.print(delta[2]+ " ");
System.out.print(delta[1]+" ");
System.out.println(delta[0]);
			
	}
}

Measured memory_bytes: 12000
#include<bits/stdc++.h>
#pragma GCC optimize("O2")
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

#define endl            "\n"
#define forn(i,x,n)     for(int i=x; i<n; i++)
#define forit(it, m)    for(decltype(m)::iterator it = m.begin(); it!=m.end(); ++it)
#define ff              first
#define ss              second
#define int             long long
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;


void zeus()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
}

int fast_pow(long long base, long long n, long long M)
{
    if (n == 0)
        return 1;
    if (n == 1)
        return base;
    long long halfn = fast_pow(base, n / 2, M);
    if (n % 2 == 0)
        return ( halfn * halfn ) % M;
    else
        return ( ( ( halfn * halfn ) % M ) * base ) % M;
}

int findMMI_fermat(int n, int M)
{
    return fast_pow(n, M - 2, M);
}


int32_t main() {

    zeus();

    int n; cin >> n;

    int ans = 0;
    forn(i, 1, n + 1) {
        ans += i * (n / i) * (n / i + 1) / 2;
    }

    cout << ans << endl;



}

Measured memory_bytes: 3588
/**
 * File              : F.cpp
 * Author            : JCHRYS <jchrys@me.com>
 * Date              : 26.01.2020
 * Last Modified Date: 26.01.2020
 * Last Modified By  : JCHRYS <jchrys@me.com>
 */

#include <bits/stdc++.h>
using namespace std;
using ll = long long;

int main() {
    int n;
    ll d, a;
    cin >> n >> d >> a;
    vector<pair<int, int>> m(n);
    for (int i = 0; i < n; i++) {
        cin >> m[i].first >> m[i].second;
    }
    sort(m.begin(), m.end());
    ll damage = 0;
    list<pair<int, ll>> dm;
    ll ans = 0;
    for (int i = 0; i < n; i++) {
        while (!dm.empty() && dm.front().first < m[i].first) {
            damage -= a * dm.front().second;
            dm.pop_front();
        }
        ll left = 1LL*m[i].second - damage;
        if (left <= 0) continue;
        ll need = left / a + (left % a != 0);
        ans += need;
        damage += need * a;
        dm.push_back({m[i].first + (2 * d), need});
    }
    cout << ans;
    return 0;
}


Measured memory_bytes: 6528
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define mod 1000000007
signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin>>n;
    int a[n],i,q,sum=0;
    unordered_map<int,int> m;
    for(i=0;i<n;i++)
    {
        cin>>a[i];
        m[a[i]]++;
        sum+=a[i];
    }
    cin>>q;
    while(q--)
    {
        int b,c;
        cin>>b>>c;
        sum+=(c-b)*m[b];
        m[c]+=m[b];
        m[b]=0;
        cout<<sum<<endl;
    }
    return 0;
}

Measured memory_bytes: 7924
//#define _CRT_SECURE_NO_WARNINGS
//#include <bits/stdc++.h>
#include "bits/stdc++.h"

#define rep(i,n) for(ll (i)=0;(i)<(ll)(n);(i)++)
#define all(x) (x).begin(),(x).end()

#define MOD 1000000007LL
#define INF (1LL<<60LL)
#define int long long
#define MAX_N (100001)
typedef long long ll;

using namespace std;


signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n, m; cin >> n >> m;
	vector<int> h(n);
	vector<bool> v(n, true);
	rep(i, n) cin >> h[i];
	rep(i, m) {
		int a, b; cin >> a >> b;
		a--; b--;
		if (h[a] < h[b]) {
			v[a] = false;
		}
		else {
			v[b] = false;
			if (h[a] == h[b])v[a] = false;
		}
	}
	int ans=0;
	rep(i, n)if (v[i])ans++;
	cout << ans << endl;
}


Measured memory_bytes: 3988
#include<bits/stdc++.h>
using namespace std;
#define REP(i,n) for((i)=0;(i)<(int)(n);(i)++)
typedef long long ll;
typedef pair<ll, ll> P;
const int MOD = 1000000007;
const int INF = 1<<29;
int dist[10][10];

int main(){
    int h, w;
    cin >> h >> w;
    int i, j, k;
    REP(i, 10)REP(j, 10) cin >> dist[i][j];

    REP(k, 10)REP(i, 10)REP(j, 10){
        dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j]);
    }

    int ans = 0;
    REP(i, h)REP(j, w){
        int x;
        cin >> x;
        if (x == -1) continue;
        ans += dist[x][1];
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
n = int(input())
line1 = list(map(int,input().split()))
line2 = list(map(int,input().split()))
sum1 = sum(line1)
sum2 = sum(line2)
count1 = 0
count2 = 0
box = []
for i in range(0,n):
  count1 += line1[i]
  count2 += line2[i]
  totalgap = count2 - line2[i] +sum1 - count1
  box.append(totalgap)
print(sum1 + sum2 - min(box))

Measured memory_bytes: 3064
N = int(input())
Ss = input()

BASE = 10**9 + 7
MOD = 2**61 - 1

def genRollingHash_AllRight(Ss, lenInit, BASE, MOD):
    As = [ord(S) for S in Ss]
    hashS = 0
    for A in As[:lenInit]:
        hashS = (hashS*BASE + A) % MOD
    yield hashS

    powB_L = pow(BASE, lenInit, MOD)
    for Aadd, Asub in zip(As[lenInit:], As[:len(As)-lenInit]):
        hashS = (hashS*BASE + Aadd - Asub*powB_L) % MOD
        yield hashS

def isOK(k):
    hashSs = list(genRollingHash_AllRight(Ss, k, BASE, MOD))
    setHashS = set()
    for i in range(k, N-k+1):
        setHashS.add(hashSs[i-k])
        if hashSs[i] in setHashS:
            return True
    return False

ng, ok = N//2 + 1, 0
while abs(ok-ng) > 1:
    mid = (ng+ok) // 2
    if isOK(mid):
        ok = mid
    else:
        ng = mid

print(ok)


Measured memory_bytes: 43484
/*
    author:ujwalll
*/
#pragma GCC optimize("O2")
#include <bits/stdc++.h>
using namespace std; 
#define rep(i,n) for(int i=0;i<(n);i++)
#define for1(i,n) for(int i=1;i<=n;i++)
#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define FORD(i,a,b) for(int i=(a);i>=(b);i--)
const int INF = 1<<29;
const int MOD=1073741824;
#define pp pair<ll,ll>
#define ppi pair<int,int>
typedef long long int ll;
bool isPowerOfTwo (ll x)  
{  
    return x && (!(x&(x-1)));  
}
void fastio()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
}
long long binpow(long long a, long long b) {
    long long res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a;
        a = a * a;
        b >>= 1;
    }
    return res;
}
const int dx[] = {1,0,-1,0,1,1,-1,-1};
const int dy[] = {0,-1,0,1,1,-1,-1,1};
////////////////////////////////////////////////////////////////////
int n,m,sx,sy,ex,ey;
char a[1005][1005];
int dist[1005][1005];
int solve(){
    rep(i,n){
        rep(j,m)
        dist[i][j]=INT32_MAX;
    }
    deque<ppi> q;
    q.push_back({sx,sy});
    dist[sx][sy]=0;
    bool ok =0;
    while(!q.empty()){
        ppi p = q.front();
        q.pop_front();
        if(p.first == ex && p.second == ey)ok=1;
        for(int i=-2;i<=2;i++){
            for(int j=-2;j<=2;j++){
                int x=p.first + i,y=p.second + j;
                if(a[x][y]=='#' || x>=n || y>=m || x<0 || y<0)continue;
                int w=1;
                if((abs(i)==1 && !j) || (abs(j)==1 && !i) || (!i && !j))w=0;
                if(dist[x][y]>dist[p.first][p.second] + w){
                    dist[x][y]=dist[p.first][p.second]+w;
                    if(w==1)q.push_back({x,y});
                    else q.push_front({x,y});
                }
            }
        }
    }
    if(!ok)return -1;
    return dist[ex][ey];
}
int main(){
    int tc=1;
    // cin>>tc;
    while(tc--){
        cin>>n>>m;
        cin>>sx>>sy>>ex>>ey;
        sx--,sy--,ex--,ey--;
        rep(i,n){
            rep(j,m)cin>>a[i][j];
        }
        cout<<solve();
    }
}

Measured memory_bytes: 8464
#include <stdio.h>
int main() {
	int t, h, m;
	h = 0; m = 0;

	scanf("%d", &t);
	for (;t >= 3600;) {
		t =  t - 3600;
		h++;
	}
	for (;t >= 60;) {
		t = t - 60;
		m++;
	}
	printf("%d:%d:%d\n",h,m,t);
	return 0;
}


Measured memory_bytes: 2104
#include<iostream>
#include<climits>
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp> 
#include<ext/pb_ds/tree_policy.hpp>
#define pb push_back
#define f first
#define s second
#define pii pair<int,int> 
#define pll pair<ll,ll>
#define vpll vector<pll>
#define vi vector<int>
#define vll vector<ll>
#define be begin
#define en end
#define endl '\n'
#define SIZE 100000000
#define w(t) int t;cin>>t;while(t--)
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define value_at_idx find_by_order
#define idx order_of_key
#define MOD 1e9 + 7

typedef long long ll;
using namespace std;
using namespace __gnu_pbds; 
 
map<int,list<int>> l ;
bool vis[SIZE]={0};

int dp[SIZE];
int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	int k,a,b;
	cin>>k>>a>>b;
	for(int i=a;i<=b;i++)
	{
		if(i%k==0)
		{
			cout<<"OK";
			return 0;
		}
	}
	cout<<"NG";

	

	return 0;
	
	
	
}

Measured memory_bytes: 3652
#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;
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() {
    int H, W;
    cin >> H >> W;
    vector<vector<char>> a(H, vector<char>(W));
    REP(i, H) {
        REP(j, W) { cin >> a[i][j]; }
    }
    REP(i, W + 2) { cout << '#'; }
    cout << endl;
    REP(i, H) {
        cout << '#';
        REP(j, W) { cout << a[i][j]; }
        cout << '#';
        cout << endl;
    }
    REP(i, W + 2) { cout << '#'; }
    cout << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
int main(){
  char S[6]={};
  rep(i,6){
    cin >> S[i];
  }
  if(S[2]==S[3]&&S[4]==S[5]){
    cout << "Yes" <<endl;
    return 0;
  }
  cout << "No" <<endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
using namespace std;
int main(){
	string s;
	int a,b,c,d,i,j,p,n,m,k;
	cin>>s;
	a=s[0]-48;
	b=s[1]-48;
	c=s[2]-48;
	d=s[3]-48;
	if(a+b+c+d==7){
		cout<<a<<"+"<<b<<"+"<<c<<"+"<<d<<"="<<7; 
		return 0;
	}  
	if(a+b+c-d==7){
		cout<<a<<"+"<<b<<"+"<<c<<"-"<<d<<"="<<7; 
		return 0;
	} 
	if(a+b-c+d==7){
		cout<<a<<"+"<<b<<"-"<<c<<"+"<<d<<"="<<7; 
		return 0;
	} 
	if(a+b-c-d==7){
		cout<<a<<"+"<<b<<"-"<<c<<"-"<<d<<"="<<7; 
		return 0;
	} 
	if(a-b+c+d==7){
		cout<<a<<"-"<<b<<"+"<<c<<"+"<<d<<"="<<7; 
		return 0;
	} 
	if(a-b+c-d==7){
		cout<<a<<"-"<<b<<"+"<<c<<"-"<<d<<"="<<7; 
		return 0;
	} 
	if(a-b-c+d==7){
		cout<<a<<"-"<<b<<"-"<<c<<"+"<<d<<"="<<7; 
		return 0;
	} 
	if(a-b-c-d==7){
		cout<<a<<"-"<<b<<"-"<<c<<"-"<<d<<"="<<7; 
		return 0;
	} 
}

Measured memory_bytes: 256
#include <stdio.h>

double judge(double xa,double ya,double xc,double yc,double x,double y){
  return (xa-xc)*(y-ya)+(ya-yc)*(xa-x);
}
int main(){
  double xa,ya,xb,yb,xc,yc,xd,yd;
  while (scanf("%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf",&xa,&ya,&xb,&yb,&xc,&yc,&xd,&yd)!=EOF){
    if (judge(xa,ya,xc,yc,xb,yb)*judge(xa,ya,xc,yc,xd,yd)<0)
      if (judge(xb,yb,xd,yd,xa,ya)*judge(xb,yb,xd,yd,xc,yc)<0)
        puts("YES");
      else
        puts("NO");
    else
      puts("NO");
  }
  return 0;
}

Measured memory_bytes: 608
#include "bits/stdc++.h"
using namespace std;
using Graph = vector<vector<int>>;

int main() {
    int N, M; cin >> N >> M;
    Graph G(N);
    for (int i = 0; i < N - 1; i++) {
        int a, b;
        cin >> a >> b;
        a--, b--;
        G[a].push_back(b);
        G[b].push_back(a);
    }

    vector<int> ans(N, 0);
    vector<int> dist(N, -1);
    dist[0] = 0;
    queue<int> que;
    que.push(0);

    for (int i = 0; i < M; i++) {
        int p, x;
        cin >> p >> x;
        p--;
        ans[p] += x;
    }

    while (!que.empty()) {
        int v = que.front();
        que.pop();
        for (int nv : G[v]) {
            if (dist[nv] != -1) continue;
            dist[nv] = dist[v] + 1;
            ans[nv] += ans[v];
            que.push(nv);
        }
    }

    for (int v = 0; v < N; v++) {
        if (v != N - 1) cout << ans[v] << " ";
        else cout << ans[v] << endl;
    }
}

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

using namespace std;

int main() {
	int n;

	cin >> n;

	pair <int, int> p;
	vector <bool> doublets(n, false);

	for (int i = 0; i < n; i++) {
		cin >> p.first >> p.second;

		if (p.first == p.second) {
			doublets[i] = true;
		}
	}

	bool ans = false;

	for (int i = 2; i < n; i++) {
		if (doublets[i] && doublets[i-1] && doublets[i-2]) {
			ans = true;
			break;
		}
	}

	if (ans) {
		cout << "Yes";
	} else {
		cout << "No";
	}

	cout << "\n";


	return 0;
}

Measured memory_bytes: 3624
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author
 */

#include <iostream>
#include <fstream>

#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define mod1 1000000007
#define mod2 1000000009
int getTheAnswer() {
    return 42;
}

using namespace std;
using ll=long long;

class BMakingTriangle {
public:
	void solve(std::istream& cin, std::ostream& cout) {
        int n;
        cin>>n;
        int a[n];
        for (int i=0;i<n;i++)
            cin>>a[i];
        int cnt=0;
        for (int i=0;i<n;i++){
            for (int j=i+1;j<n;j++){
                for (int k=j+1;k<n;k++){
                    int x=a[i],y=a[j],z=a[k];
                    if ((x+y>z)&&(x+z>y)&&(y+z>x)){
                        if (x!=y&&x!=z&&y!=z)
                        cnt++;
                    }
                }
            }
        }
        cout<<cnt;
	}
};


int main() {
	BMakingTriangle solver;
	std::ios::sync_with_stdio(false);
	std::cin.tie(NULL);
	std::cout.tie(NULL);
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 3648
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;

bool check(int n)
{
  for (int i = 0; 4 * i <= n; i++) {
    if ((n - 4 * i) % 7 == 0) return true;
  }
  return false;
}

int main()
{
  int N; scanf("%d", &N);

  if (check(N))
    printf("Yes\n");
  else
    printf("No\n");
}

Measured memory_bytes: 128
import java.util.Scanner;
public class Main {

	public static void main(String[] args){
		int m=800;
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int x = n*m;
		int y = n/15*200;
		System.out.println(x-y);
		scan.close();
	}
}

Measured memory_bytes: 21844