akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <cstring>

struct ListItem {
  int key;
  ListItem *next;
  ListItem *prev;
};

class List {
  ListItem *zero;

 public:
  List() {
    zero = new ListItem;
    zero->next = zero;
    zero->prev = zero;
  }

  ~List() { delete zero; }

  void insert(int key) {
    // printf("insert %d\n", key);
    ListItem *item = new ListItem;
    item->key = key;
    item->prev = zero;
    item->next = zero->next;
    zero->next = item;
    item->next->prev = item;
    // printAll();
    // printf("\n");
  }

  void del(int key) {
    // printf("delete %d\n", key);
    ListItem *item = zero->next;
    while (item != zero) {
      if (item->key == key) {
        // connect item->prev and item->next
        item->prev->next = item->next;
        item->next->prev = item->prev;
        delete item;
        break;
      }
      item = item->next;
    }
    // printAll();
    // printf("\n");
  }

  void deleteFirst() {
    // printf("deleteFirst\n");
    ListItem *item = zero->next;
    if (item != zero) {
      item->next->prev = item->prev;
      item->prev->next = item->next;
      delete item;
    }
    // printAll();
    // printf("\n");
  }

  void deleteLast() {
    // printf("deleteLast\n");
    ListItem *item = zero->prev;
    if (item != zero) {
      item->next->prev = item->prev;
      item->prev->next = item->next;
      delete item;
    }
    // printAll();
    // printf("\n");
  }

  void printAll() {
    // printf("printAll\n");
    ListItem *item = zero->next;
    // printf("%p\n", beforeFirst);
    // printf("%p\n", item);
    // printf("%p\n", afterLast);

    if (item == zero) {
      return;
    }
    printf("%d", item->key);

    while (zero != (item = item->next)) {
      printf(" %d", item->key);
      // printf("%d item:%p prev:%p next:%p [zero:%p]\n", item->key, item, item->prev, item->next, zero);
      // item = item->next;
    }
    printf("\n");
  }
};

int main(int argc, char *argv[]) {
  int n;
  scanf("%d", &n);
  List *l = new List();

  for (int i = 0; i < n; i++) {
    char op[20];
    scanf("%s", op);
    if (strcmp(op, "insert") == 0) {
      int k;
      scanf("%d", &k);
      l->insert(k);
    } else if (strcmp(op, "delete") == 0) {
      int k;
      scanf("%d", &k);
      l->del(k);
    } else if (strcmp(op, "deleteFirst") == 0) {
      l->deleteFirst();
    } else if (strcmp(op, "deleteLast") == 0) {
      l->deleteLast();
    }
  }

  l->printAll();
}


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

bool check(vector<int>a, vector<int> b){
  bool ans = false;
  double dist = 0;
  for(int i = 0; i < a.size(); i++){
    dist += (a[i]-b[i])*(a[i]-b[i]);
  }
  
  for(int i = 0; i*i <= dist; i++){
    if(i*i == (int)dist){
      ans = true;
      break;
    }
  }
  return ans;
}

