akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cctype>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <functional>
using namespace std; 
#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define FORD(i,a,b) for(int i=(a);i>=(b);i--)
inline bool EQ(double a, double b) { return fabs(a-b) < 1e-9; }
const int INF = 1<<29;
typedef long long int ll;
inline int two(int n) { return 1 << n; }
inline int test(int n, int b) { return (n>>b)&1; }
inline void set_bit(int & n, int b) { n |= two(b); }
inline void unset_bit(int & n, int b) { n &= ~two(b); }
inline int last_bit(int n) { return n & (-n); }
inline int ones(int n) { int res = 0; while(n && ++res) n-=n&(-n); return res; }
template<class T> void chmax(T & a, const T & b) { a = max(a, b); }
template<class T> void chmin(T & a, const T & b) { a = min(a, b); }
const int MOD=1000000007;

bool isPowerOfTwo (ll x)  
{  
    return x && (!(x&(x-1)));  
}
bool isPrime(int n) 
{ 
    if (n <= 1)  return false; 
    if (n <= 3)  return true; 
    if (n%2 == 0 || n%3 == 0) return false; 
  
    for (int i=5; i*i<=n; i=i+6) 
        if (n%i == 0 || n%(i+2) == 0) 
           return false; 
  
    return true; 
}
int highestPowerof2(unsigned int n) 
{ 
    // Invalid input 
    if (n < 1) 
        return 0; 
  
    int res = 1;
    for (int i=0; i<8*sizeof(unsigned int); i++) 
    { 
        int curr = 1 << i; 
        if (curr > n) 
           break; 
  
        res = curr; 
    } 
  
    return res; 
} 
long long binpow(long long a, long long b) {
    long long res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a;
        a = a * a;
        b >>= 1;
    }
    return res;
}       
////////////////////////////////////////////////////////////////////

int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);  
  cout.tie(NULL);
  int t=1;
  while(t--)
  {
    int n;
    cin>>n;
    int a[n];
    REP(i,n)
    cin>>a[i];
    vector<int> dp(n+1,0);
    dp[0]=0;
    dp[1]=abs(a[1]-a[0]);
    for(int i=2;i<n;i++)
    {
        dp[i]=min(dp[i-1]+abs(a[i]-a[i-1]),dp[i-2]+abs(a[i]-a[i-2]));
    }
    cout<<dp[n-1];
  }
  return 0;
}

Measured memory_bytes: 1024
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#pragma comment(linker, "/STACK:1024000000")
#pragma warning( disable : 6031)
#pragma warning( disable : 4244)
#pragma warning( disable : 26451)
#ifdef _MSC_VER
#  include <intrin.h>
#  define __builtin_popcount __popcnt
#  define __builtin_popcountll __popcnt64
#endif
#include <cstdlib>
#include <cstdio>
#include <cstring>
#include <cstdint>
#include <climits>
#include <cassert>
#include <string>
#include <vector>
#include <iostream>
#include <map>
#include <stack>
#include <set>
#include <queue>
#include <numeric>
#include <algorithm>
#include <utility>
#include <bitset>
#include <cmath>
#include <sstream>
#include <functional>
#include <iomanip>
#include <random>
#include <unordered_map>
#include <unordered_set>
#include <chrono>

#define all(a) (a).begin(),(a).end()
#define sz(a) (int)(a).size()
#define eps (1e-15)

using namespace std;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

typedef long long ll;
typedef vector<int> vi;
typedef vector< vi > vvi;
typedef vector<double> vd;
typedef vector< vd > vvd;
typedef vector< string > vs;
typedef pair< int, int > pii;
typedef vector< pii > vpii;
typedef vector<ll> vl;
typedef vector<vector<long long>> vvl;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef tuple<int, int, int> tiii;
const long long mod = int(1e9) + 7;
const int INF = 1e9;
const ll LINF = 1e18;


int main() {
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0); cout << setprecision(18) << fixed;
#ifdef LOCAL_MACHINE
	freopen("input.txt", "rt", stdin);
	freopen("output.txt", "wt", stdout);
#endif
	
	ll x;
	cin >> x;
	ll res = (x / 500LL) * 1000LL;
	res += ((x % 500) / 5) * 5;
	cout << res;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define mp make_pair
#define pb push_back
#define emb emplace_back
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL);
#define N  99999
#define f first 
#define em emplace
#define s second
using lint=long long int;

typedef pair<int, int> pii;
typedef pair<double, double> pdd;
typedef vector<double> vd;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<string> vs;

 
#define fori(n) for(int i=0; i<int(n); i++)
 
#define cins(s) string s; cin>>s;
#define cini(i) lint i; cin>>i;
#define cind(d) double d; cin>>d;
#define cinai(a, n) vi a(n); fori(n) { cin>>a[i]; }
#define cinas(s, n) vs s(n); fori(n) { cin>>s[i]; }
#define cinad(a, n) vd a(n); fori(n) { cin>>a[i]; }
#define z 1000000007 
const int INF=1e9+5;
   vector<vector<int>> v(100005);
 
void cleari(){
  for(int i=0;i<99999;i++) v[i].clear();
}
 void solve(){

   cleari();
    
   cini(n); 
   for(int i=0;i<n;i++)
   {
      for(int j=0;j<3;j++)
        { 
          int a;
           cin>>a; 
           v[i].pb(a);
        }
   }
   
  int m;
  for (int i=1;i<n;i++){
    
     for(int j=0;j<3;j++){
          m=0;
       for(int k=0;k<3;k++){
         if(j!=k)
         {
            m=max(v[i-1][k],m);
         }
       }
       v[i][j]+=m;

     }

  }

  int mx=max(v[n-1][0],v[n-1][1]);
      mx=max(v[n-1][2],mx);

      cout<<mx<<endl;


     

 }


 
 
int main()
{ 
  fast;
 /* #ifndef ONLINE_JUDGE
  freopen("input.txt","r",stdin);
  freopen("hex.txt","w",stdout);
  #endif*/
  



  solve();
 }

Measured memory_bytes: 5760
//#include <bits/stdc++.h>
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <stdio.h>
#include <queue>
#include <deque>
#include <set>
#include <stack>
#include <time.h>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> Pii;
typedef pair<int, ll> Pil;
typedef pair<ll, ll> Pll;
typedef pair<ll, int> Pli;

