akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define ll long long
#define ii pair<int, int>
#define vi vector<int>
#define ld long double
#define vii vector<ii>
#define vll vector<ll>
#define maxn 100010

template<typename T>
void trace(T a){ cout << a << '\n';}
template<typename T, typename... Args>
void trace(T a, Args ...args){ cout << a << ' '; trace(args...);}

priority_queue<int> a[maxn];

int main(){
	int n,m,x,y;
	cin >> n >> m;
	for (int i = 0; i < n; ++i) {
		cin >> x >> y;
		if (x <= m)
			a[m-x].push(y);
	}
	int ans = 0;
	for (int i = m; i >= 0; --i) {
		if (a[i].empty()) continue;
		// trace(i, a[i].top());
		ans += a[i].top();
		a[i].pop();
		for (int j = i-1; !a[i].empty() && j >= 0; --j) {
			a[j].push(a[i].top());
			a[i].pop();
		}
	}
	trace(ans);
 	return 0;
}



Measured memory_bytes: 163456
#include<iostream>
#include<string>
#include<bitset>

using namespace std;
// Problem https://atcoder.jp/contests/abc079/tasks/abc079_c
// Reference https://atcoder.jp/contests/abc079/submissions/1789911
// Try C++ 1st

int main(void){
    string ABCD;
    cin >> ABCD;
    for(int bit=0;bit<8;bit++){
        int tmp;
        tmp = (int)(ABCD.at(0)- '0');
        for(int j=0;j<3;j++){
            int tmp2=0;
            tmp2 = (int)(ABCD.at(j+1)-'0');
//            cout << "j Before :" << j;
            int k =  1 << j ;
//            cout << " [1 << j ]After : " << j << endl;
            int checkFlag;
            checkFlag = k & bit;
//            cout << bitset<3>(k) << " " << bitset<3>(bit) << " & = " << bitset<3>(checkFlag) << endl;
            if(checkFlag){
//                cout << bitset<3>(checkFlag) << " is though" << endl;
                tmp = tmp + tmp2;
            }
            else{
                tmp = tmp - tmp2;
            } // else
        } // for j=0
        if(tmp == 7){
            //   cout << bit << " is SUM = 7" << endl;
            string answer;
            answer.push_back(ABCD.at(0));
            for(int j=0;j<3;j++){
                int k = 1 << j;
                // int plusFlag = bit and k;
                int plusFlag = bit & k;
                if(0 < plusFlag){
                    answer.push_back('+');
                }
                else{
                    answer.push_back('-');
                }// if(0 < plusFlag)
                answer.push_back(ABCD.at(j+1));
            }// for(int j=0...)
            answer.push_back('=');
            answer.push_back('7');
            answer.push_back('\n');
            cout << answer;
            break; // 全部出したければこの文をコメントアウト
        } // tmp == 7
    } // for int bit=0
    return 0;
}

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

using namespace std;
using ll = long long;

const long long inf = 1e9;
#define fr(i,a,n) for (int i=a;i<n;i++)
#define rfr(i,n,a) for (int i=n;i>=a;i--)
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
#define pll pair<ll,ll> 
#define endl "\n"
typedef vector<int> VI;
typedef vector<ll> VL;
typedef priority_queue<int> Pqi;
typedef priority_queue<ll> Pql;

ll n, m, k;

int main () {
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	cin >> n >> k;
	if (n * 2 > k || n * 4 < k) {
		cout << "No" << endl;
		return 0;
	}
	int dif = k - (n * 2);
	if (dif % 2 || (dif/2) > n) {
		cout << "No" << endl;
	}
	else {
		cout << "Yes" << endl;
	}
	return 0; 
}