int main(){
  int N,D;
  cin >> N >> D;
  vector<vector<int>> v(N, vector<int>(D));
  for(int i = 0; i < N; i++){
    for(int j = 0; j < D; j++){
      cin >> v.at(i).at(j);
    }
  }
  
  long cnt = 0; 
  for(int i = 0; i < N-1; i++){
    for(int j = i+1; j < N; j++){
      if(check(v.at(i), v.at(j))){
        cnt++;
      }
    }
  }      
        
  cout << cnt << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
int main (void)
{
	int x, y, flag=0;

	scanf("%d %d",&x, &y);

	if((x==1 || x==3 || x==5 || x==7 || x==8 || x==10 || x==12)&& 
		(y==1 || y==3 || y==5 || y==7 || y==8 || y==10 || y==12) && x<y)
		flag=1;
	else if((x==4 || x==6 || x==9 || x==11)&&
			(y==4 || y==6 || y==9 || y==11) && x<y)
		flag=1;

	if(flag)
		printf("Yes\n");
	else
		printf("No\n");

	return 0;

}

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

using namespace std;

typedef long long ll;
typedef long double ld;

const ll INF = 1e12;
const ll mod = 1e9+7;
const ll maxn = 1000 * 1001;

ll n , m , k, q, comp;
ll mark[maxn], a[maxn], dp[maxn];
vector<ll> g[maxn], v;

void dfs(ll u)
{
    mark[u] = 1;
    for(ll i = 0; i < g[u].size(); i++)
        if(mark[g[u][i]] == 0)
            dfs(g[u][i]);
    v.push_back(u);
}

int main()
{
    cin>> n >> m;

    for(ll i = 1; i <= m; i++)
    {
        ll x, y; cin>> x >> y;
        g[x].push_back(y);
    }

    for(ll i = 1; i <= n; i++)
        if(mark[i] == 0)
            dfs(i);
    ll ans = 0;
    for(ll i = 0; i < n; i++)
    {
        if(g[v[i]].size())
            for(ll j = 0; j < g[v[i]].size(); j++)
                dp[v[i]] = max(dp[v[i]], dp[g[v[i]][j]] + 1);
        ans = max(ans, dp[v[i]]);
    }
    cout<< ans;
}






Measured memory_bytes: 32504
#include <bits/stdc++.h>
#define ll long long int
#define yorn(f) cout<<((f)?"Yes":"No")<<endl
#define YORN(f) cout<<((f)?"YES":"NO")<<endl
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
int main()
{
    int a, b, c;
    cin >> a >> b >> c;
    cout << (a + b + c) - max(max(a, b), c) << endl;
    return 0;
}

Measured memory_bytes: 3588
//Save Your Privacy!
#include<bits/stdc++.h>
using namespace std;

vector< vector<int> > v;
vector<int> l;

vector<int> solve(){
  vector<int> ret;
  for(int i=0; i<v.size(); i++){
    bool flag=true;
    if(v[i].size()==0)flag=false;
    for(int j=0; j<l.size()&&flag; j++){
      for(int k=0; k<v[i].size(); k++){
        if(l[j]==v[i][k])break;
        if(k==v[i].size()-1){flag=false;}
      }
    }
    if(flag)ret.push_back(i);
  }
  return ret;
}

int main(){
  int N;
  while(true){
    cin>>N;
    if(N==0)break;
    v.clear();
    l.clear();
    for(int i=0; i<N; i++){
      int M;
      vector<int> tmp;
      cin>>M;
      for(int j=0; j<M; j++){
        int t;
        cin>>t;
        tmp.push_back(t);
      }
      sort(tmp.begin(), tmp.end());
      v.push_back(tmp);
    }
    int K;
    cin>>K;
    for(int i=0; i<K; i++){
      int t;
      cin>>t;
      l.push_back(t);
    }
    vector<int> p=solve();
    if(p.size()==1)cout<<p[0]+1<<endl;
    else cout<<"-1"<<endl;
  }
  return 0;
}

Measured memory_bytes: 1268
#include<bits/stdc++.h>
using namespace std;
#define fast ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define rep(i,n) for(ll i=0;i<n;i++)
#define repp(i,a,b) for(ll i=a;i<=b;i++)
#define reff(i,a,b) for(ll i=a;i>=b;i--)
#define ll long long int
#define pll pair<ll,ll>
#define fill(a,x) memset(a,x,sizeof(a))
#define mb make_pair
#define pb push_back
#define F first
#define S second
#define M 1000000007
#define sc(x) scanf("%d",&x)
#define scc(x1,x2) scanf("%d%d",&x1,&x2)
#define sccc(x1,x2,x3) scanf("%d%d%d",&x1,&x2,&x3)
#define pr(x) printf("%lld ",x)
#define dbg(a)         std::cerr<<#a<<"="<<(a)<<"\n"
#define dbg1(a,b)       std::cerr<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<"\n"
#define dbg2(a,b,c)     std::cerr<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<", "<<#c<<"="<<(c)<<"\n"
#define dbg3(a,b,c,d)   std::cerr<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<", "<<#c<<"="<<(c)<<", "<<#d<<"="<<(d)<<"\n"
#define co cout<<"fuck"<<endl;
#define all(v) v.begin(),v.end()
const int INF = 2034567891;
const ll INF64 = 4234567890123456789ll;
long long nc3(long long v){return (v * (v - 1ll) * (v - 2ll)) / 6ll;}
long long nc2(long long v){return (v * (v - 1ll)) / 2ll;}
ll gcd(ll a, ll b) { return (b == 0 ? a : gcd(b, a % b)); }
ll lcm(ll a, ll b) { return (a * (b / gcd(a, b))); }
const int N = 10+2e6;
bool isprime(ll n) {
    if (n < 2) return 0;
    if (n == 2) return 1;
    if (n % 2 == 0) return 0;
    for (ll i = 3; i*i <= n; i++) if (n%i == 0) return 0;
    return 1;
}
double dist(pll p1, pll p2)
 {
    return (p1. F - p2.F)*(p1.F - p2.F) +
          (p1.S - p2.S)*(p1.S - p2.S);
 }
int main()
{
   ll a,b,c;
   cin>>a>>b>>c;
   a-=b;
   ll sub=a/c;
   a-=sub*c;
   cout<<a;
}

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

int main() {
    int h1,m1,h2,m2,k;
    cin >> h1 >> m1 >> h2 >> m2 >> k;
    int start = 60 * h1 + m1;
    int end = 60 * h2 + m2 - k;
    cout << end - start << endl;
    return 0;
}

Measured memory_bytes: 3636
from sys import stdin

def gcd(a, b):
    while b != 0:
        a, b = b, a%b
    return a

def lcm(a, b):
    return (a * b) // gcd(a, b)

readline = stdin.readline
num = int(readline())
d = list(map(int, readline().split()))
k = 1
MOD = 1000000007
ans = 0
for a in d:
    k = lcm(k, a)
for a in d:
    ans += k // a
print(ans % MOD)

Measured memory_bytes: 4084
#include<iostream>
#include<algorithm>
#include<vector>
#include<set>
#include<cstring>
#include<deque>
using namespace std;

#define sz(x) (int)(x.size())
#define fi(a,b) for(int i=a;i<b;++i)
#define fj(a,b) for(int j=a;j<b;++j)
#define fo(a,b) for(int o=a;o<b;++o)
#define fdi(a,b) for(int i=a-1;i>=b;--i)
#define pb push_back
#define mp make_pair
typedef pair<int, int> pii;
typedef long long ll;
//////////////////////

#ifdef _DEBUG
int const N = 41;
#else
int const N = 2e5 + 41;
#endif
int const MOD = 1e9 + 7;
int const INVTWO = (MOD + 1) / 2;

int n, p[N], two[N], ans;
vector<int> e[N];

void add(int &a, int b){
	a += b;
	if(a >= MOD) a -= MOD;
}

int mul(int a, int b){
	return (ll) a * b % MOD;
}

struct State{
	int d[3];
	State(){
		memset(d, 0, sizeof(d));
	}
	State(int a, int b, int c){
		d[0] = a;
		d[1] = b;
		d[2] = c;
	}
	void combine(const State &a){
		int d0[3];
		memset(d0, 0, sizeof(d0));
		fi(0, 3){
			fj(0, 3){
				int no = min(2, (i + j));
				add(d0[no], mul(d[i], a.d[j]));
			}
		}
		fi(0, 3) d[i] = d0[i];
	}
	void relax(){
		add(d[0], d[2]);
		d[2] = 0;
	}
};

void init(){
	two[0] = 1;
	fi(1, N) two[i] = mul(two[i-1], 2);
	fi(1, n+1) e[p[i]].pb(i);
}

deque<State> d[N];
int pos[N];

void dfs(int x){
	pos[x] = x;
	int m = sz(e[x]);
	fi(0, m){
		int y = e[x][i];
		dfs(y);
		if(sz(d[pos[y]]) > sz(d[pos[x]])) pos[x] = pos[y];
	}
	int mx = -1;
	fi(0, m){
		int y = e[x][i];
		if(pos[y] == pos[x]) continue;
		fj(0, sz(d[pos[y]])){
			d[pos[x]][j].combine(d[pos[y]][j]);
		}
		mx = max(mx, sz(d[pos[y]]));
	}
	fi(0, mx) d[pos[x]][i].relax();
	d[pos[x]].push_front(State(INVTWO, INVTWO, 0));
}

void solve(){
	init();
	dfs(0);
	fi(0, sz(d[pos[0]])){
		add(ans, d[pos[0]][i].d[1]);
	}
	ans = mul(ans, two[n+1]);
}

int main(){
#ifdef _DEBUG
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
#endif

	scanf("%d",&n);
	fi(1, n+1) scanf("%d",&p[i]);

	solve();

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

	return 0;
}

Measured memory_bytes: 239352
#include <stdio.h>
#define MAX 2000001

int A[MAX], H=0;
void maxHeapify(int);
int heapExtractMax(void);
void heapIncreaseKey(int, int);
void maxHeapInsert(int);


int main() {
  char com[8];
  int x;
  
  while ( 1 ) {
    scanf( "%s" , com );
    if ( com[0] == 'i' ) {
      scanf( "%d" , &x );
      maxHeapInsert(x);
    }
    else if ( com[2] == 't' ) {
      printf( "%d\n" , heapExtractMax() );
    }
    else if ( com[2] == 'd' ) break;
    else continue;
  }
    
  return 0;
}


void maxHeapify(int i) {
  int temp, l, r, largest;
  
  l = i*2;
  r = i*2+1;

  // ���̎q�A�����A�E�̎q�Œl���ő��̃m�[�h���I��
  if ( (l <= H) && (A[l] > A[i]) ) largest = l;
  else largest = i;
  if ( (r <= H) && (A[r] > A[largest]) ) largest = r;
  if ( largest != i ) { // i �̎q�̕����l���傫���ꍇ
    temp = A[i];
    A[i] =  A[largest];
    A[largest] = temp;
    maxHeapify(largest); // �ċA�I�ɌĂяo��
  }
}

int heapExtractMax(void) {
  int max;

  if ( H < 1 ) return 0;
  max = A[1];
  A[1] = A[H];
  H--;
  maxHeapify(1);
  
  return max;
}

void heapIncreaseKey(int i, int key) {
  int temp;
  if ( key < A[i] ) return;
  A[i] = key;
  while ( (i > 1) && (A[i/2] < A[i]) ) {
    temp = A[i];
    A[i] = A[i/2];
    A[i/2] = temp;
    i = i/2;
  }
}

void maxHeapInsert(int key) {
  H++;
  A[H] = -1;
  heapIncreaseKey(H, key);
}



Measured memory_bytes: 5696
#include<bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define repk(i,k,n) for (ll i = k; i < (ll)(n); ++i)
#define MOD 1000000007
typedef long long  ll;

using namespace std;

int ans, cnt;

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

	int A,B;
	cin >> A >> B;

	// cout << fixed << setprecision(15);
	cout << A * B << endl;
	return 0;
}