#define fi first
#define se second

 
const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll MOD3 = 1812447359;
const ll INF = 1ll << 62;
const double PI = 2 * asin(1);

void yes() {printf("yes\n");}
void no() {printf("no\n");}
void Yes() {printf("Yes\n");}
void No() {printf("No\n");}
void YES() {printf("YES\n");}
void NO() {printf("NO\n");}

int H, W, cnt, Dist[55][55];
char S[55][55];

int di[4] = {0, 1, 0, -1};
int dj[4] = {1, 0, -1, 0};

int Calc_Dist(){
  fill((int*)Dist, (int*)(Dist + H), -1);
  Dist[0][0] = 0;
  queue <Pii> que; que.push({0, 0});
  while (!que.empty()){
    Pii Q = que.front(); que.pop();
    for (int k = 0; k < 4; k++){
      int I = Q.fi + di[k], J = Q.se + dj[k];
      if (I < 0 || H <= I || J < 0 || W <= J) continue;
      if (S[I][J] == '#') continue;
      if (Dist[I][J] != -1) continue;
      Dist[I][J] = Dist[Q.fi][Q.se] + 1;
      que.push({I, J});
    }
  }
  return 0;
}

int main(){
  scanf("%d%d", &H, &W);
  for (int i = 0; i < H; i++) {
    scanf("%s", S + i);
    for (int j = 0; j < W; j++){
      if (S[i][j] == '#') cnt++;
    }
  }
  Calc_Dist();

  if (Dist[H - 1][W - 1] == -1){
    printf("-1\n");
  }else{
    printf("%d\n", H * W - 1 - cnt - Dist[H - 1][W - 1]);
  }

  return 0;
}


Measured memory_bytes: 3796
#include<iostream>
#include<vector>
#include<algorithm>
#define rep(i,j) for(int i=0;i<j;i++)
using namespace std;
int n;
int dx[]={1,1,-1,0},dy[]={0,1,1,1};
vector<string>V;
int cnt(int y,int x,int d){
    if(x<0||x>=n||y<0||y>=n)return 0;
    if(V[y][x]=='0')return 0;
    return cnt(y+dy[d],x+dx[d],d)+1;
}
int main(){

    while(cin>>n,n){
        V.clear();
        string str;
        int mx=-1;
        rep(i,n){
            cin>>str;
            V.push_back(str);
        }
        rep(i,n)
            rep(j,n)
                rep(k,4)mx=max(mx,cnt(i,j,k));

        cout<<mx<<endl;


    }
}

Measured memory_bytes: 1296
// atcoder/abc126/C/main.cpp
// author: @___Johniel
// github: https://github.com/johniel/

#include <bits/stdc++.h>

#define each(i, c) for (auto& i : c)
#define unless(cond) if (!(cond))

using namespace std;

typedef long long int lli;
typedef unsigned long long ull;
typedef complex<double> point;

template<typename P, typename Q> ostream& operator << (ostream& os, pair<P, Q> p) { os << "(" << p.first << "," << p.second << ")"; return os; }
template<typename P, typename Q> istream& operator >> (istream& is, pair<P, Q>& p) { is >> p.first >> p.second; return is; }
template<typename T> ostream& operator << (ostream& os, vector<T> v) { os << "("; each (i, v) os << i << ","; os << ")"; return os; }
template<typename T> istream& operator >> (istream& is, vector<T>& v) { each (i, v) is >> i; return is; }

template<typename T> inline T setmax(T& a, T b) { return a = std::max(a, b); }
template<typename T> inline T setmin(T& a, T b) { return a = std::min(a, b); }

int main(int argc, char *argv[])
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);

  int n, k;
  while (cin >> n >> k) {
    const int N = 1e5 + 10;
    double dp[N];
    fill(dp, dp + N, 0);
    for (int i = 1; i <= n; ++i) {
      dp[min(i, k)] += 1.0 / n;
    }
    for (int i = 0; i < k; ++i) {
      dp[min(i * 2, k)] += dp[i] / 2.0;
    }
    printf("%0.12lf\n", dp[k]);
  }

  return 0;
}


Measured memory_bytes: 1024
from collections import deque
n=int(input())
a=list(map(int,input().split()))
b=deque()
for i in range(n):
    if i%2==0:
        b.append(a[i])
    else:
        b.appendleft(a[i])
if n%2==0:
    print(*b)
else:
    print(*deque(reversed(b)))

Measured memory_bytes: 32488
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(v) (v).begin(),(v).end()
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)
typedef pair<int, int> P;
typedef long long ll;
const int INF = 1001001001;
const ll LINF = 1001002003004005006ll;
const ll MOD = 1e9+7;
ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}

int main() {
	string s;
	cin >> s;
    int p = 0;
    rep(i, s.size()) {
        if (s[i] == 'p') p++;
    }
    int ans = int(s.size())/2 - p;
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int INF = 1e10;
const int MOD = 1e9 + 7;
#define dump(x) cout << #x << " = " << (x) << endl;
#define YES(n) cout << ((n) ? "YES" : "NO") << endl
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl
#define SANKOU(n, a, b) cout << ((n) ? (#a) : (#b)) << endl
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define P pair<int, int>
#define V vector<int>
#define M map<int, int>
#define S set<int>

int n, a[1000];

void solve()
{
    int ans;
    FOR(i, 0, n - 1)
    {
        if (a[i] == a[i + 1]) {
            ans++;
            a[i + 1] = 0;
        }
    }
    cout << ans << endl;
}

signed main()
{
    cin >> n;
    FOR(i, 0, n)
    {
        cin >> a[i];
    }
    solve();
    return 0;
}


Measured memory_bytes: 256
import std.stdio;
import std.conv;
import std.string;

void main(string[] args){
	int n = to!int(readln().chomp());
	for(int i = 0; i < n; i ++){
		string[] cs = readln().chomp().split(" ");
		// x1 y1 x2 y2 x3 y3 x4 y4
		double dx1 = to!double(cs[0]) - to!double(cs[2]);
		double dx2 = to!double(cs[4]) - to!double(cs[6]);
		double dy1 = to!double(cs[1]) - to!double(cs[3]);
		double dy2 = to!double(cs[5]) - to!double(cs[7]);
		if(dx1 * dy2 - dx2 * dy1 < 0.00000000001 && dx1 * dy2 - dx2 * dy1 > -0.00000000001) writeln("YES"); else writeln("NO");
		}
	}

Measured memory_bytes: 1076
import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val n = sc.nextInt()
    val q = sc.nextInt()
    val a = (0 until n).map { sc.next().toLong() }
    val x = (0 until q).map { sc.next().toLong() }
    println(problemdsl3c(n, q, a, x))
}