Measured memory_bytes: 3600
#include<bits/stdc++.h>
#define ll long long int
using namespace std;
int main()
{

    ll i,j,k,c,d,a,b,e,f,p,q,n,t,m,r,u,x,y;
    vector<ll > vv,v,s;
    string st,et;
    map<ll,ll > pa,ea,ma;
    long double bb,cc,aa;
    cin>>n;
    d =0;
    for(i=1; i*i<=n; i++)
    {
        if(n%i==0)
        {
            if(i==2 || i==3)v.push_back(i);
            else
            {
                c  =0;
                for(k=2; k*k<=i; k++)
                {
                    if(i%k==0)
                    {
                        c = i;
                        while(c%k==0)
                        {
                            c = c/k;
                        }
                        if(c!=1)break;
                        else
                        {
                            v.push_back(i);
                            break;
                        }
                    }
                }
                if(c==0 && i!=1)v.push_back(i);
            }
            if(n/i!=i)
            {
                c  =0;
                d = n/i;
                for(k=2; k*k<=d; k++)
                {
                    if(d%k==0)
                    {
                        c = d;
                        while(c%k==0)
                        {
                            c = c/k;
                        }
                        if(c!=1)break;
                        else
                        {
                            v.push_back(d);
                            break;
                        }
                    }
                }
                if(c==0)v.push_back(d);
            }
        }
    }
    sort(v.begin(),v.end());
    d = 0;
    for(i=0; i<v.size(); i++)
    {
        if(n%v[i]==0)
        {
            d++;
           // cout<<n<<" he "<<i<<endl;
            n = n/v[i];
        }
        else
        {
            while(n%v[i]!=0)
            {
                i++;
                if(i==v.size())break;
            }
            if(i!=v.size())
            {
                //cout<<n<<" he "<<i<<endl;
                n = n/v[i];
                d++;
            }
            else
            {
                break;
            }
        }
    }
    cout<<d<<endl;
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
#define ll long long
inline int read(){
    int num=0,w=0;
    char ch=0;
    while(!isdigit(ch)){
        w|=ch=='-';
        ch=getchar();
    }
    while(isdigit(ch)){
        num=(num<<3)+(num<<1)+(ch^48);
        ch=getchar();
    }
    return w?-num:num;
}

//快速写
inline void write(int x)
{
    if(x<0){
        putchar('-');
        x=-x;
    }
    if(x>9)write(x/10);
    putchar(x%10+'0');
}

int arr[1000];
int main()
{
    int a,b,c;
    a =read();
    b =read();
    c =read();
    if(a+b+c>=22)cout<<"bust";
    else cout<<"win";

    return 0;
}

Measured memory_bytes: 256
from scipy.special import comb
s = int(input())
l = s // 3
# print(l)
mod = pow(10, 9) + 7
ans = 0
last = s % 3
for i in range(l, 0, -1):
    ans += comb(i+last-1, last, exact=True) % mod
    # print(comb(i+last-1, last, exact=True))
    # ans += pow(i, last, mod)
    ans %= mod
    last += 3
print(ans)


Measured memory_bytes: 42340
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using mii = map<int, int>;
using mll = map<ll, ll>;
using vi = vector<int>;
using vii = vector<vi>;
using vpi = vector<pii>;
using vl = vector<ll>;
using vll = vector<vl>;
using vpl = vector<pll>;
using vs = vector<string>;

int main()
{
    int n;
    cin >> n;
    vi as(n);
    for(int i=0; i<n; i++) cin >> as.at(i);

    bool ans = true;
    for(auto a : as)
    {
        if(a%2==0 && (a%3!=0 && a%5!=0)) ans = false;
    }
    if(ans) cout << "APPROVED" << endl;
    else cout << "DENIED" << endl;
    return 0;
}


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

using namespace std;
typedef long long ll;
const int MAX_V = 310;
ll INF = 1000000000000000;
struct edge{ll to,cap,rev;};
vector<edge> G[MAX_V];
bool used[MAX_V];
ll b[MAX_V],f[MAX_V],can[MAX_V][MAX_V];
vector<int> v,w;
void add_edge(ll from,ll to,ll cap){
    G[from].push_back({to,cap,(ll)G[to].size()});
    G[to].push_back({from,0,(ll)G[from].size() - 1});
}

ll dfs(int s,int t,ll val){
    for(edge e:G[s]){
        if(used[e.to]) continue;
        b[e.to] += e.cap;
        if(b[e.to]>=val){
            used[e.to] = true;
            v.push_back(e.to); w.push_back(e.to);
        }
    }
    if(v.size()==0) return 0;
    int vv = v.back();
    if(vv==t) return 1;
    v.pop_back();
    return dfs(vv,t,val);
}

ll rev_dfs(int s,int t,ll val){
    for(int i=0;i<MAX_V;i++) f[i] = 0;
    f[t] = val;
    while(w.size()){
        int now = w.back();
        w.pop_back();
        used[now] = false;
        for(edge ee:G[now]){
            int from = ee.to;
            if(!used[from]) continue;
            int j = can[from][now];
            if(j==-1) continue;
            edge &e = G[from][j];
            ll f_ = min(f[now],e.cap);
            e.cap -= f_;
            G[e.to][e.rev].cap += f_;
            f[now] -= f_; f[from] += f_;
        }
    }
}

ll max_flow(int s,int t){
    ll flow = 0,val = 0;
    int i,j;
    for(i=0;i<MAX_V;i++){
        b[i] = 0;
        for(j=0;j<MAX_V;j++){
            can[i][j]= -1;
        }
        for(j=0;j<G[i].size();j++){
            can[i][G[i][j].to] = j;
            val = max(val,G[i][j].cap);
        }
    }
    while(val){
        v.clear(); w.clear(); w.push_back(s);
        for(i=0;i<MAX_V;i++){
            b[i] = 0; used[i] = false;
        }
        used[s] = true;
        if(!dfs(s,t,val)){
            val /= 2;
            continue;
        }
        rev_dfs(s,t,val);
        flow += val;
    }
    return flow;
}
ll a[110];
int main(){
    int i,j,n;
    ll ans = 0;
    cin >> n;
    for(i=1;i<=n;i++){
        cin >> a[i];
        if(a[i]>=0){
            ans += a[i];
            add_edge(0,i,a[i]);
        }else{
            add_edge(i,n + 1,-a[i]);
        }
        for(j=2*i;j<=n;j+=i){
            add_edge(j,i,INF);
        }
    }
    cout << ans - max_flow(0,n + 1) << endl;
}


Measured memory_bytes: 1024
import java.util.*;
import java.io.*;
public class Main {
	static int n;
	static int A, B, C;
	static int[] bamboos;
	
	public static int solve (int stuff, int a, int b, int c) {
		if (stuff == n) {
			if (Math.min(a, Math.min(b, c)) > 0) {
				return Math.abs(A - a) + Math.abs(B - b) + Math.abs(C - c) - 30;
			}
			return (1<<30);
		}
		int yes1 = solve (stuff + 1, a, b, c);
		int yes2 = solve (stuff + 1, a + bamboos[stuff], b, c) + 10;
		int yes3 = solve (stuff + 1, a, b + bamboos[stuff], c) + 10;
		int yes4 = solve (stuff + 1, a, b, c + bamboos[stuff]) + 10;
		return Math.min(yes1, Math.min(yes2, Math.min(yes3, yes4)));
	}
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		n = sc.nextInt();
		A = sc.nextInt();
		B = sc.nextInt();
		C = sc.nextInt();
		bamboos = new int[n];
		for (int i = 0; i < n; i++) {
			bamboos[i] = sc.nextInt();
		}
		System.out.println(solve(0,0,0,0));

	}

}


Measured memory_bytes: 22228
n,m = map(int,input().split())
city_inf = []
for i in range(m):
    array = [i]
    array.extend(list(map(int,input().split())))
    city_inf.append(array)

city_inf.sort(key=lambda x:x[2])
order_counter = {}

for list in city_inf:
    if list[1] in order_counter.keys():
        order_counter[list[1]] += 1
        list.append(order_counter[list[1]])
    else:
        order_counter[list[1]] = 1
        list.append(1)

city_inf.sort(key=lambda x:x[0])
zero_p = ''
zero_y = ''
for list in city_inf:
    zero_p = '0'*(6-len(str(list[1])))
    zero_y = '0'*(6-len(str(list[3])))
    list.append(zero_p + str(list[1]) + zero_y + str(list[3]))
    print(list[4])

Measured memory_bytes: 45784
import java.io.InputStream;
import java.io.PrintStream;
import java.util.*;

public class Main {

  public static void main(String[] args) {
    solve(System.in, System.out);
  }

  private static final long MOD = 1000000007L;