Measured memory_bytes: 3648
#include <iostream>
#include <vector>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <string>
#include <cstring>
#include <queue>
#include <stack>
#include <functional>
#include <map>
#include <set>
#include <bitset>

#define INF 0x3f3f3f3f
#define memset0(x) memset(x, 0, sizeof(x))
#define memsetM1(x) memset(x, -1, sizeof(x))
#define memsetINF(x) memset(x, INF, sizeof(x))

using namespace std;

bitset<4000005> bst;


int main()
{
	int n;
	while (cin >> n)
	{
		int sum = 0;
		int num = 0;
		bst.reset();
		bst.set(0);
		for (int i = 0; i < n; i++)
		{
			cin >> num;
			sum += num;
			bst |= (bst << num);
		}
		

		for (int i = (sum + 1) / 2; i <= 4000005; i++)
		{
			if (bst[i])
			{
				cout << i << endl;
				break;
			}
		}
	}
	

	cin.get();
	cin.get();
	return 0;
}


Measured memory_bytes: 1664
N, M = map(int, input().split())
gate_number = [i for i in range(1, M+1)]
all_L = []
all_R = []
all_gate_pass_IDs = []

for i in range(M):
    L, R = map(int, input().split())
    all_L.append(L)
    all_R.append(R)

print(len([i for i in range(max(all_L), min(all_R)+1)]))


Measured memory_bytes: 16364
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 駅の管理会社
		String s = sc.nextLine();
      
      	if(s.equals("AAA")||s.equals("BBB")){
        	System.out.println("No");
        }else{
            System.out.println("Yes");
        }
	}
}

Measured memory_bytes: 23764
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define ld long double
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; }
using P=pair<long long,long long>;
#define rep(i,n) for(long long i=0; i<(long long)n; i++)
#define req(i,n) for(long long i=n-1; i>=0; i--)
#define range(i,a,b) for(long long i=a; i<b; i++)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((long long)(x).size())
#define COUT(x) cout << x << endl
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define onBoard(y,x) (y>=0 && y<h && x>=0 && x<w)
#define pri_que priority_queue
#define vint vector<int>
#define vvint vector<vector<int>>
#define vi vector<int>
#define vvi vector<vector<int>>
#define vs vector<string>
#define vvc vector<vector<char>>
#define vc vector<char>
#define vp vector<pair<int,int>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
#define show(x) cout<<#x<<"="<<x<<endl;
#define SUM(x) accumulate(x.begin(),x.end(),0)
#define MAX(x) *max_element(x.begin(),x.end())
#define MIN(x) *min_element(x.begin(),x.end())
#define couty cout<<"Yes"<<endl
#define coutn cout<<"No"<<endl
#define coutY cout<<"YES"<<endl
#define coutN cout<<"NO"<<endl
#define yn(x) cout<<(x?"Yes":"No")<<endl
#define YN(x) cout<<(x?"YES":"NO")<<endl
long long gcd(long long a,long long b){return b?gcd(b,a%b):a;}
long long lcm(long long a, long long b){return a/gcd(a,b)*b;}
const long long dx[8]={1,0,-1,0,1,-1,-1,1};
const long long dy[8]={0,1,0,-1,1,1,-1,-1};
const long long INF = 1e15;
const long long MOD = 1e9+7;


const int MAX = 510000;
long long fac[MAX], finv[MAX], inv[MAX];
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout<<fixed<<setprecision(15);
    COMinit();
    int n,p; cin >> n>> p;
    int o=0,e=0;
    rep(i,n){
        int a; cin >> a;
        if(a%2==0)e++;
        else o++;
    }

    if(o==0)cout<<(p?0:(1LL<<e))<<endl;
    else cout<<(1LL<<(e+o-1))<<endl;


}

Measured memory_bytes: 15544
#include<iostream>
#include<string>
#include<algorithm>
#include<utility>
#include<vector>
#include<map>
#include<set>
#include<tuple>
#include<stack>
#include<queue>
#include<functional>
#include<iterator>
#include<cmath>

using namespace std;

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

	int n;
	cin >> n;

	int waru = 0;
	int warareru = n;
	while(n >= 1){
		waru += n%10;
		n /= 10;
	}

	if(warareru % waru == 0)	cout << "Yes\n";
	else					cout << "No\n";

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <string>
#include <list>
#include <math.h>
#include <string.h>
using namespace std;
typedef pair<int, int> P;
#define INF (1LL<<60)
#define int long long
#define ll long long
#define mod 1000000007

signed main(){

  int N;
  vector<int> a;
  int max_abs=-1, idx;
  vector<P> ans;

  cin >> N;
  for (int i = 0; i < N; i++){
    int t;
    cin >> t;
    a.push_back(t);
    if (abs(t) > max_abs){
      max_abs = abs(t);
      idx = i;
    }
  }

  int sign = (a[idx] >= 0 ? 1 : -1);
  for (int i = 0; i < N; i++){
    a[i] += a[idx];
    ans.push_back(P(idx + 1, i + 1));
  }

  if (sign > 0)
    for (int i = 0; i < N - 1; i++){
      a[i+1] += a[i];
      ans.push_back(P(i + 1, i + 2));
    }
  else
    for (int i = N - 1; i >= 1; i--){
      a[i-1] += a[i];
      ans.push_back(P(i + 1, i));
    }

  cout << ans.size() << endl;
  for (auto i = ans.begin(); i != ans.end(); i++)
    cout << i->first << " " << i->second << endl;

  return 0;
}