fun problemdsl3c(
    n: Int,
    q: Int,
    a: List<Long>,
    x: List<Long>
): String {
    val ans = mutableListOf<Long>()
    for (i in 0 until q) {
        val xi = x[i]
        val counts = mutableListOf<Long>()
        var sum = 0L
        var right = 0
        for (left in 0 until n) {
            while (right < n && sum + a[right] <= xi) {
                sum += a[right]
                right++
            }
            counts.add(right.toLong() - left)
            if (right == left) right++ else sum -= a[left]
        }
        ans.add(counts.sum())
    }
    return ans.joinToString("\n")
}


Measured memory_bytes: 549700
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
template < typename T > string tost( const T& n ) { ostringstream stm; stm << n; return stm.str();}
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 const INF = 1001001001;


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

int N;
cin >> N;
vi C(N),S(N),F(N);
rep(i,N-1) cin >> C[i] >> S[i] >> F[i];

rep(i,N) {
    int t = 0;
    for(int j = i; j < N-1; j++) {
        if(t < S[j]) t = S[j];
        else if(t % F[j] == 0);
        else t = t + F[j] - (t % F[j]);
        t += C[j];
    }
    cout << t << endl;
}
return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
struct node{
  int key;
  node *left,*right,*p;
  node(){}
  node(int key):key(key){left=right=p=NULL;};
};
node *root;
void insert(node z){
  node *y=NULL;
  node *x=root;
  while(x!=NULL){
    y=x;
    if(z.key<x->key) x=x->left;
    else x=x->right;
  }
  z.p=y;
  if(y==NULL) root=new node(z);
  else if(z.key<y->key) y->left=new node(z);
  else y->right=new node(z);
}
void inorderTreeWalk(node *v){
  if(v==NULL) return;
  inorderTreeWalk(v->left);
  cout<<" "<<v->key;
  inorderTreeWalk(v->right);
}
void preorderTreeWalk(node *v){
  if(v==NULL) return;
  cout<<" "<<v->key;
  preorderTreeWalk(v->left);
  preorderTreeWalk(v->right);
}
signed main(){
  int n;
  cin>>n;
  root=NULL;
  for(int i=0;i<n;i++){
    string s;
    cin>>s;
    //cout<<(root==NULL?-1:root->key)<<endl;
    if(s=="print"){
      inorderTreeWalk(root);
      cout<<endl;
      preorderTreeWalk(root);
      cout<<endl;
      continue;
    }
    int x;
    cin>>x;
    insert(node(x));
  }
  return 0;
}



Measured memory_bytes: 26608
def gcd(a,b):
	if a%b==0:
		return b
	else:
		return gcd(b,a%b)
a,b=list(map(int,input().strip().split()))
n=list(map(int,input().strip().split()))
hi=G=n[0]
for i in range(1,a,1):
	G=gcd(G,n[i])
	if hi<n[i]:
		hi=n[i]
if b%G==0 and b<=hi:
	print("POSSIBLE")
else:
	print("IMPOSSIBLE")

Measured memory_bytes: 14224
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
const long long INF = 1LL << 60;
bool mem[100010];
int memo[100010];
int N;
int h[100010];
int DFS(int i) {
  ll ans;
    if(mem[i]==true){
        ans= memo[i];
    }
    else if(i==0){
      	ans=0;
      	mem[0]=true;
    }
  else if(i==1){
    	ans=abs(h[1]-h[0]);
   		 memo[1]=ans;
    	mem[1]=true;
  }
    else{
        ans=min(DFS(i-2)+abs(h[i]-h[i-2]),DFS(i-1)+abs(h[i]-h[i-1]));
        memo[i]=ans;
		mem[i]=true;
    }
  return ans;
}
int main(void) {
  	cin>>N;
    mem[0]=true;
    rep(i, N) {
        cin >> h[i];
        }
  		cout<<DFS(N-1)<<endl;
}


Measured memory_bytes: 9144
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! { _x :usize, _a :usize, _b :usize,}
    let mut _ans = _x;
    _ans -= _a;
    println!("{}", (_ans % _b));
}


Measured memory_bytes: 4352
//#pragma GCC optimize("Ofast")
//#pragma GCC target("avx,avx2,fma")

#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

#define Q int t; scanf("%d", &t); for(int q=1; q<=t; q++)
typedef long long int lli;
typedef pair<int, int> pi;
typedef pair<int, pi> node;
#define oset tree<pi, null_type,greater<pi>, rb_tree_tag,tree_order_statistics_node_update>

#define N 100005
lli dp[N][15], mod = 1e9+7;
string s;


int main()
{
    cin >> s;
    //s = '#'+s;
    int num = 0;// = s[1]-'0';
    if(s[0] == '?'){
        for(int i=0; i<10; i++){
            dp[0][i] = 1;
        }
    }
    else{
        num = s[0]-'0';
        dp[0][num] = 1;
    }
    int n = s.size();
    for(int i=1; i<n; i++){
        if(s[i] == '?'){
            for(int j=0;j<13; j++){
                for(int k=0; k<10; k++){
                    num = (j*10+k)%13;
                    dp[i][num] = (dp[i][num]+dp[i-1][j]) % mod;
                }
            }
        }
        else{
            for(int j=0; j<13; j++){
                num = s[i]-'0';
                num = (j*10+num)%13;
                dp[i][num] = (dp[i][num]+dp[i-1][j]) % mod;
            }
        }
    }
    cout << dp[n-1][5] << "\n";

    return 0;
}


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


struct node{
  int k;
  node *next, *prev;
};

node *nil;

node* listnode(int k){
  node *c=nil->next;
  while(c!=nil&&c->k!=k){
    c=c->next;
  }
  return c;
}

void nit(){
  nil=(node *)malloc(sizeof(node));
  nil->next=nil;
  nil->prev=nil;
  
}

void delnode(node *li){
  if(li==nil)return;
  li->prev->next=li->next;
  li->next->prev=li->prev;
  free(li);
}

void delkey(int k){
  delnode(listnode(k));
}