  static void solve(InputStream is, PrintStream os) {
    Scanner sc = new Scanner(is);

    /* read */
    int n = sc.nextInt();
    int k = sc.nextInt();

    Map<Integer, Set<Integer>> connected = new HashMap<>();

    for (int i = 0; i < n - 1; i++) {
      int a = sc.nextInt();
      int b = sc.nextInt();
      Set<Integer> conn;

      // a -> b
      conn = connected.getOrDefault(a, new HashSet<>());
      conn.add(b);
      connected.put(a, conn);

      // b -> a
      conn = connected.getOrDefault(b, new HashSet<>());
      conn.add(a);
      connected.put(b, conn);
    }
    Set<Integer> done = new HashSet<>();

    long value = dfs(1, 1, connected, done, k, k, 0);
    os.println(value);
  }

  private static long dfs(int node, long value, Map<Integer, Set<Integer>> connected, Set<Integer> done, long k, long color, int grandParent) {
    done.add(node);
    value = value * color % MOD;
    long colored = 0;

    if (!connected.containsKey(node)) return value;

    for (Integer next : connected.get(node)) {
      if (done.contains(next)) continue;
      colored++;
      value = dfs(next, value, connected, done,k, (k - colored - grandParent) , 1);
    }
    return value;
  }
}

Measured memory_bytes: 140224
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> iint;
typedef pair<ll,ll> llll;
#define ALL(x) (x).begin(),(x).end()
const ll zero = 0;
const ll one = 1;
const ll INF = 9223372036854775807; //10^18
const int inINF = 2147483647; //10^9
const ll MOD = 1000000007; //10^9+7
const ll MOD2 = 998244353;
void Yes() {printf("Yes\n");}
void No() {printf("No\n");}
void YES() {printf("YES\n");}
void NO() {printf("NO\n");}

int main(){
    int N;
    cin >> N;
    vector<int> A(N);
    for (int i = 0; i < N; i++) {
        cin >> A[i];
    }
    vector<iint> s(N);
    for (int i = 0; i < N; i++) {
        s[i].first = A[i];
        s[i].second = i;
    }
    sort(ALL(s));
    for (int var = 0; var < N; var++) {
        printf("%d ", s[var].second+1);
    }
    cout << endl;

}

Measured memory_bytes: 4548
#include <stdio.h>
#include <vector>
#include <memory.h>
#include <iostream>
#include <map>
#include <algorithm>
  
// Shabdan Batyrkulov
  
using namespace std;
  
#define pb push_back
#define fr first
#define sc second
#define mk make_pair
#define ll long long
#define ld long double
#define vi vector <int>
#define pii pair <int, int>
#define OK puts("OK");                                                                           
                                                                                                
const int N = (int)1e5 + 7;                                                                 
const int inf = (int)1e9 + 7;
const int MAX = (int)1e2 + 7;

int a[N];

int main () {                                
	int n; scanf ("%d", &n);
	int mn = inf, mx = -inf;
	for (int i = 1; i <= n; i++) {
		scanf ("%d", a + i);
		mx = max(mx, a[i]);
		mn = min(mn, a[i]);
	}
	cout << mx - mn;

}    


Measured memory_bytes: 256
import java.util.*;
public class Main {
	public static void main(String[] a) {
		try (Scanner s = new Scanner(System.in)) {
			int sx = s.nextInt();
			int sy = s.nextInt();
			int tx = s.nextInt();
			int ty = s.nextInt();
			int dx = tx - sx;
			int dy = ty - sy;
			output(dx, 'R');
			output(dy, 'U');
			output(1, 'R');
			output(dy + 1, 'D');
			output(dx + 1, 'L');
			output(dy + 1, 'U');
			output(dx, 'R');
			output(1, 'U');
			output(dx + 1, 'L');
			output(dy + 1, 'D');
			output(1, 'R');
		}
	}
	static void output(int count, char c) {
		for (int i = 0; i < count; i++) {
			System.out.print(c);
		}
	}
}

Measured memory_bytes: 24708
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep3(i, l, n) for (int i = l; i < (n); ++i)
#define sz(v) (int)v.size()
#define inf (int)(1e9+7)
#define INF (ll)(1e18)
#define abs(x) (x >= 0 ? x : -(x))
#define ceil(a, b) a / b + !!(a % b)
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return 1; } return 0; }
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }








int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    /*
    int n;
    cin >> n;
    vector<int> v(n);
    rep(i, n) cin >> v[i];
    */
    
    
    int n;
    cin >> n;
    string s;
    cin >> s;
    rep(i, sz(s)) {
        cout << (char)(s[i] + n - (s[i] + n > 'Z' ? 26 : 0));
    }
    cout << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
#define all(x) (x).begin(),(x).end()
#define pll pair<ll,ll>
#define pii pair<int,int>
#define rep(i,n) for(int i=0;i<n;i++)
#define sz(x) ((ll)(x).size())
#define pb push_back
#define mp make_pair
#define bit(n) (1LL<<(n))
#define F first
#define S second
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
const ll INF = 1LL<<60;
const ll mod = (int)1e9 + 7;

ll merge_cnt(vector<int> &a) {
    int n = a.size();
    if (n <= 1) { return 0; }

    ll cnt = 0;
    vector<int> b(a.begin(), a.begin()+n/2);
    vector<int> c(a.begin()+n/2, a.end());

    cnt += merge_cnt(b);
    cnt += merge_cnt(c);

    int ai = 0, bi = 0, ci = 0;
    // merge の処理
    while (ai < n) {
        if ( bi < b.size() && (ci == c.size() || b[bi] <= c[ci]) ) {
            a[ai++] = b[bi++];
        } else {
            cnt += n / 2 - bi;
            a[ai++] = c[ci++];
        }
    }
    return cnt;
}

int main() {
    string s;
    cin >> s;
    int n=s.length();
    int cnt[26]={};
    rep(i,n)cnt[s[i]-'a']++;
    int hc[26];
    int kis=0;
    int kpos=-1;
    rep(i,26){
        if(cnt[i]%2){
            kis++;
            kpos=i;
        }
        hc[i]=cnt[i]/2;
        cnt[i]=0;
    }
    if(kis>=2){
        cout << -1;
        return 0;
    }
    ll sum=0;
    int lef=0;
    vector<int> cpos[26];
    vector<int> shio(n);
    rep(i,n){
        int tea=s[i]-'a';
        if(cnt[tea]<hc[tea]){
            shio[i]=lef;
            cpos[tea].pb(n-lef-1);
            lef++;
           	cnt[tea]++;
        }
        else{
          	//cerr << '!';
          	if(cnt[tea]==hc[tea] && kpos==tea){
              	shio[i]=n/2;
              	cnt[tea]++;
            }
            else{
              	shio[i]=cpos[tea].back();
           		cpos[tea].pop_back();
            }
        }
      	cerr << shio[i];
    }
    cout << merge_cnt(shio);
}