Measured memory_bytes: 256
// AOJ 2523: Time Complexity
// 2017.10.5 bal4u@uu

#include <stdio.h>
#include <ctype.h>

#define MAX 1000000000LL

long long pow(long long n, int k)
{
	long long ans = 1;
	while (k-- > 0) {
		ans *= n;
		if (ans > MAX) return -1;
	}
	return ans;
}

int main()
{
	int k;
	long long n, t, a, ans;
	char buf[100], *p;

	scanf("%lld%lld%s", &n, &t, buf);
	p = buf; ans = 0;
	while (*p) {
		if (*p == 'n') {
			p += 2, k = 0;
			while (isdigit(*p)) k = 10*k + (*p++ - '0');
			a = pow(n, k);
			if (a < 0) goto TLE;
			ans += a;
		} else p++;  // +
	}
	ans *= t;
	if (ans <= MAX) printf("%lld\n", ans);
	else {
TLE:	puts("TLE");
	}
	return 0;
}

Measured memory_bytes: 1768
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int r = sc.nextInt();
    int g = sc.nextInt();
    int b = sc.nextInt();
    
    System.out.println((r*100+g*10+b) % 4 == 0 ? "YES" : "NO");
  }
}

Measured memory_bytes: 21584
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<utility>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<functional>
#include<math.h>
using namespace std;
#define N (1000000000+7)
#define INF 1e16
typedef long long ll;
typedef pair<ll,ll> P;
 





int main(void){
    int n,k;
    cin>>n>>k;
    if(n==1)cout<<k<<endl;
    else{
        int ans = k;
        for(int i=0;i<n-1;i++)ans*=(k-1);
        cout<<ans<<endl;
    }
    return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
#define endl '\n'
#define ll long long
#define ld long double
#define ull unsigned long long
using namespace std;
struct _IO{_IO(){ios::sync_with_stdio(0);cin.tie(0);}}_io;


int main()
{
    int a,b,c;
    cin>>a>>b>>c;
    if(a<=b*c){
        cout<<"Yes"<<endl;
    }
    else{
        cout<<"No"<<endl;
    }
}


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

// #include <ext/pb_ds/assoc_container.hpp> 
// #include <ext/pb_ds/tree_policy.hpp> 
// using namespace __gnu_pbds; 
  
// #define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 

#define ll long long
#define fill fill_n
#define pf push_front
#define pb push_back
#define FOR(i,l,r) for(int i=l;i<r;i++)
#define ROF(i,r,l) for(int i=r;i>=l;i--)
#define comp(v) (v).begin(),(v).end()
#define ff first
#define ss second
#define infile freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);
typedef vector<int> vi;
typedef vector<ll> vli;
typedef vector<pair<int,int>> vpi;

const int M = 1e9+7;
const int N = 2e5;
ll po(int,int);


void solve(){
    int n;cin>>n;
    
    ll a;
    
    ll s=0,ans=0;
    
    FOR(i,0,n){
        cin>>a;
        ans = (ans + (a*s)%M)%M;
        s = (s+a)%M; 
    }
    cout<<ans<<"\n";
    
}





int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
    int t=1;
    //cin>>t;
    FOR(i,1,t+1){
        //cout<<"Case #"<<i<<": "; 
        solve();
    }
    
	return 0;
	
	
}


ll po(int a,int b){
    if(b==0) return 1;
    ll ans=1;
    if(b%2==0){
        ans = po(a,b/2)%M;
        ans=(ans%M * ans%M)%M;
    }
    else{
        ans = po(a,(b-1)/2)%M;
        ans = (ans%M * ans%M * a)%M;
    }
    return ans%M;
}


Measured memory_bytes: 3656
use std::io::{self, BufRead};
use std::collections::BTreeMap;

fn main() {
  let stdin = io::stdin();
  let mut lines = stdin.lock().lines();
  let line = lines.next().unwrap().unwrap();
  let n: i32 = line.parse().unwrap();
  let mut polls: BTreeMap<String, i32> = BTreeMap::new();
  for _ in 0..n {
    let line = lines.next().unwrap().unwrap();
    if polls.contains_key(&line) {
      let count = *polls.get(&line).unwrap();
      polls.insert(line, count + 1);
    } else {
      polls.insert(line, 1);
    }
  }
  let max_count = polls.values().max().unwrap();
  for (s, i) in polls.iter() {
    if *i == *max_count {
      println!("{}", s);
    }
  }
}

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

int main() {
  ll n; 
  cin>>n;
  ll ans=n*(n-1)/2;
  cout << ans << endl;  
  return 0;
}
  
  

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
using namespace std;

int n;

int main() {
	scanf("%d",&n);
	while (n) {
		if (n%10==9) {
			printf("Yes\n");
			return 0;
		}
		n/=10;
	}
	printf("No\n");
	return 0;
}

Measured memory_bytes: 256
w,h,n=map(int,input().split())
a1,a2,a3,a4=0,w,0,h
for i in range(n):
    x,y,a=map(int,input().split())
    if a==1:
        a1=max(a1,x)
    elif a==2:
        a2=min(a2,x)
    elif a==3:
        a3=max(a3,y)
    else:
        a4=min(a4,y)
print(max(a2-a1,0)*max(a4-a3,0))

Measured memory_bytes: 3064
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;

int main() {
  int n, y, tmp, r[3];
  bool exist = false;
  cin >> n >> y;
  tmp = y;
  for (int i = 0; i < n + 1; ++i) {
    for (int j = 0; j < (n - i) + 1; ++j) {
      if (y == (i * 10000 + j * 5000 + (n - i - j) * 1000)) {
        r[0] = i;
        r[1] = j;
        r[2] = n - i - j;
        exist = true;
      }
    }
  }
  if (exist) {
    cout << r[0] << " " << r[1] << " " << r[2] << endl;
  } else
    cout << "-1 -1 -1" << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define FSP(x) fixed << setprecision(x)
using namespace std;
using ll = long long;
constexpr ll INF = LLONG_MAX;
const long double PI = acosl(-1);
void Yes() {cout << "Yes\n";}
void No() {cout << "No\n";}
void YES() {cout << "YES\n";}
void NO() {cout << "NO\n";}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	//constexpr ll P = 1e9 + 7;
	//constexpr ll P = 998244353;

	ll n, d;
	cin >> n >> d;
	ll ans = 0;
	while (n--) {
		ll x, y;
		cin >> x >> y;
		if (x * x + y * y <= d * d) ans++;
	}
	cout << ans << endl;
}