void insert(int k){
  node *x=(node *)malloc(sizeof(node));
  x->k=k;
  x->next=nil->next;
  nil->next->prev=x;
  nil->next=x;
  x->prev=nil;
  
}


int main(){
  int k;
  int n;
  int size=0;
  char c[20];
  int p=0;
  int d=0;
  cin>>n;
  nit();
  for(int i=0;i<n;i++){
    scanf("%s%d", c, &k);
    if(c[0]=='i'){
      insert(k);
      p++;
      size++;
    }
    else if(c[0]=='d'){
      if(strlen(c)>6){
	if(c[6]=='F')delnode(nil->next);
	else if(c[6]=='L')delnode(nil->prev);
      }
      else{
      delkey(k);
      d++;
      }
      size--;
    }
    
  }
  node *cc=nil->next;
  int j=0;
  while(1){
    if(cc==nil)break;
    if(j++>0)cout<<" ";
    cout<<cc->k;
    cc=cc->next;
  }
  cout<<endl;
  return 0;
}



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

int main(){
    string s;
    cin >> s;
    int count[26];
    fill(count,count+26,0);
    for(int i=0;i<s.length();i++) count[s[i]%26]++;
    for(int i=0;i<26;i++){
        if(count[i]%2){
            puts("No");
            return 0;
        }
    }
    puts("Yes");
    return 0;
}

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

using namespace std;

int N, K;

int calc(int k){
  int p = 0;
  while(k < K)
    k *= 2, ++p;
  return p;
}

int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> N >> K;
  double res= 0.0;
  for(int i=0;; ++i){
    int p = calc(i+1);
    if(i >= N)
      break;
    res += (1*1.0/N*1.0)*pow((0.5), p);
  }
  cout << fixed << setprecision(15) << res << "\n";
  return 0;
}


Measured memory_bytes: 256
n,m = map(int, input().split())
P = [tuple(map(int, input().split())) for i in range(n)]

ans = [0]
for a in [-1,1]:
    for b in [-1,1]:
        for c in [-1,1]:
            res = []
            for x, y, z in P:
                res.append(a*x+b*y+c*z)
            res.sort(reverse=True)
            ans.append(sum(res[:m]))

print(max(ans))

Measured memory_bytes: 3260
import numpy as np
n= int(input())
ppp = list(map(float,input().split()))
dp = [0]*(n+1)
dp[0]=1
for p in ppp:
  ndp = [item*(1-p) for item in dp]
  ndp = [ndp[i] if i == 0 else ndp[i]+dp[i-1]*p for i in range(n+1)]
  dp = ndp