/*


 */





Measured memory_bytes: 3264
using System;
using System.Linq;
class Atcoder
{
    static void Main(string[] args)
    {
        int[] a = Console.ReadLine().Split().Select(int.Parse).ToArray();
        if (500*a[0] >= a[1])
        {
            Console.WriteLine("Yes");
        }
        else
        {
            Console.WriteLine("No");
        }
    }
}

Measured memory_bytes: 13268
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>

using ll = unsigned long long;
// #define int long long
using namespace std;

// http://drken1215.hatenablog.com/entry/2019/02/24/224100
// INFは適当に大きな値をいれておけばいい，かならずしもINFINITY, INTMAXではない．
// https://qiita.com/nomikura/items/4e66f708895fb7db76d1
// https://teratail.com/questions/92052

void chmin(int &a, int b) {
    // b のが小さければ，aを入れ替える
     if (a > b) {
         a = b;
     } 
}


// solve
int rec(int i, int a, int b, int c, const int n, const int ca, const int cb, const int cc, int* l) {

    if(i == n) {
        if(!a || !b || !c) {
            // 1本も使ってない
            // 大きめの値にする
            return INT32_MAX-1000;
            // return INFINITY;
        }
        // 合体後の差分
        return abs(a-ca) + abs(b-cb) + abs(c-cc);
    }

    // 選ばないことにした場合のコスト
    int res = rec(i+1,a,b,c,n,ca,cb,cc,l);
    // Aにマージした際のコスト
    chmin(res, rec(i+1, a+l[i], b,c,n,ca,cb,cc,l)+(a>0 ?10:0));
    // Bにマージした際のコスト
    chmin(res, rec(i+1, a, b+l[i],c,n,ca,cb,cc,l)+(b>0 ?10:0));
    // Cにマージした際のコスト
    chmin(res, rec(i+1, a, b,c+l[i],n,ca,cb,cc,l)+(c>0 ?10:0));
    // 1本目はコスト増加なし

    // それぞれを選んだ場合のコストの小さい値にresを入れ替える
    // 深さ優先探索の結果，最小のresがドンドン上に伝搬する
    // 最終的には，全ノードを考慮した探索が行える

    // cout << res << endl;
    return res;

}


int main() {

    int n, a, b, c;
    cin >> n >> a >> b >> c;
    int *l = new int[n];

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

    cout << rec(0,0,0,0,n,a,b,c,l) << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <queue>
#include <cmath>
// #include <atcoder/all>
using namespace std;
// using namespace atcoder;

int myfind(int a, vector<int>& relation) {
    if (relation[a] == a) return a;
    int res = myfind(relation[a], relation);
    relation[a] = res;
    return res;
}

void myunion(int a, int b, vector<int>& relation) {
    int ta = myfind(a, relation);
    int tb = myfind(b, relation);
    if (ta == tb) return;
    relation[ta] = tb;
}


int main() {
	int n, m;
	cin >> n >> m;
	vector<int> relation(n + 1, 0);
	for (int i = 1; i <= n; i++) {
		relation[i] = i;
	}
	for (int i = 0; i < m; i++) {
		int a, b;
		cin >> a >> b;
		myunion(a, b, relation);
	}
	unordered_set<int> us;
	for (int i = 1; i <= n; i++) {
		us.insert(myfind(i, relation));
	}
	cout << us.size() - 1 << endl;
}






Measured memory_bytes: 7108
#include<iostream>
#include <cstring>
#include <map>
#include <queue>
using namespace std;

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

char lab[10][10];
struct NODE{
	int x,y;
	int px[3],py[3];
	int dead;
	int cdead;
	NODE(){
		x = y = 0;
		px[0] = px[1] = px[2] = 0;
		py[0] = py[1] = py[2] = 0;
		dead = 0;
		cdead = 0;
	}
};
bool operator < (const NODE &a,const NODE &b){
	if( a.x != b.x ) return a.x < b.x;
	if( a.y != b.y ) return a.y < b.y;
	if( a.px[0] != b.px[0] ) return a.px[0] < b.px[0];
	if( a.px[1] != b.px[1] ) return a.px[1] < b.px[1];
	if( a.px[2] != b.px[2] ) return a.px[2] < b.px[2];
	if( a.py[0] != b.py[0] ) return a.py[0] < b.py[0];
	if( a.py[1] != b.py[1] ) return a.py[1] < b.py[1];
	if( a.py[2] != b.py[2] ) return a.py[2] < b.py[2];
	if( a.dead != b.dead ) return a.dead < b.dead;
	if( a.cdead != b.cdead ) return a.cdead < b.cdead;
	return false;
}

int main(){
	int H,W;
	while( cin >> H >> W && H ){
		int wx[3],wy[3];
		map<NODE,int> done;
		NODE fst; int cc = 0 , ww = 0;
		for(int i = 0 ; i < H ; i++){
			for(int j = 0 ; j < W ; j++){
				cin >> lab[i][j];
				if( lab[i][j] == '@' ) fst.x = j , fst.y = i;
				if( lab[i][j] == 'c' ){
					fst.px[cc] = j;
					fst.py[cc++] = i;
				}
				if( lab[i][j] == 'w' ){
					wx[ww] = j;
					wy[ww++] = i;
				}
			}
		}
		deque< pair<int,NODE> > Q;
		done[fst] = 0;
		Q.push_front(make_pair(0,fst));
		
		while( Q.size() ){
			NODE q = Q.front().second;
			int cost = Q.front().first;
			Q.pop_front();
			if( done[q] != cost ) continue;
			if( lab[q.y][q.x] == 'E' ){
				cout << cost << endl;
				goto exit;
			}
			for(int d = 0 ; d < 4 ; d++){
				int tx = q.x + dx[d];
				int ty = q.y + dy[d];
				if( lab[ty][tx] == '#' ) continue;
				int fail = 0;
				for(int i = 0 ; i < ww ; i++){
					if( !(q.dead >> i & 1) && tx == wx[i] && ty == wy[i] ) fail = 1;
				}
				if(fail) continue;
				
				NODE next = q;
				for(int i = 0 ; i < cc ; i++){
					if( !(q.cdead >> i & 1) && tx == q.px[i] && ty == q.py[i] ){
						int mx = tx;
						int my = ty;
						while( lab[my+dy[d]][mx+dx[d]] != '#' ){
							int br = 0;
							for(int j = 0 ; j < cc ; j++){
								if( !(q.cdead >> j & 1) && mx+dx[d] == q.px[j] && my+dy[d] == q.py[j] )
									br = 1;
							}
							if(br) break;
							mx += dx[d];
							my += dy[d];
							for(int j = 0 ; j < ww ; j++){
								if( !(q.dead >> j & 1) && mx == wx[j] && my == wy[j] ){
									br = 1;
									next.cdead |= (1<<i);
									next.dead |= (1<<j);
									mx = 0;
									my = 0;
									break;
								}
							}
							if(br) break;
						}
						next.px[i] = mx;
						next.py[i] = my;
						tx = q.x;
						ty = q.y;
					}
				}
				int diff = q.y != ty || q.x != tx;
				next.x = tx , next.y = ty;
				if( !done.count(next) || done[next] > cost+diff ){
					if( diff ) Q.push_back(make_pair(diff+cost,next));
					else       Q.push_front(make_pair(diff+cost,next));
					
					done[next] = cost+diff;
				}
			}
		}
		cout << -1 << endl;
		exit:;
		
	}
}

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

typedef long long ll;
int D,l,cnt[100];
ll pw[100],v[100];

int getlen(ll x){
	int len=0;
	while(x)++len,x/=10;
	return len;
}

ll dfs(int i,ll now){
	if(i==l/2)return now==D;
	ll ret=0;
	for(int d=-9;d<=9;++d){
		ll nxt=now+v[i]*d;
		if(abs(nxt-D)>v[i])continue;
		ret+=(cnt[d+9]-(i==0&&d>=0))*dfs(i+1,nxt);
	}
	return ret;
}

int main(){
	scanf("%d",&D);
	for(int i=pw[0]=1;i<19;++i)pw[i]=10*pw[i-1];
	for(int i=0;i<=9;++i)for(int j=0;j<=9;++j)++cnt[i-j+9];
	int ld=getlen(D);
	ll ans=0;
	for(l=ld;l<=2*ld;++l){
		for(int i=0;i<=(l-1)/2;++i)v[i]=pw[l-i-1]-pw[i];
		ll tmp=dfs(0,0);
		if(l%2)tmp*=10;
		ans+=tmp;
	}
	printf("%lld\n",ans);
	return 0;
}


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

int main() {
  int n;
  cin >> n;
  vector<int> p(n);
  for (int i = 0; i < n; i++) {
    cin >> p[i];
  }
  int ans=0;
  for (int i = 2; i < n; i++) {
    if ((p[i-2] < p[i-1]) && (p[i-1] < p[i])) ans++;
    else if ((p[i-2] > p[i-1]) && (p[i-1] > p[i])) ans ++;
  }
  cout << ans;
}


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

public class Main{
	
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		String S=sc.next();
		char[] c=S.toCharArray();
		boolean flag=true;
		for(int i=0;i<c.length-1;i++) {
			if(c[i]==c[i+1]) {
				flag=false;
				
			}
			
			
		}
		if(flag) {
			System.out.println("Good");
			
		}else {
			System.out.println("Bad");
		}
		
		
		
		
	
		
		
}
}