Measured memory_bytes: 3648
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<stack>
#include<queue>
#include<deque>
#include<map>
#include<set>
using namespace std;
typedef long long ll;
typedef vector<int> VI;
#define FOR(i,n) for(int (i)=0;(i)<(n);(i)++)
#define FOR1(i,n) for(int (i)=1;(i)<(n);(i)++)
#define eFOR(i,n) for(int (i)=0;(i)<=(n);(i)++)
#define eFOR1(i,n) for(int (i)=1;(i)<=(n);(i)++)
#define SORT(i) sort((i).begin(),(i).end())
#define rSORT(i) sort((i).begin(),(i).end(), greater<int>());
#define YES(i) cout << ((i) ? "Yes" : "No") << endl;
constexpr auto INF = 1000000000;
constexpr auto LLINF = 1LL << 62;
constexpr auto mod = 1000000007;
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; }

int main() {
    int n, a, b, c, d;
    cin >> n >> a >> b >> c >> d;
    a--; b--; c--; d--;
    string s;
    cin >> s;
    int cnt = 0, m = -1;
    FOR(i, min(min(c, d) + 2, n)) {
        if (s[i] == '.')cnt++;
        else {
            if (cnt >= 3) {
                chmax(m, i - 2);
            }
            cnt = 0;
        }
    }
    bool A = 0, B = 0;
    char o = s[c];
    if (m >= b) {
        for (int i = a; i < c - 1; i++) {
            if (s[i] == '#' && s[i + 1] == '#')break;
            if (i == c - 2)A = 1;
        }
        s[c] = '#';
        for (int i = b; i < d - 1; i++) {
            if (s[i] == '#' && s[i + 1] == '#')break;
            if (i == d - 2)B = 1;
        }
        s[c] = o;
        if (A && B) {
            cout << "Yes" << endl;
            return 0;
        }
        else {
            A = 0; B = 0;
        }
    }
    for (int i = b; i < d - 1; i++) {
        if (s[i] == '#' && s[i + 1] == '#')break;
        if (i == d - 2)B = 1;
    }
    s[d] = '#';
    for (int i = a; i < c - 1; i++) {
        if (s[i] == '#' && s[i + 1] == '#')break;
        if (i == c - 2)A = 1;
    }

    if (A && B)cout << "Yes" << endl;
    else cout << "No" << endl;
}


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