print(sum(dp[n//2+1:]))

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

using namespace std;
typedef long long ll;
typedef long int lt;
#define rep(i,a,b) for(int i=a;i<b;++i)
#define per(i,a,b) for(int i=a;i>=b;--i)
#define endl "\n"
#define fst ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)

void solve()
{
	string s;
	cin>>s;

	if(s.size()!=6)
	{
		cout<<"No"<<endl;
		return;
	}

	for(int i=0;i<s.size();++i)
	{
		if(s[i]>'z' || s[i]<'a')
			{
				cout<<"No"<<endl;
				return;
			}
	}

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

}

int main()
{
	fst;
	solve();
}

Measured memory_bytes: 256
#include<cstdio>
//#include<algorithm>
#include<iostream>
//#include<cstring>
//#include<cmath> 
//#include<map>
//#include<queue>
#define rg register

using namespace std;

inline void read(int &x){
	rg char ch=getchar();
	while(ch<'0'||ch>'9') ch=getchar();
	while(ch>='0'&&ch<='9'){
		x=x*10+ch-48;
		ch=getchar();
	}
}

const int N=0;
int T,a[N];long long n,m;

int main(){
	cin>>n>>m;
	n%=m; long long mid=m>>1LL;
	if(n<=mid) cout<<n<<endl;
	 else cout<<m-n<<endl;
	return 0;
}

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

lis = []

for _ in range(M):
    i, j = input().split()
    i = int(i)
    lis.append((i, j))


cntsAC = 0

inc = [i for i in range(1, N + 1)]
zeros = [0 for _ in range(N)]

flags = dict(zip(inc, zeros))
flags_forAC = dict(zip(inc, zeros))
flags_forWA = dict(zip(inc, zeros))

cntsWA = 0

for k, v in lis:
    if flags_forAC[k] == 0:
        if v == "AC":
            flags_forAC[k] = 1
            cntsAC += 1
            flags[k] = 1
        else:
            flags_forAC[k] = 1
    else:
        if v == "AC" and flags[k] == 0:
            cntsAC += 1
            flags[k] = 1


for k, v in lis:
    if flags[k] == 1 and v == "WA" and flags_forWA[k] == 0:
        cntsWA += 1
    elif v == "AC":
        flags_forWA[k] = 1

print(cntsAC, cntsWA, sep=" ")

Measured memory_bytes: 48096
#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(){
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    int a, b;
    cin >> a >> b;
    double f;
    f = 1.0 * a / b;

    cout << a / b << endl;
    cout << a % b << endl;
    printf("%.5lf\n", f);

}


Measured memory_bytes: 3348
#include <iostream>
#include <cstdio>
#include <map>
using namespace std;
typedef long long ll;

ll n, k, t, ans, a[200005];
map<ll, ll> mp;
int main() {
	cin >> n >> k;
	mp[0] = 1;
	for(ll i=1; i<=n; i++) {
		if(i>=k) mp[a[i-k]]--;
		scanf("%lld", &t);
		a[i] = (a[i-1] + t-1) % k;
		ans += mp[a[i]]++;
	}
	cout << ans;
	return 0;
}

Measured memory_bytes: 14336
n = int(input())
d = {}
s = input()
for c in set(s):
    d[c] = s.count(c)
for _ in range(n-1):
    s = input()
    for c in d.keys():
        d[c] = min(d[c], s.count(c))
d_sorted = sorted(d.items(), key=lambda x:x[0])
ans = ''
for item in d_sorted:
    ans += item[0]*item[1]
print(ans)

Measured memory_bytes: 9140
N = int(input())
kList = list(map(int, input().split()))
aTotal = 0
bTotal = 0
kList.sort(reverse=True)

for i in range(N):
    if i % 2 == 0:
        aTotal += kList[i]
    else:
        bTotal += kList[i]

print(aTotal - bTotal)

Measured memory_bytes: 3060
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <complex>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <iomanip>
#include <assert.h>
#include <array>
#include <cstdio>
#include <cstring>
#include <random>
#include <functional>
#include <numeric>
#include <bitset>
#include <fstream>

using namespace std;

struct before_main{before_main(){cin.tie(0); ios::sync_with_stdio(false);}} before_main;

#define REP(i,a,b) for(int i=a;i<(int)b;i++)
#define rep(i,n) REP(i,0,n)
#define all(c) (c).begin(), (c).end()
#define zero(a) memset(a, 0, sizeof a)
#define minus(a) memset(a, -1, sizeof a)
template<class T1, class T2> inline bool minimize(T1 &a, T2 b) { return b < a && (a = b, 1); }
template<class T1, class T2> inline bool maximize(T1 &a, T2 b) { return a < b && (a = b, 1); }

typedef long long ll;
int const inf = 1<<29;

int N, M, p;

int go(int a, int b, int dir) {
  if(b > a && dir > 0) return b - a;
  if(a > b && dir < 0) return a - b;
  if(b < a && dir > 0) return b + N - a;
  return a + N - b;
}

int main() {

  cin >> N >> M >> p;
  vector<int> v(M);
  rep(i, M) {
    cin >> v[i];
  }

  v.push_back(p);
  sort(all(v));
  M = v.size();
  int s = -1;
  rep(i, M) if(v[i] == p) { s = i; break; }

  int ans = min(go(v[s], v[(s+1)%M], -1), go(v[s], v[(s-1+M)%M], +1));

  rep(tpoint, M) {
    if(tpoint == s) continue;
    ans = min(ans, go(v[s], v[tpoint%M], +1) + go(v[tpoint], v[(tpoint+1)%M], -1));
    ans = min(ans, go(v[s], v[tpoint%M], -1) + go(v[tpoint], v[(tpoint-1+M)%M], +1));
  }

  cout << ans * 100 << endl;
  
  return 0;
}

Measured memory_bytes: 3136
#include <bits/stdc++.h>
#include <stdio.h>
typedef long long int LL;
#define fr(i,p,n) for(LL i=p;i<n;i++)
#define fr1(i,p,n) for(LL i=p;i>=n;i--)
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define all(v) v.begin(),v.end()
#define PI 3.14159265358979323846
#define MOD 1000000007
#define MOD1 998244353
#define INF 1e18
#define precise cout << std::setprecision(10) << std::fixed;
 
using namespace std;
int main() {
    	LL n;
        cin>>n;
        LL a[n];
        fr(i,0,n) {
            cin>>a[i];
        }
        LL cnt=0;
        LL maxB = 0; 
        for (LL i = 0; i < n; i++){
        if (a[i] > maxB)  maxB = a[i];
            }
    LL mark[maxB+5]; 
    memset(mark, 0, sizeof(mark)); 
    for (LL i = 0; i < n; i++){
        if(mark[a[i]] > 1) continue; 
        for (LL x =a[i]; x <= maxB; x += a[i]) 
            mark[x]++; 
    }
    for (LL i = 0; i < n; i++) {
        if (mark[a[i]]==1) 
             cnt++;
    }       
        cout<<cnt<<endl;
	return 0;
}


Measured memory_bytes: 13012
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pll pair<ll,ll>
#define pii pair<int,int>
#define pb push_back
#define mp make_pair
#define M 1101
#define MOD 1000000007
#define fi first
#define se second
#define vi vector<int>
#define vl vector<ll>
#define all(v) v.begin(),v.end()
#define allr(v) v.rbegin(),v.rend()
#define repl(i,l,r) for(long long i=l;i<=r;++i)
#define rep(i,l,r) for(int i=l;i<=r;++i)
#define ins insert
#define inf INT_MAX
#define vp vector< pair<int,int> >
int n,m;
const int maxn=100005;
vector<int> g[maxn];
bool vis[maxn];
void dfs(int i)
{
    vis[i]=true;
    for(auto j:g[i])
    {
        if(!vis[j])
        {
            dfs(j);
        }

    }
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    cin>>n>>m;
    memset(vis,false,sizeof vis);
    rep(i,1,m)
    {
        int x,y,z;
        cin>>x>>y>>z;
        g[x].pb(y);
        g[y].pb(x);
    }
    int ans=0;
    for(int i=1;i<=n;i++)
    {
        if(!vis[i])
        {
            ans++;
            dfs(i);
        }
    }
    cout<<ans<<"\n";
    return 0;
}



Measured memory_bytes: 8960
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace _0125
{
    public class Program

    {
        public static void Main(string[] args)
        {
            while (true)
            {
                int[] a = RIntAr();
                if (a.All(x => x == -1)) break;
                Console.WriteLine((new DateTime(a[3], a[4], a[5]) - new DateTime(a[0], a[1], a[2])).TotalDays);
            }           
        }

        static string RSt() { return Console.ReadLine(); }
        static int RInt() { return int.Parse(Console.ReadLine().Trim()); }
        static long RLong() { return long.Parse(Console.ReadLine().Trim()); }
        static double RDouble() { return double.Parse(Console.ReadLine()); }
        static string[] RStAr(char sep = ' ') { return Console.ReadLine().Trim().Split(sep); }
        static int[] RIntAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => int.Parse(e)); }
        static long[] RLongAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => long.Parse(e)); }
        static double[] RDoubleAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => double.Parse(e)); }
        static string WAr<T>(IEnumerable<T> array, string sep = " ") { return string.Join(sep, array.Select(x => x.ToString()).ToArray()); }
    }

}