Measured memory_bytes: 22612
#include <iostream>
#include<string>
#include<algorithm>
#include<vector>
using namespace std;
 
int main(){
    int A,B,K;
    int l=0;
    cin>>A>>B>>K;
    vector<int> vec(100);
    for(int i=1;i<101;i++){
        if(A%i==0&&B%i==0){
            
            vec.at(l)=i; 
        
            l++;
           
        }
    }
    cout<<vec.at(l-K)<<endl;
}

Measured memory_bytes: 384
import java.io.IOException;
import java.io.InputStream;
import java.util.NoSuchElementException;

public class Main {
	public static void main(String args[]){
		FastScanner sc = new FastScanner();

        //Mathクラス使うより普通に掛け算したほうが早い
        int x = sc.nextInt();
        System.out.println(x * x * x);
	}
}

class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        }else{
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }
    private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
    private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
    public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}
    public String next() {
        if (!hasNext()) throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while(isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }
    public long nextLong() {
        if (!hasNext()) throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while(true){
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            }else if(b == -1 || !isPrintableChar(b)){
                return minus ? -n : n;
            }else{
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }
    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
        return (int) nl;
    }
    public double nextDouble() { return Double.parseDouble(next());}
}

Measured memory_bytes: 21204
#include<bits/stdc++.h>
#define lli long long int
using namespace std;
int main()
{
	int n;
	cin>>n;
	int a[n+1];
	for(int i =1; i<=n; i++)
	{
		a[i]=i;
	}
	for(int i =3; i<=n; i+=3)
	{
		a[i]=0;
	}
	for(int i =5; i<=n; i+=5)
	{
		a[i]=0;
	}
	lli sum=0;
	for(int i=1; i<=n; i++)
	{
		sum+=a[i];
	}
	cout<<sum;
}

Measured memory_bytes: 7544
#include<iostream>
#include<vector>
#include<string>
#include<map>
#include<algorithm>
using namespace std;

int StringComp(const string &s1, const string &s2){
	return s1.compare(s2);
}

int main(void){
	map< string, vector< int > > m;
	while( true ){
		string word;
		int page;

		cin >> word >> page;
		if( cin.eof() ) break;

		m[word].push_back(page);
	}
	map< string, vector< int > >::iterator itM = m.begin();
	while(itM != m.end()){
		sort(itM->second.begin(), itM->second.end());
		cout << itM->first << '\n';
		cout << itM->second[0];
		for(unsigned int i = 1; i < itM->second.size(); i++){
			cout << ' ' << itM->second[i];
		}
		cout << endl;
		itM++;
	}
	return 0;
}

Measured memory_bytes: 0
using System;
using System.Collections.Generic;
using System.Linq;