int main(){
  ll n;
  cin >> n;
  ll sum = 0;
  rep(i,n){
    sum += i;
  }

  cout << sum << endl;

  return 0;

}


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(void){
    int x;
    cin>>x;
    ll ans=0;
    ll a=0;
    while(x>=500){
        x-=500;
        ans+=1000;
    }
    while(x>=5){
        x-=5;
        ans+=5;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
fun main(args: Array<String>) {
    val n = readLine()!!.toInt()

    var allXOR = 0
    val a = readLine()!!.split(' ').map {
        val num = it.toInt()
        allXOR = (allXOR xor num)
        num
    }

    repeat(n) {
        if (it != 0) print(" ")
        print(allXOR xor a[it])
    }
    println()
}


Measured memory_bytes: 71388
#include <stdio.h>
#include <stdlib.h>
#include <math.h>

int main(){
    int A,B,C,D;

    //N K入力
    int i;

    while(scanf("%d %d %d %d",&A,&B,&C,&D)<4);
    int flag;
    flag = 1; //先行後攻
    //計算処理
    while(A>0&&C>0){
        if(flag==1){
            C=C-B;
        }else{
            A=A-D;
        }
        flag = flag*-1;
    }
    //最終出力 

    if(flag == -1){
        printf("Yes");
    }else{
        printf("No");
        }


    return 0;
}

Measured memory_bytes: 1732
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <sstream>
#include <iomanip>
#define rep(i,n) for(int i = 0; i < n; i++)
#define rep1(i,n) for(int i = 1; i <= n; i++)
#define co(x) cout << x <<endl
#define cs(x) cout << x <<" "
typedef long long ll;

using namespace std;

int main()
{
	string S;
	cin >> S;
	int red = 0, blue = 0;
	rep(i, S.size())
	{
		if (S[i] == '0')red++;
		else blue++;
	}
	int ans =2* min(red, blue);
	co(ans);
	return 0;
}


Measured memory_bytes: 512
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

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

    std::vector<int> sub(N, 0); //i番目以下の'('の数-')'の数
    sub[0] = (S[0] == '(') ? 1 : -1;
    for(int i=1; i<N; i++){
        if(S[i] == '(') sub[i] = sub[i-1] + 1;
        else sub[i] = sub[i-1] - 1; 
    }
    auto itr = std::min_element(sub.begin(), sub.end());
    for(int i=0; i<-(*itr); i++) S = "(" + S;
    if((*itr) < 0) sub[N-1] -= (*itr);
    for(int i=0; i<sub.back(); i++) S += ")";
    
    std::cout << S << std::endl;
}

Measured memory_bytes: 256
INF=100000000
N,M=map(int,input().split())
a=[0]*1000
b=[0]*1000
c=[0]*1000
dist=[[INF for _ in range(100)] for _ in range(100)]
for i in range(M):
  a[i],b[i],c[i]=map(int,input().split())
  a[i]-=1
  b[i]-=1
for i in range(N):
  for j in range(N):
    if i==j:
      dist[i][j]=0
for i in range(M):
  dist[a[i]][b[i]]=min(dist[a[i]][b[i]],c[i])
  dist[b[i]][a[i]]=min(dist[b[i]][a[i]],c[i])
for k in range(N):
  for i in range(N):
    for j in range(N):
      dist[i][j]=min(dist[i][j],dist[i][k]+dist[k][j])
ans=M
for i in range(M):
  flag=False
  for j in range(N):
    if dist[j][a[i]]+c[i]==dist[j][b[i]]: flag=True
  if flag: ans-=1
print(ans)

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


int main(){
    int n,k;
    cin>>n>>k;
    getchar();

    vector<int> v;
    int cnt=0;
    int temp=0;
    char old='1';
    for(int i=0;i<n;i++){
        if(getchar()!=old){
            v.push_back (cnt);
            cnt=1;
            old='1'-(old-'0');
        }else{
            cnt++;
        }
    }
    if(cnt!=0){
        v.push_back (cnt);
    }
    if(v.size()%2==0){
        v.push_back (0);
    }
    vector<int> sumst(v.size()+1);
    for(int i = 0; i < v.size(); i++)
    {
        sumst[i+1]=(sumst[i]+v[i]);
    }
    // for(int i = 0; i < sumst.size(); i++)
    // {
    //     cout<<sumst[i]<<endl;
    // }
    
    int ans =0;
    for(int i=0;i<v.size();i+=2){
        int left=i;
        int right = min(i+k*2+1,(int)v.size());
        ans = max(ans,sumst[right]-sumst[left]);
    }


    cout<<ans<<"\n";
    return(0);
}

Measured memory_bytes: 1144
use std::cmp::*;
use std::io::*;

fn main() {
    let mut s: String = String::new();
    std::io::stdin().read_to_string(&mut s).ok();
    let mut itr = s.trim().split_whitespace();
    let r: usize = itr.next().unwrap().parse().unwrap();
    let g: usize = itr.next().unwrap().parse().unwrap();
    let b: usize = itr.next().unwrap().parse().unwrap();

    let n: usize = itr.next().unwrap().parse().unwrap();

    let mut ans = 0;
    for i in 0..n + 1 {
        for j in 0..n + 1 {
            let rr = i * r;
            let bb = j * b;
            if rr + bb > n {
                break;
            }
            let k = n - rr - bb;
            if k % g == 0 {
                ans += 1;
            }
        }
    }
    println!("{}", ans);
}


Measured memory_bytes: 2096
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pi;
typedef complex <double> cp;
#define debug(a) cout<<#a<<":"<<a<<endl;
#define fr freopen("in.txt","r",stdin);
#define for0(i,a,b) for (ll i=a;(i<b);i++)
#define for1(i,a,b) for (ll i=a;(i<=b);i++)
#define dec0(i,a,b) for (ll i=a;(i>b);i--)
#define dec1(i,a,b) for (ll i=a;(i>=b);i--)
#define Fill(x,a) memset(x,a,sizeof(x))
#define cpy(a,b) memcpy(a,b,sizeof(a))
const double PI = acos(-1);
const ll INF=0x3f3f3f3f;
const ll N=1e6+7;
const ll mod=1e9+7;
ll maxn,minn;
ll T,n,m,q;

vector<ll>arr[N];
ll a[N];
ll d[N];
ll dp[N];

ll cnt;

void dfs(ll u,ll p){
	ll len=arr[u].size();
	for(ll i=0;i<len;i++){
		ll inx,flag=0;
		ll v=arr[u][i];
		if(v==p)	continue;
		if(a[v]>d[cnt]){
			d[++cnt]=a[v];
			flag=-1;
		}
		else{
			flag=lower_bound(d+1,d+cnt+1,a[v])-d;
			inx=flag;
			flag=d[inx];
			d[inx]=a[v];
		}
		dp[v]=cnt;
		dfs(v,u);
		if(flag==-1){
			d[cnt--]=0;
		}
		else{
			d[inx]=flag;
		}
	}
	return ;
}

int main(){
	ll u,v;
	cin>>n;
	for(ll i=1;i<=n;i++){
		scanf("%lld",a+i);
	}
	for(ll i=1;i<n;i++){
		scanf("%lld%lld",&u,&v);
		arr[u].push_back(v);
		arr[v].push_back(u);
	}
	d[1]=a[1];
	dp[1]=1;
	cnt=1;
	dfs(1,0);
	for(ll i=1;i<=n;i++){
		printf("%lld\n",dp[i]);
	}

	return 0;
}



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

int main() {

    string S;
    cin >> S;
    
    if (S == "SUN") {
    cout << 7 << endl;
    }
    
    if (S == "MON") {
    cout << 6 << endl;
    }
    
    if (S == "TUE") {
    cout << 5 << endl;
    }
    
    if (S == "WED") {
    cout << 4 << endl;
    }
    
    if (S == "THU") {
    cout << 3 << endl;
    }
    
    if (S == "FRI") {
    cout << 2 << endl;
    }
    
    if (S == "SAT") {
    cout << 1 << endl;
    }
    
 }


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

using namespace std;

#define ll                long long

static const int maxn = 2e3 + 5;
static const ll mod = 1e9 + 7;

ll arr[maxn], brr[maxn];
int lenA, lenB;
ll dp[maxn][maxn];

int main()
{
      ios_base::sync_with_stdio(false);
      cin.tie(nullptr);
      cout.tie(nullptr);


      cin >> lenA >> lenB;
      for (int i = 0; i < lenA; i++) cin >> arr[i];
      for (int i = 0; i < lenB; i++) cin >> brr[i];
      for (int i = 1; i <= lenA; i++)
      {
            for (int j = 1; j <= lenB; j++)
            {
                  if (arr[i-1] == brr[j-1])
                  {
                        dp[i][j] = (1 + dp[i-1][j] + dp[i][j-1]) % mod;
                  }
                  else
                  {
                        dp[i][j] = (dp[i][j-1] + dp[i-1][j] - dp[i-1][j-1] + mod) % mod;
                  }
            }
      }
      cout << dp[lenA][lenB] + 1;
}


Measured memory_bytes: 31616
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;
using ld = long double;
const ll ATCODER_AMARI = 1000000007; //10^9 + 7
const ll INF = 10000000000000;

//階乗関数
ll factorial(ll k){
  ll sum = 1;
  for(int i = 1 ; i < k + 1; i++) {
    sum *= i;
    sum = sum % ATCODER_AMARI;
  }
  return sum;
}

int main() {
  int x,y; cin >> x >> y;

  int a2 = 4*x - y;
  if(a2 % 2 != 0 || a2 < 0) {
    cout << "No" << endl;
    return 0;
  }

  int b2 = (y - 2*x);

  if(b2 % 2 != 0 || b2 < 0) {
    cout << "No" << endl;
    return 0;
  }

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


Measured memory_bytes: 3576
#include <algorithm>
#include <iomanip>
#include <iostream>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define SORT(a) sort(a.begin(), a.end())
#define RSORT(a) sort(a.rbegin(), a.rend())
#define REP(i, n) for (int i = 0; i < n; i++)
#define RREP(i, n) for (int i = n; 0 <= i; i--)
#define FOR(i, start, end) for (int i = start; i < end; i++)
#define FORSTEP(i, start, end, step) for (int i = start; i < end; i += step)
#define RFOR(i, start, end) for (int i = start; end <= i; i--)
#define ALL(a) a.begin(), a.end()
#define MOD(a) a %= 1000000007
typedef long long ll;
const int INF32 = 2147483647;
const ll INF64  = 9223372036854775807;
using namespace std;

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

    int a, b, c;
    cin >> a >> b >> c;
    if ((a < c && c < b) || (a > c && c > b)) {
        cout << "Yes" << endl;
    } else
        cout << "No" << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
using namespace std;
int main(void){
    int n;
    cin>>n;
    int ans=0,s,c=1000;
    for(int i=0;i<n;i++){
        cin>>s;
        ans+=s;
        if(s%10!=0&&c>s)c=s;
    }
    if(ans%10!=0)cout<<ans<<endl;
    else if(c!=1000)cout<<ans-c<<endl;
    else cout<<0<<endl;
    return 0;
}

Measured memory_bytes: 256
from math import *

def get(R, T):
	T /= 180
	T *= pi
	x = 0
	y = R
	return x * cos(T) - y * sin(T), x * sin(T) + y * cos(T)

A, B, H, M = map(int, input().split())

H += M / 60;

x1, y1 = get(A, H * 30)
x2, y2 = get(B, M * 6)

print('%0.12f'%(((x1-x2) ** 2 + (y1-y2) ** 2) ** 0.5))

Measured memory_bytes: 9516
#include <iostream>
#include <vector>
#include <cmath>

#define REP(i, a, b) for ( int i = (a); i < (b); i++ )
#define REVREP(i, a, b) for ( int i = (a); i >= (b); i--)
#define DEBUG_INT(var) printf("the value of "#var" is %d\n", var)
#define PRINT_ARRAY(name, i) printf("the value of "#name"[%d] is %d\n", (i), name[(i)])
#define DEBUG_ARRAY(name, begin, end) REP(i, begin, end) PRINT_ARRAY(name, i)

using namespace std;

typedef long long ll;

vector<int> eratosthenes_seive(int n) {
	bool t[n+5];
	vector<int> v;

	for (int i = 2; i <= n+1; i++) t[i] = true;

    for (int i = 2; i <= n+1; i++) {
    	if ( t[i] == true ) {
    		v.push_back(i);
    		for (int j = i + i; j <= n+1; j += i) t[j] = false;
    	}
    }
    return v;
}

vector<int> prime_factrization(long long n) {
	vector<int> v, x;
	v = eratosthenes_seive((int)sqrt(n));

	for (int i = 0; i < v.size(); i++) {
		if (n % v[i] == 0) {
			x.push_back(v[i]);
			while (n % v[i] == 0) n /= v[i];
		}
	}
	if (n > 1) x.push_back(n);
	
	return x;
}

template <class Type>
Type gcd(Type x, Type y) {
	if ( y == 0 ) return x;
	return gcd(y, x % y);
}

int main(void) {
    ll A, B;
    scanf("%lld %lld", &A, &B);

    ll x = gcd<ll>(A, B);

    vector<int> v = prime_factrization(x);

    printf("%d\n", (int)v.size()+1);


    
    

	return 0;
}


Measured memory_bytes: 1916
import sys

def insertion_sort(a, n, g):
    count = 0
    for i in range(g, n):
        v = a[i]
        j = i - g
        while j >= 0 and a[j] > v:
            a[j+g] = a[j]
            j = j - g
            count += 1
        a[j+g] = v
    return count

def shell_sort(a, n):
    count = 0
    G = list([int((2.25**i-1)/1.25) for i in range(17, 0, -1)])
    G = [x for x in G if x <= n]
    m = len(G)
    for g in G:
        count += insertion_sort(a, n, g)
    return m, G, count, a

n = int(input())
a = list(map(int, sys.stdin))

m, G, count, a = shell_sort(a, n)
print(len(G))
print(*G)
print(count)
print("\n".join(map(str, a)))



Measured memory_bytes: 126044
n = int(input())
if 400 <= n <= 599:
  print(8)
if 600 <= n <= 799:
  print(7)
if 800 <= n <= 999:
  print(6)
if 1000 <= n <= 1199:
  print(5)
if 1200 <= n <= 1399:
  print(4)
if 1400 <= n <= 1599:
  print(3)
if 1600 <= n <= 1799:
  print(2)
if 1800 <= n <= 1999:
  print(1)  

Measured memory_bytes: 9188
#include <iostream>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <cmath>
#include <map>
#include <cmath>
#include <bitset>
#include <string>

using namespace std;

#define int long long

signed main() {
    int n, k;
    cin >> n >> k;
    vector<double> p(n);
    for(int i = 0; i < n; i++) cin >> p[i];

    vector<double> q(n);
    for(int i = 0; i < n; i++) {
        q[i] = (p[i] + 1) / 2.0;
    }

    vector<double> r(n);
    r[0] = q[0];
    for(int i = 1; i < n; i++) {
        r[i] = r[i - 1] + q[i]; 
    }

    double ans = r[k - 1];
    for(int i = k; i < n; i++) {
        double sum = r[i] - r[i - k];
        ans = max(ans, sum);
    }
    
    cout << fixed << setprecision(10) << ans << endl;
}

Measured memory_bytes: 4992
def resolve():
    '''
    code here
    '''
    S = int(input())

    a, b = divmod(S, 10**9)
    x2 = (10**9 - b)%10**9
    y2 = (S+x2) // (10**9)

    print(0,0, 10**9, 1, x2, y2)

if __name__ == "__main__":
    resolve()


Measured memory_bytes: 3060
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            new Program().Solve(new ConsoleInput(Console.In, ' '));
        }

        public void Solve(ConsoleInput cin)
        {
            // f(k+1) = ak ? 0 : f(k)+f(k-1)
            var N = cin.ReadInt;
            var M = cin.ReadInt;
            var a = cin.ReadIntArray(M);
            var step = new bool[N];
            var m = 0;
            for (int i = 0; i < N; i++)
            {
                if (m < M && a[m] - 1 == i)
                {
                    step[i] = false;
                    m++;
                }
                else
                {
                    step[i] = true;
                }
            }

            var ans = new long[N];
            var MOD = 1000000007;

            if (N == 1)
            {
                ans[0] = 1;
            }
            else
            {
                ans[0] = step[0] ? 1 : 0;
                ans[1] = step[1] ? ans[0] + 1 : 0;
                for (int i = 2; i < N; i++)
                {
                    ans[i] = step[i] ? (ans[i - 1] + ans[i - 2]) % MOD : 0;
                }
            }
            Console.WriteLine(ans[N - 1]);
        }
    }

    public class ConsoleInput
    {
        private readonly System.IO.TextReader _stream;
        private char _separator = ' ';
        private Queue<string> inputStream;
        public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
        {
            this._separator = separator;
            this._stream = stream;
            inputStream = new Queue<string>();
        }
        public string Read
        {
            get
            {
                if (inputStream.Count != 0) return inputStream.Dequeue();
                string[] tmp = _stream.ReadLine().Split(_separator);
                for (int i = 0; i < tmp.Length; ++i)
                    inputStream.Enqueue(tmp[i]);
                return inputStream.Dequeue();
            }
        }
        public string ReadLine { get { return _stream.ReadLine(); }}
        public int ReadInt { get { return int.Parse(Read); }}
        public long ReadLong { get { return long.Parse(Read); }}
        public double ReadDouble { get { return double.Parse(Read); }}
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret;}
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret;}
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret;}
    }
}


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