Measured memory_bytes: 16268
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
typedef long long i64;
int main(){
    int N;
    cin >> N;
    cout << (N<1000 ? "ABC":"ABD") << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <climits>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
#include <string>
#include <bitset>
#include <utility>
#include <numeric>
#include <queue>
#include <stack>

using ll = long long;
using namespace std;

constexpr int MOD = 1e9 + 7;
constexpr ll MOD_LL = ll(1e9) + 7;

int main(void) {
	string s;
	cin >> s;
	
	if( s[0] == '7' || s[1] == '7' || s[2] == '7' ) cout << "Yes" << endl;
	else cout << "No" << endl;
	
	return 0;
}


Measured memory_bytes: 3624
/*input
5
1 10000 1000000000
1 10000 1000000000
1 10000 1000000000
1 10000 1000000000
1 10000 1000000000

*/
/*

**************************
*						 *
* AUTHOR :: shado_w      *
*						 *
**************************

*/
#include<bits/stdc++.h>
#define lld          long long int
#define pb          push_back
#define ppb         pop_back
#define	endl		'\n'
#define mii         map<lld,lld>
#define msi         map<string,lld>
#define mis         map<lld, string>
#define mpi         map<pair<lld ,lld >,lld >
#define pii         pair<lld,lld>
#define vi          vector<lld>
#define vpi 		vector<pii>
#define vs          vector<string>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (lld)x.size()
#define hell        1000000007
#define rrep(i,m,n)	for(lld i=m;i>=n;i--)
#define rep(i,m,n)	for(lld i=m;i<n;i++)
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
#define what_is(x)  cerr << #x << " is " << x << endl;
#define pr(x) 		cout<< x << " ";
#define pre(x)		cout<< x << endl ;
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
template<typename T>
using ordered_set = tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>; 
//change null_type to get ordered_map
#define N  1005
lld dp[N][20*N];
void inii(){
	rep(i,0,N){
		rep(j,0,20*N){
			dp[i][j]=-1;
		}
	}
}
vector <pair<pii,lld>> V;
lld n;
lld func(lld pos,lld weight){
	if(weight<0){
		return -1e18;
	}
	if(pos==n){
		return 0;
	}
	if(dp[pos][weight]!=-1){
		return dp[pos][weight];
	}
	lld ans=0;	
	ans=max(ans,func(pos+1,weight));
	ans=max(ans,V[pos].S+func(pos+1,min(weight-V[pos].F.F,V[pos].F.S)));
	dp[pos][weight]=ans;
	return ans;
}
void solve()
{
	inii();
	cin >> n;
	V.resize(n);

	rep(i,0,n){
		cin >> V[i].F.F >> V[i].F.S >> V[i].S;
	}
	auto cmp = [&] (pair<pii,lld> x,pair<pii,lld> y){
		return (x.F.S+x.F.F) > (y.F.S+y.F.F);
	};

	sort(all(V),cmp);
	cout << func(0,20000) << endl;
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int tests=1;
	//cin>>tests;
	while(tests--)
	{
		solve();
	}
}

Measured memory_bytes: 161544
coin_a = gets.chomp.to_i
ptn500a = 1 + coin_a
coin_b = gets.chomp.to_i
ptn100b = 1 + coin_b
coin_c = gets.chomp.to_i
ptn050c = 1 + coin_c
coin_x = gets.chomp.to_i

ptn = 0
ptn050c.times do |c|
  ptn100b.times do |b|
    ptn500a.times do |a|
      val = (50 * c) + (100 * b) + (500 * a)
      ptn += 1 if val == coin_x
    end
  end
end
print "#{ptn}\n"

Measured memory_bytes: 1788
loop {
  a, op, b = gets.split(" ").map(&:to_s)
  a = a.to_i
  b = b.to_i

  op == '?' && break

  case op
  when '+'
    puts a + b
  when '-'
    puts a - b
  when '*'
    puts a * b
  when '/'
    puts a / b
  end
}

Measured memory_bytes: 8612
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
const int N=100050;
int dp[N];
vector<int> G[N];
bool was[N];
int ans;
void DFS(int u)
{
was[u]=1;
for(int v:G[u])
{
if(!was[v])
DFS(v);
dp[u]=max(dp[u],dp[v]+1);
}
ans=max(ans,dp[u]);
}
int main()
{
int n,m,u,v;
scanf("%i %i",&n,&m);
for(int i=1;i<=m;i++)
scanf("%i %i",&u,&v),
G[u].pb(v);
for(int i=1;i<=n;i++)
if(!was[i])
DFS(i);
printf("%i",ans);
return 0;
}

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

typedef pair<int, int> pii;
typedef long long ll;
template<class T> using V = vector<T>;
template<class T> using VV = V<V<T>>;

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(int i=m;i<(n);i++)
#define ALL(c) (c).begin(),(c).end()
#define dump(x) cout << #x << " = " << (x) << endl
constexpr ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n-1); }

template<class T, class U> void chmin(T& t, const U& u) { if (t > u) t = u; }
template<class T, class U> void chmax(T& t, const U& u) { if (t < u) t = u; }

template<class T, class U>
ostream& operator<<(ostream& os, const pair<T, U>& p) {
	os<<"("<<p.first<<","<<p.second<<")";
	return os;
}

template<class T>
ostream& operator<<(ostream& os, const vector<T>& v) {
	os<<"{";
	rep(i, v.size()) {
		if (i) os<<",";
		os<<v[i];
	}
	os<<"}";
	return os;
}

ll powmod(ll x, ll k, ll MOD) {
	ll res = 1;
	while (k) {
		if (k & 1) {
			res = res * x % MOD;
		}
		x = x * x % MOD;
		k /= 2;
	}
	return res;
}

ll modinv(ll x, ll MOD) {
	return powmod(x, MOD - 2, MOD);
}