namespace _514_Quality_Checking
{
	class Program
	{
		static void Main ( string[] args )
		{
			while (true)
			{
				//??\???
				int[] inputNum = Console.ReadLine ().Trim ().Split (' ').Select (( str ) => int.Parse (str)).ToArray ();

				if (inputNum[0] == 0 && inputNum[1] == 0 && inputNum[2] == 0)
					break;

				int setCount = int.Parse (Console.ReadLine ().Trim ());

				//??????
				PartsState parts = new PartsState (inputNum[0], inputNum[1], inputNum[2]);

				for (int lp = 0; lp < setCount; lp++)
				{
					int[] order = Console.ReadLine ().Trim ().Split (' ').Select (( str ) => int.Parse (str)).ToArray ();
					parts.SetState (order[0], order[1], order[2], order[3]);
				}

				parts.Check ();
				
				//??????
				foreach (var item in parts.Parts)
				{
					Console.WriteLine (item);
				}
			}
		}
	}
}

class PartsState
{
	public PartsState ( int partsACount, int partsBCount, int partsCCount )
	{
		this.PartsList = new List<PartsClass> (partsACount + partsBCount + partsCCount);
		this.Parts = new int[partsACount + partsBCount + partsCCount];

		for (int lp = 0; lp < this.Parts.Length; lp++)
		{
			this.Parts[lp] = Initialize;
		}
	}

	private List<PartsClass> PartsList { set; get; }
	public int[] Parts { private set; get; }
	const int Initialize = -1;
	const int Failure = 0;
	const int Normal = 1;
	const int Unknown = 2;

	public void SetState ( int partsA, int partsB, int partsC, int pass )
	{
		//1.pass	0.do not pass
		//????????°??????????????¨???????????¨????????¨??????1??????
		partsA--; partsB--; partsC--;

		if (pass == 1)
		{
			Parts[partsA] = Normal;
			Parts[partsB] = Normal;
			Parts[partsC] = Normal;
		}
		else
		{
			PartsList.Add (new PartsClass (partsA, partsB, partsC));
		}
	}

	public void Check ()
	{
		int previousCount = -1;

		while (PartsList.Count != 0 && previousCount != PartsList.Count)
		{
			previousCount = PartsList.Count;

			//???????????§??????????¢??????????????????????
			var failureList = PartsList.Where (( list ) =>
				(Parts[list.PartsA] == Normal && Parts[list.PartsB] == Normal ||
				Parts[list.PartsB] == Normal && Parts[list.PartsC] == Normal ||
				Parts[list.PartsC] == Normal && Parts[list.PartsA] == Normal
				));

			foreach (var item in failureList)
			{
				Solve (item.PartsA, item.PartsB, item.PartsC);
			}

			//?¢???????????????????????????????
			PartsList.Except (failureList);
		}

		for (int lp = 0; lp < Parts.Length; lp++)
		{
			if (Parts[lp] == Initialize)
				Parts[lp] = Unknown;
		}

	}

	private void Solve ( int indexA, int indexB, int indexC )
	{
		//b c
		if (Parts[indexA] == Initialize)
			Parts[indexA] = Failure;
		//a c
		else if (Parts[indexB] == Initialize)
			Parts[indexB] = Failure;
		// b c
		else if (Parts[indexC] == Initialize)
			Parts[indexC] = Failure;
	}
}

class PartsClass
{
	public PartsClass ( int partsA, int partsB, int partsC )
	{
		this.PartsA = partsA;
		this.PartsB = partsB;
		this.PartsC = partsC;
	}

	public int PartsA { private set; get; }
	public int PartsB { private set; get; }
	public int PartsC { private set; get; }
}

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