long calc(string s) {
  long sum = 0;
  string tmp = "";
  for (int i = 0; i < s.length(); i++) {
    string t = s.substr(i, 1);
    if (t == "+") {
      sum += atol(tmp.c_str());
      tmp = "";
    } else {
      tmp += t;
    }
  }
  sum += atol(tmp.c_str());
  return sum;
}

int main() {
  bitset<9> tmp;
  
  string N;
  cin >> N;
  
  int length = N.size();
  
  long sum = 0;
  for (int i = 0; i < (1 << (length - 1)); i++) {
    string n = N;
    int offset = 0;
    for (int j = 0; j < (length - 1); j++) {
      if (i & (1 << j)) {
        n.insert((j + 1 + offset), "+");
        offset++;
      }
    }
    sum += calc(n);
  }

  cout << sum << endl;
}


Measured memory_bytes: 3504
n,d = map(int, input().split())
arr = []
for i in range(n):
  arr.append(list(map(int, input().split())))
res = 0
for i in range(n-1):
  for j in range(i+1,n):
    dist = 0
    for k in range(d):
      dist += (arr[i][k] - arr[j][k])**2
    if dist == float(int(pow(dist,1/2))**2):
      res += 1
print(res)

Measured memory_bytes: 3192
#include <bits/stdc++.h>
#define all(v) (v).begin(), (v).end()
typedef long long int lint;
using namespace std;