int main() {
	int N, P;
	string S;
	cin >> N >> P >> S;
	V<int> ds(N);
	rep(i, N) ds[i] = S[i] - '0';

	ll ans = 0;

	if (P == 2 || P == 5) {
		for (int i = 0; i < N; ++i) {
			if (ds[i] % P == 0) {
				ans += i + 1;
			}
		}
	} else {
		V<ll> cnt(P);

		ll x = 0;
		++cnt[x];

		for (int i = 0; i < N; ++i) {
			x = (x * 10 + ds[i]) % P;
			ll v = x * modinv(powmod(10, i+1, P), P) % P;
			ans += cnt[v];
			++cnt[v];
		}
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 1412
#include<bits/stdc++.h>
#define ll long long
#define fi first
#define se second
#define show(x) cout<<#x<<"="<<x<<"\n"
using namespace std;

int n,m;
string s;
int a[510][3];

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.precision(10);
    cout<<fixed;
#ifdef LOCAL_DEFINE
    FILE *stream1;
    //FILE *stream2;
    stream1=freopen("in","r",stdin);
    //stream2=freopen("out","w",stdout);
    if(stream1==NULL)return 0;
    //if(stream2==NULL)return 0;
#endif
    cin>>n;
    for(int i=0;i<n-1;i++){
        cin>>a[i][0]>>a[i][1]>>a[i][2];
    }
    //cerr<<1<<endl;
    for(int i=0;i<n-1;i++){
        int sum=a[i][0]+a[i][1];
        //cerr<<2<<endl;
        for(int j=i+1;j<n-1;j++){
            //cerr<<3<<endl;
            if(sum<=a[j][1]){
                sum=a[j][1];
            }else{
                for(int k=0;k<=100;k++){
                    //cerr<<4<<endl;
                    if((sum+k)%a[j][2]==0){
                        sum=sum+k;
                        break;
                    }
                }
            }
            sum+=a[j][0];
        }
        cout<<sum<<endl;
    }
    cout<<0<<endl;
#ifdef LOCAL_DEFINE
    cerr<<"Time elapsed: "<<1.0*clock()/CLOCKS_PER_SEC<<"s.\n";
    fclose(stream1);
    //fclose(stream2);
#endif
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define int long long
#define ld long double
#define fi first
#define se second
#define all(uiet) uiet.begin(),uiet.end()
#define read(UIET) for(int i = 0; i < n; ++i) cin >> UIET[i]
#define out(UIET) for(int i = 0; i < n; ++i) cout << UIET[i]
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define vpp vector<pair< int, int > >
#define pll pair<int , int >
#define ppll pair < pll , pll >
#define debug(n1) cout << n1 << endl
#define len(a) ((int) (a).size())
#define endl "\n"
#define mod 1000000007
const int INF=(1LL<<60)-1;
bool isPerfectSquare(long double x) {   
    long double sr = sqrt(x); 
    return ((sr - floor(sr)) == 0); 
} 
bool isPrime(int x){
    for(int i = 2; i * i <= x; ++i){
        if(x % i == 0) return 0;
    }
    return 1;
}
int32_t main(){
    SPEED;
    int x;
    cin >> x;
    for(int i = x; i <= 1000000; ++i){
        if(isPrime(i)){
            cout << i ;
            break;
        }
    }
}


Measured memory_bytes: 3656
# include <bits/stdc++.h>
# define rep(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
# define reps(i, n) for(int i=1, i##_len=(n); i<=i##_len; ++i)
# define rrep(i, n) for(int i=((int)(n)-1); i>=0; --i)
# define rreps(i, n) for(int i=((int)(n)); i>0; --i)
# define range_for(i, b, e) for(int i=(b), i##_len=(e); i<=i##_len; ++i)
# define ALL(x) (x).begin(), (x).end()
# define RALL(x) (x).rbegin(), (x).rend()
# define pb push_back
# define len(x) ((int)(x).size())
# define optimize_cin() cin.tie(0); ios::sync_with_stdio(false)
# define debug(x) std::cerr<<#x<<": "<<(x)<<endl;
# define LINT_MAX (LONG_LONG_MAX)
# define cauto const auto
using namespace std;
using lint = long long;
template <class Type> inline constexpr bool InRange(const Type& x, const Type& i, const Type& a) { return (i <= x) && (x <= a); }
template<class Integer>bool chmax(Integer &a, const Integer &b) { if (a<b) { a=b; return 1; } return 0; }
template<class Integer>bool chmin(Integer &a, const Integer &b) { if (b<a) { a=b; return 1; } return 0; }
template<class Integer>bool IsOdd(Integer &n) { return n & 1; }
template<class Integer>bool IsEven(Integer &n) { return !(n & 1); }
int ctoi(const char c) { return ('0' <= c && c <= '9') ? (c - '0') : -1; }
string YesNo(bool b) { return b ? "Yes" : "No"; }
string YESNO(bool b) { return b ? "YES" : "NO"; }
string yesno(bool b) { return b ? "yes" : "no"; }
int dy[4] = {0, 1, 0, -1};
int dx[4] = {1, 0, -1, 0};

// 整数の桁数を返す ( log(N) )
template <class Integer> Integer GetDigit(Integer n) {
    Integer d = 0;
    while (n) {
        n /= 10;
        d++;
    }
    return d;
}

// 素数かどうかを返す ( O(sqrt(N)) )
template <class Integer>
constexpr bool IsPrime(const Integer n) noexcept {
    if (n < 4) return n == 2 || n == 3;
    if (n % 2 == 0 || n % 3 == 0 || (n % 6 != 1 && n % 6 != 5)) return false;
    for (Integer i = 5; i * i <= n; i += 6) if (n % i == 0 || n % (i + 2) == 0) return false;
    return true;
}

vector<int> primes;
void init()
{
    reps (i, 500)
    {
        if (IsPrime(i))
        {
            primes.pb(i);
        }
    }
}

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

int main()
{
    int N; cin >> N;
    int ans = 0;
    for (int i = 1; i <= N; i += 2)
    {
        if (divisor(i) == 8)
        {
            ans++;
        }
    }

    cout << ans << "\n";

    return 0;
}


Measured memory_bytes: 256
// AOJ 2434: Audition
// 2017.12.30 bal4u@uu

#include <stdio.h>
#include <string.h>

#define A 0.66666666666666666666666666666667
#define M  0xCC
#define minf  -1e10

int n, m;
int vi[2002], da[2002], vo[2002];
double s[2002], e[3][2002];
double dp[4][2002];
char buf[25], *p;

int in()
{
	int n = 0;
	while (*p >= '0') n = 10*n + (*p++ & 0xf);
	p++;
	return n;
}

void calc(double *e, int *a, int x)
{
	int i, j, k, t, a0;
	double p, q[4], r;

	a0 = 0;
	for (i = 0; i <= m; i++) {
		p = 1, q[0] = 1, q[1] = q[2] = q[3] = 0;
		for (j = 1; j < n; j++) {
			t = (a0 + a[j] - 1)/a[j] - 1;
			r = 0;
			if (t >= 0) if (t < m) r = s[t]; else r = s[m];

			p *= 1-r;
			for (k = 2; k >= 0; k--) q[k+1] += q[k] * (1-r), q[k] *= r;
		}
		e[i] = (q[0] + q[1] + q[2]) * x - p;
		a0 += a[0];
	}
}

int main()
{
	int i, j, k;
	
	fgets(p=buf, 15, stdin), n = in(), m = in();

	s[0] = 1;
	for (i = 0; i < m; i++) {
		for (j = i; j >= 0; j--) s[j+1] += s[j] / 3, s[j] *= A;
	}
	for (i = 0; i < m; i++) s[i+1] += s[i];

	for (i = 0; i < n; i++) {
		fgets(p=buf, 25, stdin);
		vi[i] = in(), da[i] = in(), vo[i] = in();
	}
	calc(e[0], vi, 5), calc(e[1], da, 3), calc(e[2], vo, 2);

	memset(dp, M, sizeof(dp));
	dp[0][0] = 0;
	for (i = 0; i < 3; i++) for (j = 0; j <= m; j++) if (dp[i][j] > minf) {
		for (k = 0; k <= m-j; k++) {
			double t = dp[i][j] + e[i][k];
			if (dp[i+1][j+k] < t) {
				dp[i+1][j+k] = t;
			}
		}
	}
	printf("%.9f\n", dp[3][m]);
	return 0;
}

Measured memory_bytes: 1988
A = [list(map(int, input().split())) for _ in range(3)]

N = int(input())
B = [int(input()) for _ in range(N)]

a = []

Atf = [[False] * 3 for _ in range(3)]

for i in range(3):
    for aa in A[i]:
        a.append(aa)

for b in B:
    if b in a:
        for i in range(3):
            for j in range(3):
                if A[i][j] == b:
                    Atf[i][j] = True

res = False

for i in range(3):
    if Atf[i][0] and Atf[i][1] and Atf[i][2]:
        res = True
        break
    elif Atf[0][i] and Atf[1][i] and Atf[2][i]:
        res = True
        break

if not res:
    if Atf[0][0] and Atf[1][1] and Atf[2][2]:
        res = True
    elif Atf[0][2] and Atf[1][1] and Atf[2][0]:
        res = True
 

if res:
    print("Yes")
else:
    print("No")
        


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

int main() {
    iostream::sync_with_stdio(false); cin.tie(NULL);
    
    long long n, l; cin >> n >> l;
    long long arr[n];
    for (int i = 0; i < n; i++) cin >> arr[i];

    bool possible = false;
    for (int i = 0; i < n-1 && !possible; i++) {
        if (arr[i]+arr[i+1] >= l) {
            possible = true;
            cout << "Possible" << '\n';
            for (int j = 1; j <= i; j++) cout << j << '\n';
            for (int j = n-1; j >= i+2; j--) cout << j << '\n';
            cout << i+1 << '\n';
        }
    }

    if (!possible) {
        cout << "Impossible" << '\n';
    }
}


Measured memory_bytes: 1664
#include<bits/stdc++.h>
using namespace std;
#define read freopen("in.txt","r",stdin)
#define write freopen("out.txt","w",stdout)
const int INF=1e9+5;
int main(){
	// read;
	// write;
	int n,nin=INF;
	cin >> n;
	vector<int> w(n+1);
	vector<int> prefix_sum(n+1,0);
	for(int i=1; i<=n; ++i){
		cin >> w[i];
		prefix_sum[i]=prefix_sum[i-1]+w[i];
	}
	for(int i=1;i<=n;++i){
		int l,r;
		l=prefix_sum[i];
		r=prefix_sum[n]-prefix_sum[i];
		nin=min(nin,abs(l-r));
	}
	cout << nin << '\n';
	return 0;
}

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

// types
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;
typedef vector<ll> vll;

// macros
#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define FI first
#define SE second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define REP1(i,n) for(int i=1;i<((int)n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define PB push_back
#define EB emplace_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL

// constants
const int inf = 1e9;
const ll linf = 1LL << 50;
const double eps = 1e-10;
const int MOD = 1e9 + 7;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};


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

  ll n;
  cin >> n;

  if(n/10 == 9 || n%10 == 9)
     cout << "Yes" << endl;
  else
    cout << "No" << endl;
}


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