int main() {
    {int n; cin >> n;}
    string s;
    cin >> s;
    int_fast64_t cur(0), mn(0);
    for(auto i : s){
        cur += (i ^ '(') ? -1 : 1;
        mn = min(cur, mn);
    }
    cur -= mn;
    for(; ++mn <= 0; fputc('(', stdout));
    cout << s;
    for(; --cur >= 0; fputc(')', stdout));
    cout << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD = 1e9 + 7;
const int iinf = 1 << 28;
const long long llinf = 1ll << 60;
const double PI = 3.14159265;

int main() {
    ll a, b, k; cin >> a >> b >> k;
    ll t = max(0ll, a - k);
    ll A = b;
    if (k >= a) {
        A = max(0ll, b - (k - a));
    }
    cout << t << " " << A;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define MOD 1000000007
#define INF 1000000000
#define LINF 1000000000000000000
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define bit(n) (1LL<<(n))
using namespace std;

typedef pair<int, int> P;
typedef pair<long long, long long> LLP;

int main() {

    int N, X;
    cin >> N >> X;
    int minimum = INF;
    rep(i,N) {
        int m;
        cin >> m;
        X -= m;
        minimum = min(minimum, m);
    }

    cout << (X / minimum + N) << endl;

    return 0;
}

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

typedef long long ll;

int main() {

#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif

    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    ll n = 0, m = 0, k = 0;
    cin >> n >> m >> k;

    vector<ll> a(n + 1, 0);
    vector<ll> b(m + 1, 0);

    ll sum_a = 0;
    ll sum_b = 0;
    ll max_a = -1;
    ll max_b = -1;
    for(int i = 1; i <= n; i++) {
        cin >> a[i];
        sum_a += a[i];
        a[i] = sum_a;

        if(sum_a <= k) max_a = i;
    }
    for(int i = 1; i <= m; i++) {
        cin >> b[i];
        sum_b += b[i];
        b[i] = sum_b;

        if(sum_b <= k) max_b = i;
    }


    int ans = 0;

    if(a[n] + b[m] <= k) ans = n + m;
    for(int i = 0; i <= max_a; i++) {
        ll temp = k - a[i];
        vector<ll>::iterator it;

        it = upper_bound(b.begin(), b.begin() + max_b + 1, temp);
        ans = max(ans, i + (int) (it - b.begin() - 1));
    }

    cout << ans << endl;




    return 0;
}

Measured memory_bytes: 6352
#include<bits/stdc++.h>
 
using namespace std;
 
int N, Left[100009], Right[100009], sz[100009];
multiset < long long > L, R;
long long leftDeflection, rightDeflection, ans = 0;
 
int main ()
{
//freopen ("input", "r", stdin);
//freopen ("output", "w", stdout);
 
scanf ("%d", &N);
for (int i=1; i<=N; i++)
    scanf ("%d %d", &Left[i], &Right[i]), sz[i] = Right[i] - Left[i];
L.insert (Left[1]), leftDeflection = 0;
R.insert (Left[1]), rightDeflection = 0;
for (int i=2; i<=N; i++)
{
    int A = sz[i - 1], B = sz[i];
    ///f(x) = min (f(x - A), ..., f(x + B)
    leftDeflection += B, rightDeflection += A;
    long long x = Left[i], st = (*L.rbegin ()) - leftDeflection, dr = (*R.begin ()) + rightDeflection;
    if (st <= x && x <= dr)
    {
        L.insert (x + leftDeflection);
        R.insert (x - rightDeflection);
        continue;
    }
    if (x < st)
    {
        ans += st - x;
        auto it = L.end (); it --;
        L.erase (it);
 
        L.insert (x + leftDeflection);
        L.insert (x + leftDeflection);
        R.insert (st - rightDeflection);
        continue;
    }
    ans += x - dr;
    R.erase (R.begin ());
 
    L.insert (dr + leftDeflection);
    R.insert (x - rightDeflection);
    R.insert (x - rightDeflection);
}
printf ("%lld\n", ans);
return 0;
}

Measured memory_bytes: 10752
n, m = tuple(map(int, input().split(" ")))
matrixA = [list(map(int, input().split(" "))) for i in range(n)]
col_vecB = [int(input()) for i in range(m)]

for a in matrixA:
    c = 0
    for ai, b in zip(a, col_vecB):
        c += ai * b
    print(c)


Measured memory_bytes: 6020
#include <iostream>

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

int
main()
{
  int r, g, b;
  cin >> r >> g >> b;
  cout << ((r * 100 + g * 10 + b) % 4 == 0 ? "YES" : "NO") << endl;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<queue>
#include<map>
#include<cmath>
using namespace std;
#define REP(i, limit) for(int i=0; i< limit; ++i)
#define FOR(i, j, limit) for(int i=j; i< limit; ++i)
#define DUMP(a) REP(d,a.size()){cout<<a[d];if(d!=a.size()-1)cout<<" ";else cout<<endl;}
#define LL long long
int INF = 2147483647;
LL LINF = 9223372036854775807;
LL MOD = 1000000007;
typedef pair<int, int>P;
typedef pair<LL, LL>PL;
typedef vector<int> vi;
typedef vector<LL> vl;

int ans=0;
int N;

bool func(LL n){
  int th=0, fi=0, se=0;
  while(n>0){
    if(n%10==3)++th;
    else if(n%10==5)++fi;
    else ++se;
    n/=10;
  }
  if(th*fi*se>0)return true;
  else return false;
}

void search(LL n){
  if(n>N) return;
  if(func(n)) ++ans;
  n=n*10;
  search(n+3);
  search(n+5);
  search(n+7);
  //cout<<0;
}

int main(){
  cin>>N;
  search(0);
  cout<<ans<<endl;


  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A, B;
  string op;
  cin >> A >> op >> B;
  if (op == "+"){
    cout << A + B << endl;
  }else if (op == "-"){
    cout << A - B << endl;
  }else {
    cout << "Error" << endl;
  }
}

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

typedef uint64_t u64;
typedef int64_t i64;
typedef uint32_t u32;
typedef int32_t i32;
typedef uint16_t u16;
typedef int16_t i16;
typedef uint8_t u8;
typedef int8_t i8;

using namespace std;

#define rep(idx, N) for (u64 idx = 0; idx < N; idx++)

u64 f1[200005];
u64 f2[200005];

u64 b1[200005];
u64 b2[200005];

u32 f(u32 x, u32 p) {
  u32 ret = 0;
  while (x != 0) {
    x = x % p;
    p = __builtin_popcount(x);
    ret++;
  }
  return ret;
}

int main() {
  u32 n;
  string x;

  cin >> n >> x;
  u32 p = 0;
  for (char c : x) {
    if (c == '1') {
      p++;
    }
  }

  if (p == 0) {
    rep(i, n) cout << 1 << endl;
    return 0;
  }

  b1[0] = 1;
  for (u32 i = 1; i < n; i++) {
    b1[i] = (b1[i - 1] * 2) % (p + 1);
    f1[i] = f(i, p + 1);
  }

  if (p > 1) {
    b2[0] = 1;
    for (u32 i = 1; i < n + 1; i++) {
      b2[i] = (b2[i - 1] * 2) % (p - 1);
      f2[i] = f(i, p - 1);
    }
  }

  u64 d1 = 0, d2 = 0;

  rep(i, n) {
    if (x[n - i - 1] == '1') {
      d1 += b1[i];
      d1 %= (p + 1);

      if (p > 1) {
        d2 += b2[i];
        d2 %= (p - 1);
      }
    }
  }

  rep(i, n) {
    if (x[i] == '1') {
      if (p == 1) {
        cout << 0 << endl;
        continue;
      }
      u32 ans = f2[(d2 + (p - 1) - b2[n - 1 - i]) % (p - 1)];
      if (ans == 0)
        cout << 1 << endl;
      else
        cout << ans << endl;
    } else {
      u32 ans = f1[(d1 + (p + 1) + b1[n - 1 - i]) % (p + 1)];
      if (ans == 0)
        cout << 1 << endl;
      else
        cout << ans << endl;
    }
  }

  return 0;
}


Measured memory_bytes: 9996
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define fi first
#define se second
typedef pair<ll, ll> P;
using VP = vector<P>;
using VVP = vector<VP>;
using VI = vector<ll>;
using VVI = vector<VI>;
using VVVI = vector<VVI>;
const int inf = 1e9 + 7;
const ll INF = 1LL << 61;
const ll mod = 1e9 + 7;

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

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

int h, w;
VVI s;
int dx[] = {-1, 0, 1, 0};
int dy[] = {0, 1, 0, -1};

bool val(int x, int y) {
    if (x >= 0 && x < h && y >= 0 && y < w && s[x][y] == 1)
        return 1;
    else
        return 0;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int i, j;
    cin >> h >> w;
    int ch, cw, dh, dw;
    cin >> ch >> cw >> dh >> dw;
    ch--;
    cw--;
    dh--;
    dw--;
    s = VVI(h, VI(w, 1));
    for (i = 0; i < h; i++) {
        for (j = 0; j < w; j++) {
            char c;
            cin >> c;
            if (c == '#') s[i][j] = 0;
        }
    }
    deque<P> q;
    VVI dis(h, VI(w, INF));
    q.push_front(P(ch, cw));
    dis[ch][cw] = 0;
    while (q.size()) {
        P u = q.front();
        q.pop_front();
        for (int k = 0; k < 4; k++) {
            if (val(u.fi + dx[k], u.se + dy[k])) {
                if (dis[u.fi + dx[k]][u.se + dy[k]] > dis[u.fi][u.se]) {
                    dis[u.fi + dx[k]][u.se + dy[k]] = dis[u.fi][u.se];
                    q.push_front(P(u.fi + dx[k], u.se + dy[k]));
                }
            }
        }
        for (int kx = -2; kx <= 2; kx++) {
            for (int ky = -2; ky <= 2; ky++) {
                if (val(u.fi + kx, u.se + ky)) {
                    if (dis[u.fi + kx][u.se + ky] > dis[u.fi][u.se] + 1) {
                        dis[u.fi + kx][u.se + ky] = dis[u.fi][u.se] + 1;
                        q.push_back(P(u.fi + kx, u.se + ky));
                    }
                }
            }
        }
    }
    if (dis[dh][dw] == INF)
        cout << -1 << endl;
    else
        cout << dis[dh][dw] << endl;
}

Measured memory_bytes: 19508
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> pi;
typedef pair<ll, ll> pll;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;

#define imx INT_MAX
#define imn INT_MIN
#define llmx LLONG_MAX
#define llmn LLONG_MIN
#define INF         100000000000000000
#define PI          3.1415926535897932384626433832795l



#define fi first
#define se second
#define pb push_back
#define f_s(a) sort(a.begin(), a.end())
#define b_s(a) sort(a.rbegin(), a.rend())
#define p(a) cout<<a<<"\n"


// ll mod = 1000000007;
// #define l(i, )
// #define rl(i, a, b) for(int i = a; i < b; i++)






// struct mycomp {
//     bool operator() (const pair<int,int> &a, const pair<int,int> &b) const{
//         if (a.second-a.first != b.second-b.first)
//         return (a.second-a.first > b.second-b.first);
//         return a.first < b.first;
//     }
// };



/////////////////////GCD//////////////////////
ll gcd(ll a, ll b)
{
	if(b==0) return a;
	return gcd(b, a%b);
}


ll extended_gcd(ll a, ll b, ll& x, ll& y)
{
	if(b==0)
	{
		x=1;
		y=0;
		return a;
	}
	ll x1, y1;
	ll d = extended_gcd(b, a%b, x1, y1);
	x=y1;
	y=x1-y1*(a/b);
	return d;
}

////////////////////SIEVE OF ERATOSTHENES//////////////////////
vector<int> sieveoferatosthenes(int n)
{
	vector<bool> prime(n+1, true);
	for(int i = 2; i <= sqrt(n); i++)
	{
		if(prime[i])
		{
			for(int j = i*i; j<=n; j+=i)
			{
				prime[j]=false;
			}
		}
	}	
	vector<int> all_primes;
	for(int i = 2; i <=n; i++)
	{
		if(prime[i]) all_primes.pb(i);
	}
	return all_primes;
}

////////////////////BINARY EXPONENTIATION///////////////////////
ll bin_exp(ll a, ll b, ll mod)
{
	ll ans = 1;
	while(b)
	{
		if(b%2)
		{
			b--;
			ans = (ans%mod*a%mod)%mod;
		}
		b/=2;
		a = (a%mod*a%mod)%mod;
	}
	return ans;
}


///////////////////////////BFS//////////////////////////////////
void bfs(vector<int>& distance, vector<int> a[], vector<bool>& visited, int u, vector<int>& parent)
{
	visited[u]=true;
	parent[u]=-1;
	distance[u]=0;
	queue<int> q;

	q.push(u); 
    while (!q.empty()) { 
  
        int f = q.front(); 
        q.pop(); 
  		for(int i =0; i < a[f].size(); i++)
  		{
  			if(visited[a[f][i]]==false)
  			{
  				distance[a[f][i]]=distance[f]+1;
  				parent[a[f][i]]=f;
  				visited[a[f][i]]=true;
  				q.push(a[f][i]);
  			}
  		}
    } 

}

void solve()
{

}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	// #ifndef ONLINE_JUDGE
	// freopen("input.txt", "r", stdin);
	// freopen("output.txt", "w", stdout);
	// #endif
	int t=1;
	// cin>>t;
	while(t--)
	{
		double d, t, s;
		cin>>d>>t>>s;
		if((d*1.0)/s <= t)
			cout<<"Yes"<<endl;
		else cout<<"No"<<endl;

	}
	return 0;
}

Measured memory_bytes: 3740
#include <iostream>
#include <utility>
#include <map>
#include <vector>
#include <algorithm>
#include <queue>
#include <math.h>
#include <stack>
#include <set>
#include <deque>
#include <cmath>

using namespace std;
typedef long long ll;
ll mod = 1e9+7;
//ll mod = 998244353;
#define rep(i,n) for(int i = 0; i < (n); ++i)

int main() {
    ll x, y;
    cin >> x >> y;
    if (y == 1 || x % y == 0) {
        cout << -1 << endl;
        return 0;
    }
    cout << x * (y - 1LL) << endl;
    return 0;
}


Measured memory_bytes: 3572
// inputに入力データ全体が入る
function Main(input) {
	// 1行目がinput[0], 2行目がinput[1], …に入る
	input = input.split(" ");
	//文字列から10進数に変換するときはparseIntを使います
	var A = parseInt(input[0], 10);
  	var B = parseInt(input[1], 10);
  	var C = parseInt(input[2], 10);

	console.log('%d',Math.max(C - A + B, 0));
}
                   
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 7372
#include <cstdio>
#include <string>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <iterator>
#include <cassert>
#pragma warning(disable:4996) 
 
typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF  9223300000000000000
#define LINF2 1223300000000000000
#define INF 2140000000
//const long long MOD = 1000000007;
const long long MOD = 998244353;

using namespace std;

void solve()
{
    int a, b;
    scanf("%d%d", &a, &b);
    printf("%d\n", 6 - a - b);


    return;
}

int main(int argc, char* argv[])
{
#if 1
    solve();
#else
    int T; scanf("%d", &T);
    while(T--) {
        solve();
    }
#endif
    return 0;
}


Measured memory_bytes: 128