int main() {
    int n, k;
    cin >> n >> k;
    vector<pair<int, int>> xy(n);
    for (int i = 0; i < n; i++) {
        cin >> xy[i].first >> xy[i].second;
    }
    sort(all(xy));
    lint ans = LLONG_MAX;
    // l:左
    for (int l = 0; l < n; l++) {
        // r:右
        for (int r = l + 1; r < n; r++) {
            // u:上
            for (int u = l; u <= r; u++) {
                // d:下
                for (int d = l; d <= r; d++) {
                    if (xy[u].second < xy[d].second) continue;
                    int num = 0;
                    lint top = xy[u].second, bottom = xy[d].second;
                    lint left = xy[l].first, right = xy[r].first;
                    for (int m = l; m <= r; m++) {
                        if (xy[m].second >= bottom && xy[m].second <= top) {
                            num++;
                        }
                    }
                    if (num >= k) {
                        ans = min(ans, (top - bottom) * (right - left));
                    }
                }
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
from collections import defaultdict
import sys
sys.setrecursionlimit(10**7)


def dfs(prev, u):
    if visited[u]:
        return
    else:
        cnt[u] += cnt[prev]
        visited[u] = True
        for nu in graph[u]:
            if visited[nu]:
                continue
            else:
                dfs(u, nu)


n, q = map(int, input().split())
graph = defaultdict(list)

for _ in range(n - 1):
    a, b = map(int, input().split())
    graph[a].append(b)
    graph[b].append(a)

cnt = [0] * (n + 1)

for _ in range(q):
    p, x = map(int, input().split())
    cnt[p] += x

visited = [True] + [False] * n

dfs(0, 1)

print(*cnt[1:])

Measured memory_bytes: 235004
#include<iostream>
#include<string.h>
using namespace std;

int main(){
	int i,j,k,l,m,n,p[1000];
	cin >> i;//数
	cin >> j;//何進法?
	
	if(i<1 || i>1000000000)exit(1);

	if(j<2 || j>10)exit(1);

	m=0;//カウンタ
	k=i/j;//商
	l=i%j;//余り
	
	while(1){
		p[m]=l;
		if(k==0)break;
		m++;
		k=k/j;
		l=k%j;
	}
	cout << m+1 << endl;
	
return 0;
}


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

const int MAX_N = 1e5+2;
int N, a[MAX_N],b[MAX_N],c[MAX_N];
int dp[MAX_N][3];

void solve()
{
	dp[1][0]=a[0];
	dp[1][1]=b[0];
	dp[1][2]=c[0];
	for(int i=1;i<N;++i){
		dp[i+1][0]=max(dp[i][1],dp[i][2])+a[i];
		dp[i+1][1]=max(dp[i][0],dp[i][2])+b[i];
		dp[i+1][2]=max(dp[i][0],dp[i][1])+c[i];
	}
	cout << max(dp[N][0],max(dp[N][1],dp[N][2])) << '\n';
}

int main()
{
	cin >> N;
	for(int i=0;i<N;++i) cin >> a[i] >> b[i] >> c[i];
	solve();
	return 0;
}

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

int main(){
    int n;
    cin >> n;
    int l[n];
    int sum = 0;
    int max = 0;
    cin >> l[0];
    sum += l[0];
    max = l[0];
    for(int i=1; i<n; i++){
        cin >> l[i];
        sum += l[i];
        if(max<l[i]){
            max = l[i];
        }
    }
    sum -= max;
    if(sum>max){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        try (Scanner sc = new Scanner(System.in);) {
            solve(sc);
        }
    }

    public static void solve(Scanner sc) {
        int a = sc.nextInt();
        int b = sc.nextInt();

        if (a % 3 == 0) {
            System.out.println("Possible");
            return;
        }

        if (b % 3 == 0) {
            System.out.println("Possible");
            return;
        }

        if ((a + b) % 3 == 0) {
            System.out.println("Possible");
            return;
        }

        System.out.println("Impossible");
    }
}

Measured memory_bytes: 23124
/*input
3 200
*/

#include <bits/stdc++.h>
#define ll long long

using namespace std;

const ll MOD = 1e9 + 7;

ll modpow(ll x, ll n) {
	if(n == 0) 
		return 1;
	if(n % 2 == 1) 
		return x * modpow(x, n-1) % MOD;
	return modpow(x * x % MOD, n/2);
}

void run() {
	int n, k;
	cin >> n >> k;
	vector<ll> gcd(k+1, 0);
	ll ret = 0;
	for(int g=k; g>=1; g--) {
		gcd[g] = modpow(k/g, n);
		for(int multiples = g + g; multiples <= k; multiples += g)
			gcd[g] = ((gcd[g] - gcd[multiples] + MOD) % MOD);
		(ret += g*gcd[g]) %= MOD;
	}
	cout << ret << endl;
}

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


Measured memory_bytes: 3972
fun main(args: Array<String>) {
    val (w, a, b) = readLine()!!.split(' ').map(String::toInt)
    val ans = when {
        a + w < b -> b - (a + w)
        b + w < a -> a - (b + w)
        else -> 0
    }
    println(ans)
}


Measured memory_bytes: 38208