#ifndef LOCAL_
#define fprintf if( false ) fprintf
#endif // LOCAL_
#define dumpi(x1) fprintf(stderr, "#%s.%d (%s) = (%d)\n", __func__, __LINE__, #x1, x1);
#define dumpii(x1, x2) fprintf(stderr, "#%s.%d (%s, %s) = (%d, %d)\n", __func__, __LINE__, #x1, #x2, x1, x2);
#define dumpiii(x1, x2, x3) fprintf(stderr, "#%s.%d (%s, %s, %s) = (%d, %d, %d)\n", __func__, __LINE__, #x1, #x2, #x3, x1, x2, x3);
#define dumpl(x1) fprintf(stderr, "#%s.%d (%s) = (%ld)\n", __func__, __LINE__, #x1, x1);
#define dumpll(x1, x2) fprintf(stderr, "#%s.%d (%s, %s) = (%ld, %ld)\n", __func__, __LINE__, #x1, #x2, x1, x2);
#define dumpd(x1) fprintf(stderr, "#%s.%d (%s) = (%lf)\n", __func__, __LINE__, #x1, x1);
#define dumpdd(x1, x2) fprintf(stderr, "#%s.%d (%s, %s) = (%lf, %lf)\n", __func__, __LINE__, #x1, #x2, x1, x2);

struct Solver {
  int x, y;
  int res;
  Solver(int x_, int y_) : x(x_), y(y_) {
    if( 0 <= x ) {
      if( x <= y ) {
        res = y - x;
      }
      else if( 0 < y and y < x ) {
        res = 2 + std::abs(x - y);
      }
      else {
        res = 1 + std::abs((-x) - y);
      }
    }
    else {
      if( y < x ) {
        res = 2 + std::abs(x - y);
      }
      else if( x <= y and y <= 0 ) {
        res = std::abs(x - y);
      }
      else {
        res = 1 + std::abs((-x) - y);
      }
    }
  }
  int f() {
    return res;
  }
};

int main() {
  int x, y;
  scanf("%d %d", &x, &y);
  Solver s(x, y);
  printf("%d\n", s.f());
  
  return 0;
}

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

ll floor(ll a, ll b) {
    if (b < 0) {
        a *= -1;
        b *= -1;
    }
    if (a < 0) {
        return (a - b + 1) / b;
    } else {
        return a / b;
    }
}

int main() {
    ll A, B, N;
    cin >> A >> B >> N;

    cout << floor(A * min(B - 1, N), B) << endl;
}


Measured memory_bytes: 3636