akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

#define _USES_MATH_DEFINES

#define x first
#define y second

int main() {
    int n; cin >> n;
    vector< pair<int, int> > P (n, {0, 0});
    for(int i = 0; i < n; i++) {
        cin >> P[i].x >> P[i].y;
    }
    //
    sort(P.begin(), P.end(), [](auto a, auto b) -> int { return atan2l(a.y, a.x) < atan2l(b.y, b.x); } );

    long long answer = 0;
    for( int L = 0; L < n; L++ ) {
        long long X = P[L].x, Y = P[L].y;
        answer = max(answer, X*X + Y*Y);
        for(int i = 1; i < n; i++) {
            int R = (L + i) % n;
            X += P[R].x;
            Y += P[R].y;
            answer = max(answer, X*X + Y*Y);
        }
    }
    //
    cout << fixed << setprecision(50) << sqrtl(answer);
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <cmath>
#include <cstring>
using namespace std;

#define fi first
#define se second
typedef long long LL;
typedef long double LD;

LL N,A,B,C,D;

int main(){
    cin >> N >> A >> B >> C >> D;

    if (A>B) swap(A,B);

    int i; bool ok=0;
    for (i=0; i<=N-1; i++){
        LL val=B-A+i*C-(N-1-i)*C;

        LL dif=D-C;
        if (-i*dif<=val && val<=(N-1-i)*dif) ok=1;
    }

    cout << (ok ? "YES" : "NO") << "\n";

    return 0;
}


Measured memory_bytes: 256
//----------------------------------------------------------------------
#include <iostream>
#include <map>
#include <vector>
#include <algorithm>
#include <string>
//----------------------------------------------------------------------
using namespace std;
int main(void) {
    int n; cin >>n; 
    vector<long long> a(n);
    for(auto &v : a) {
        cin >> v; 
    }
    bool flag = true;
    sort(a.begin(),a.end());
    for(int i = 1 ; i < (int)a.size(); ++i) {
       if(a[i-1]==a[i]) {
            flag = false; 
            break;
       }
    }
    if(flag)
        cout << "YES" << endl;
    else
        cout << "NO" << endl;
    return 0;
}



Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define mp make_pair
#define deb(x) cout<< #x << " " << x << "\n";
#define INF 9223372036854775807
const ll mod=998244353;

const int MAXN=10000001;
ll spf[MAXN],a[MAXN]; 
   
void sieve() 
{ 
    spf[1] = 1; 
    for (int i=2; i<MAXN; i++) 
        spf[i] = i; 
    for (int i=4; i<MAXN; i+=2) 
        spf[i] = 2; 
  
    for (int i=3; i*i<MAXN; i++){ 
        if (spf[i] == i){ 
            for (int j=i*i; j<MAXN; j+=i) 
                if (spf[j]==j) 
                    spf[j] = i; 
        } 
    } 
} 

int main() {
    
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    
    ll n;
    cin>>n;
    sieve();
    ll ans=1;
    a[1]=1;
    for(ll i=2;i<=n;i++){
        ll tot=1,x=i,c=0;
        while(x!=1){
            ll p=spf[x];
            c++;
            x/=spf[x];
            if(p!=spf[x]){
                tot*=(c+1);
                c=0;
            }
        }
        //cout<<tot<<" ";
        ans+=i*tot;
    }
    cout<<ans;
    
    return 0;
}

Measured memory_bytes: 81752
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,queue,copy

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()

def main():
  n,k=LI()

  ans=0
  ans+=(n//k)**3

  if k%2==0:
    _a=0
    for i in range(1,n+1):
      if i%k==k//2:
        _a+=1
    ans+=_a**3

  return ans

# main()
print(main())


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

int main(){
  string s;
  cin >> s;
  int flag = 0;

  rep(i,0,s.length()){
    if(i%2==0 && s[i]=='h'){
      flag = 1;
      continue;
    }
    else if(i%2==1 && s[i]=='i'){
      flag = 0;
      continue;
    }
    else{
      cout << "No" << endl;
      return 0;
    }
  }
  cout << (flag?"No":"Yes") << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <cmath>
#include <cfloat>
#define zero(x) (((x)>0?(x):-(x))<eps)

#define pause cout << " press ansy key to continue...",  cin >> chh
#define file_r(x) freopen(x,  "r",  stdin)
#define file_w(x) freopen(x,  "w",  stdout)
#define lowbit(x) ((x) & (-x))
#define repit(i, c) for (__typeof__((c).begin()) i = (c).begin(); i != (c).end(); i++)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repe(i, u) for (int i = head[u]; i != -1; i = nxt[i])
#define repd(i, n) for (int i = (n - 1); i >= 0; i--)
#define FOR(i, n, m) for (int i = (n); i <= (m); i++)
#define FORD(i, n, m) for (int i = (n); i >= (m); i--)
#define pb push_back
#define X first
#define Y second
#define ins insert
#define rb rbegin
#define be begin
#define er erase
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define SZ(c) (c).size()
#define ALL(c) (c).begin(), (c).end()
#define sqr(r) ((r) * (r))
#define dis(x1, y1, x2, y2) (((x1) - (x2)) * ((x1) - (x2)) + ((y1) - (y2)) * ((y1) - (y2)))
#define FASTIO ios::sync_with_stdio(false);cin.tie(0)

#define sc(x) cout << #x" = " << x << endl, system("pause")
#define sc2(x, y) cout << #x" = " << x << " " << #y" = " << y << endl, system("pause")
#define sc3(x, y, z) cout << #x" = " << x << " " << #y" = " << y << " " << #z" = " << z << endl, system("pause")
#define sc4(x, y, z, w) cout << #x" = " << x << " " << #y" = " << y << " " << #z" = " << z << " " << #w" = " << w << endl, system("pause")

#define in(n) scanf("%d", &n)
#define in2(n, m) scanf("%d %d", &n, &m)
#define in3(x, y, z) scanf("%d %d %d", &x, &y, &z)

using namespace std;
int chh;

typedef vector<int> vi;
typedef set<int> si;
typedef map<int, int> mii;
typedef pair<int, int> pii;
typedef pair<int, pii> pi3;
typedef vector< pair<int, int> > vpii;
typedef long long LL;

const int N = 10;

int n, m;
char g[N][N];
int f[N][N];

int main() {
    int flag, x, y, a, b;
    while (~in2(n, m)) {
        rep (i, n) scanf("%s", g[i]);
        flag = 1, x = 0, y = 0;
        memset(f, 0, sizeof(f));
        while (1) {
            f[x][y] = 1;
            if (x == n - 1 && y == m - 1) break;
            a = (x + 1 < n) && (g[x + 1][y] == '#');
            b = (y + 1 < m) && (g[x][y + 1] == '#');
            if (!(a ^ b)) {
                flag = 0;
                break;
            }
            if (a) x++;
            else y++;
        }
        rep (i, n) rep (j, m) {
            if (g[i][j] == '#' && f[i][j] == 0) {
                flag = 0;
                break;
            }
        }
        puts(flag ? "Possible" : "Impossible");
    }
    return 0;
}


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

const ll MOD { 1000000007 };
const double PI = acos(-1.0);

#define stdfor(i, a, b) for(int i = (a); i < (b); ++i)
#define invfor(i, n, b) for(int i = (n); i--; )
#define foreach(a, b) for(auto& a : b)
#define cforeach(a, b) for(const auto& a : b)
#define sz(a) ((int)(a.size()))
#define fill(a,v) memset(a, v, sizeof a)
#define all(a) a.begin(), a.end()
#define in(a,b) ((b).find(a) != (b).end())
#define entre(l, i, r) (l<i&&i<r)
#define pb push_back
 
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
 
    int N, M;

    cin >> N >> M;
    vector<int> notas(M+1, 0);

    for(int i = N; i--; ) {
        int valor;
        cin >> valor;

        while(valor--) {
            int nota;
            cin >> nota;
            notas[nota]++;
        }
    }

    int total=0;

    for(const auto& n : notas) {
        if(n == N)
            total++;
    }

    cout << total << endl;
 
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
 
typedef pair<int,int> P;
struct edge{int to, id;};
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define INF 1000000000000
 
ll solve(ll n){
    if(n == 1) return 1;
    else if(n > 1){
        //return 1+solve(n/2) * 2;
      if(n % 2 ==0) return 1+solve(n/2) * 2;
      else return 1+solve((n-1)/2) * 2;
    }
}
 
 int main(){
     int n;
     cin >> n;
     int a[n];
     int block = 1000000;
     int count = 0;
     int now = 1;
     rep(i,n){
         int temp;
         cin >> temp;
         a[i] = temp;
         if(temp == now){
             now++;
         }
         else{
             count++;
         }
    }
    if(now == 1){
        cout << -1 << endl;
    }
    else{
        cout << count << endl;
    }
 
 }

Measured memory_bytes: 4264
N, W = map(int, input().split())
w = []
v = []

for i in range(N):
    a, b = map(int, input().split())
    w.append(a)
    v.append(b)


dp = [0] * (W+1)

for i in range(N):
    for j in range(W,0,-1):
        if j - w[i] >= 0:
            dp[j] = max(dp[j], dp[j-w[i]] + v[i])

print(dp[W])

Measured memory_bytes: 41708
#include <iostream>

using namespace std;
const int MAX_N = 3000;

void solve() {
  int N;
  int a[MAX_N];
  int ans = 0;
  cin >> N;
  for (int i = 0; i < N; i++) {
    cin >> a[i];
    ans += a[i] - 1;
  }

  cout << ans << endl;
}

int main(void) {
  solve();
}

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


int main() {
  int n;
  cin >> n;
  ll ans = 0;

  for(int i = 1; i <= n; i++){
    if(i %3 == 0 && i %5 == 0){
      continue;
    }else if(i %3 == 0){
      continue;
    }else if(i %5 == 0){
      continue;
    }else{
      ans += i;
    }
  }
  cout << ans << endl;


}

Measured memory_bytes: 3568
import java.util.*;

class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int K = sc.nextInt();
    Integer H[] = new Integer[N];
    for(int i=0;i<N;i++) H[i] = sc.nextInt();
    Integer dp[] = new Integer[N];
    for(int i=1;i<N;i++) dp[i] = Integer.MAX_VALUE;
    dp[0] = 0;
    
    for(int i=0;i<N-1;i++){
      for(int d=1;d<=K&&i+d<N;d++){
        dp[i+d] = Math.min(dp[i+d], dp[i]+Math.abs(H[i+d]-H[i]));
      }
    }
    
    System.out.println(dp[N-1]);
  }
}

Measured memory_bytes: 101108
#include <iostream>
#include <vector>
#include <cmath>
using namespace std;
int main() {

  int N;
  cin >> N;
  if (N == 1) {
    cout << 0;
    return 0;
  }
  vector<char> v;
  bool r = false;
  int moves = 0;
  for (int i = 0; i < N; i++) {
    char t;
    cin >> t;
    v.push_back(t);
  }

  int i = 0;
  int j = v.size()-1;
  while (j > i) {
    if (v[i] == 'W' and v[j] == 'R') {
        moves++;
        v[i] = 'R';
        v[j] = 'W';
        r = true;;
    }
    if (v[i] == 'R') {
      i++;
    }
    if (v[j] == 'W') {
      j--;
    }
  }
  cout << moves;

  return 0;
}


Measured memory_bytes: 3308
/*
                            Author: Ankit Kaul
*******Code Belongs to Respective Author Only*************
*/
/*#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
*/
/*freopen("input.txt", "rt", stdin);
freopen("output.txt", "wt", stdout);
*/
#include <bits/stdc++.h>
#define endl       '\n'
#define PI          3.141592653589
#define jaldi       ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define M           1000000007
#define int         long long int
#define inf         INT_MAX
#define pb          emplace_back
#define pf          emplace_front
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define all(a)      (a).begin(),(a).end()
#define rall(a)     (a).rbegin(),(a).rend()
using namespace std;
int gcd(int a,int b) { return b == 0 ? a : gcd(b, a % b); }
int power(int x,int n){
    int result=1;
    while(n>0)
        {   if(n % 2 ==1)
            result=(result * x)%M;
            x=(x*x)%M;
            n=n/2;
        }
    return result%M;
}
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 inv(int a,int m)
{   return power(a,m-2);
}   
int lcm(int a,int b)
{   return a*b/(gcd(a,b));
}
signed main()
{   jaldi  
    int n;
    cin>>n;
    int mx=-1,mn=1e10,g=-1,f=1e10;
    for(int i=0;i<n;i++)
    {   int x,y;
        cin>>x>>y;
        if(x+y>=mx)
        mx=x+y;
        if(x+y<=mn)
        mn=x+y;
        if(x-y<=f)
        f=x-y;
        if(x-y>=g)
        g=x-y;
    }
    if(mx==-1 || mn==1e10)
    cout<<g-f<<endl;
    else if(g==-1 || f==1e10)
    cout<<mx-mn<<endl;
    else
    cout<<max(mx-mn,g-f);
}


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

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
#define ALL(a)     (a).begin(),(a).end()
#define RALL(a)     (a).rbegin(),(a).rend()
#define PRINT(a)   cout << (a) << endl

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define Fi first
#define Se second

#define debug(x) cerr << x << " " << "(L:" << __LINE__ << ")" << '\n';

using ll = long long int;
using P = pair<int,int>;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using pii = pair<int, int>;

template <typename T> using PQ = priority_queue<T>;
template <typename T> using minPQ = priority_queue<T, vector<T>, greater<T>>;

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

const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1e9 + 7;

const int mod = 1000000007;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const {
    return pow(mod-2);
  }
  mint& operator/=(const mint a) {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const {
    mint res(*this);
    return res/=a;
  }
};


mint mpow(int x, int n){
  if(n==0)return 1;

  mint y = mpow(x, n/2);
  y *= y;

  if(n%2==1) y *=x;
  return y;
}

struct combination {
  vector<mint> fact, ifact;
  combination(int n):fact(n+1),ifact(n+1) {
    assert(n < mod);
    fact[0] = 1;
    for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
  }
  mint operator()(int n, int k) {
    if (k < 0 || k > n) return 0;
    return fact[n]*ifact[k]*ifact[n-k];
  }
};


int main(){
  int n;
  cin >> n;
  vector<mint> sum(n+1,0);
  vector<mint> a(n);

  REP(i,n){
    int aa;
    cin >> aa;
    a[i] = aa;
    sum[i+1] = sum[i] + a[i];
  }
  mint ans=0;
  FOR(i,1,n){
    ans += sum[i] * a[i];
    //cout << sum[i].x << endl;
  }
  cout << ans.x << endl;
}



Measured memory_bytes: 6424
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author EDGE
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastReader in = new FastReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Task solver = new Task();
        solver.solve(1, in, out);
        out.close();
    }

    static class Task {
        public void solve(int testNumber, FastReader in, PrintWriter out) {

            int n = in.nextInt();
            String s = in.nextLine();
            if (n % 2 != 0) {
                out.println("No");
                return;
            }

            out.println(s.substring(0, n / 2).equals(s.substring(n / 2)) ? "Yes" : "No");
        }

    }

    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader(InputStream inputStream) {
            br = new BufferedReader(new
                    InputStreamReader(inputStream));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }

    }
}



Measured memory_bytes: 21460
use std::io::Read;

fn main() {
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();

    let answer = solve(&buf);

    println!("{}", answer);
}

fn solve(input: &str) -> String {
    let mut iterator = input.split_whitespace();

    let mut x: isize = iterator.next().unwrap().parse().unwrap();
    let mut k: isize = iterator.next().unwrap().parse().unwrap();
    let d: isize = iterator.next().unwrap().parse().unwrap();

    if x < 0 {
        x = -x;
    }

    if k < x / d {
        return (x - d * k).abs().to_string();
    }

    k = k - x / d;
    x = x % d;

    if k % 2 == 0 {
        return x.abs().to_string();
    }

    return (x - d).abs().to_string();
}


Measured memory_bytes: 2156
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mp make_pair
#define pb push_back
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)


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

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

  while(n>0){
    cnt++;
    n/=k;
  }
  cout << cnt << 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;
using ll = long long;

int main() {
    // 制約見て！！！デカかったらlong longにすること！
    int n;
    cin >> n;
    vector<int> t(n+1);
    vector<int> x(n+1);
    vector<int> y(n+1);
    t[0] = x[0] = y[0] = 0;

    rep(i, n) { cin >> t[i + 1] >> x[i + 1] >> y[i + 1]; }
    int dist ,dt;
    for(int i = 1; i <= n; i++) {
        dist = abs(x[i]-x[i-1]) + abs(y[i]-y[i-1]);
        dt = t[i]-t[i-1];
        if(dist > dt){
            cout << "No" << endl;
            return 0;
        }else if(dist%2 != dt%2){
            cout <<"No" << endl;
            return 0;
        }
    }
    cout << "Yes"<<endl;

}

Measured memory_bytes: 1408
#include<iostream>
#include<vector>
#include<set>
#include<algorithm>
#include<queue>
#include<utility>
#define LL long long
using namespace std;



int main() {
	int N, a[20], w[20], rmin=10000, lmin=10000;
	cin >> N;
	for (int i = 0; i < N; i++)cin >> a[i];
	for (int i = 0; i < N; i++) {
		cin >> w[i];
		if (a[i])rmin = min(rmin, w[i]);
		else lmin = min(lmin, w[i]);
	}
	if (rmin == 10000 || lmin == 10000)cout << 0 << endl;
	else cout << rmin + lmin << endl;

	return 0;
}





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

using namespace std;

#define LL long long

LL n;

LL S(LL x){
	LL ret=0;
	for (;x;x/=10) ret+=x%10;
	return ret;
}

int main(){
	scanf("%lld",&n);
	LL x=1;
	while (n--){
		printf("%lld\n",x);
		LL y=0;
		for (LL i=1;i<=1000000000000000;i*=10)
			if (y==0||(x+i)*S(y)<y*S(x+i)) y=x+i;
		x=y;
	}
	
	return 0;
}
			

Measured memory_bytes: 256
#include <stdio.h>		// standard input output
#include <iostream>		// input output stream, cin cout( console in console out)
#include <string>
#include <vector>
#include <algorithm>
#include <iomanip>		// input output manipulation

using namespace std;
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define ll long long 

int main() {
     int a;
  cin >> a;
  
  cout << a + a*a + a*a*a << endl; // 標準出力
}

Measured memory_bytes: 3620
while True:
    N, T, L, B = [int(_) for _ in raw_input().split()]
    if N == T == L == B == 0:
        break
    loses = {int(raw_input()) for _ in xrange(L)}
    backs = {int(raw_input()) for _ in xrange(B)}

    probs = [[0.0] * (N + 1) for _ in xrange(T + 1)]
    for t in xrange(T + 1):
        probs[t][N] = 1.0

    for t in xrange(1, T + 1):
        for x in xrange(N):
            if x in loses:
                dt = 2
                if t == 1:
                    continue
            else:
                dt = 1
            for dx in xrange(1, 7):
                if x + dx <= N:
                    probs[t][x] += probs[t - dt][x + dx] / 6.0
                else:  # excess
                    probs[t][x] += probs[t - dt][2 * N - (x + dx)] / 6.0
        for x in backs:
            probs[t][x] = probs[t][0]

    print("{:.6f}".format(probs[T][0]))

Measured memory_bytes: 6692
#include <bits/stdc++.h>
using namespace std;
int main(){
  int A,B;
  cin>>A>>B;
  int count_butu=0,count_ana=1;
  while(count_ana<B){
    count_butu++;
    count_ana+=A-1;
    }
  cout<<count_butu<<endl;
}

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

class Cmondai
{
    static void Main()
    {
        var dg = Console.ReadLine().Split(' ').Select(x => Int64.Parse(x)).ToArray();
        var D = (int)dg[0];
        var G = dg[1];
        var list = new List<long[]>();
        for (int i=0;i<D;++i)
        {
            var pc= Console.ReadLine().Split(' ').Select(x => Int64.Parse(x)).ToArray();
            list.Add(new long[2] { pc[0], pc[1] });
        }
        var ans = long.MaxValue;
        for (int i = 0; i < (Math.Pow(2, D)); i++)
        {
            var count = 0L;
            var total = 0L;
            for (int j = 0; j < D; j++)
            {
                if ((1 & i >> j) == 1) {
                    count += list[j][0];
                    total += list[j][0] * 100 * (j + 1) + list[j][1];
                }
            }
            if (total < G)
            {
                for (int j = D - 1; 0 <= j; --j)
                {
                    if ((1 & i >> j) == 0)
                    {
                        var add = ((G-total)+((j + 1) * 100)-1) / ((j + 1) * 100);
                        if (add <= list[j][0])
                        {
                            count+=add;
                            total += add * 100 * (j + 1);
                            if (G <= total) ans = Math.Min(ans, count);
                        }
                        break;
                    }
                }
            }
            else ans=Math.Min(ans,count);
        }
        Console.WriteLine(ans);
    }
}


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

public class Hello
{
    public static void Main()
    {
        var s = Console.ReadLine().Trim();
        string[] line = s.Split('T');
        var fx = new List<int>();
        var fy = new List<int>();
        for (int i = 0; i < line.Length; i++)
            if (i % 2 == 0) fx.Add(line[i].Length);
            else fy.Add(line[i].Length);
        line = Console.ReadLine().Trim().Split(' ');
        var x = int.Parse(line[0]);
        var y = int.Parse(line[1]);
        bool startF;
        startF = s[0] == 'F' ? true : false;
        var retx = goDp(fx, x, startF);
        bool rety;
        if (fy.Count() == 0) rety = (y == 0);
        else rety = goDp(fy, y, false);
        Console.WriteLine(retx && rety ? "Yes":"No");
    }
    public static bool goDp(List<int> a, int t, bool first)
    {
        var C = a.Sum(); var ac = a.Count();
        var dp = new bool[ac, 2 * C + 1];

        if (first) dp[0, a[0] + C] = true;
        else { dp[0, C + a[0]] = true; dp[0, C - a[0]] = true; }
        for (int i = 1; i < ac; i++)
            for (int j = 0; j <= 2 * C; j++)
            {
                if (dp[i - 1, j])
                {
                    dp[i, j + a[i]] = dp[i - 1, j];
                    dp[i, j - a[i]] = dp[i - 1, j];
                }
            }
        if (t + C < 2 * C + 1  && t +C  >= 0) return dp[ac - 1, t + C];
        else return false;
    }
}


Measured memory_bytes: 28640
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;

#define int long long

signed main() {
    int N;
    string S;
    cin >> N;
    cin >> S;
    int ans = 0;
    int cur = 0;
    for (int i = 0; i < N; i++) {
        if (S.at(i) == 'I') cur++;
        else cur--;
        ans = max(ans, cur);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
let split c s = (
    let res = ref [] in
    let i = ref 0 in
    let n = String.length s in
    while !i < n do
      let j = !i in
      while !i < n && s.[!i] <> c do i := !i + 1 done;
      res := String.sub s j (!i - j) :: !res;
      i := !i + 1;
    done;
    List.rev !res
  );;

let rec range a b = if a > b then [] else a :: range (a + 1) b;;
let read_ints () = read_line () |> split ' ' |> List.map int_of_string;;

let n = read_int ();;
let ab = Array.make n (0, 0);;
for i = 0 to n - 1 do
  let [x; y] = read_ints () in
  ab.(i) <- (x, y);
done;;
Array.sort (fun (a, b) (c, d) -> compare b d) ab;;

let curr = ref 0;;
let all = ref true;;
for i = 0 to n - 1 do
  curr := !curr + fst ab.(i);
  all := !all && (!curr <= snd ab.(i));
done;;

if !all then
  print_endline "Yes"
else
  print_endline "No";;
    


Measured memory_bytes: 9600
#include<cstdio>
#include<algorithm>
#include<cstring>
#define MN 2005
using namespace std;
int n,m,q,a[MN][MN],b[MN][MN],c[MN][MN];
char ch[MN][MN];
int main(){
	scanf("%d%d%d",&n,&m,&q);int x1,y1,x2,y2;
	for(int i=1;i<=n;i++)scanf("%s",ch[i]+1);
	for(int i=1;i<=n;i++)
		for(int j=1;j<=m;j++){
			a[i][j]=a[i][j-1]+a[i-1][j]-a[i-1][j-1]+(ch[i][j]=='1');
			b[i][j]=b[i][j-1]+b[i-1][j]-b[i-1][j-1]+(ch[i][j]=='1'&&ch[i][j-1]=='1');
			c[j][i]=c[j-1][i]+c[j][i-1]-c[j-1][i-1]+(ch[i][j]=='1'&&ch[i-1][j]=='1');
		}
	while(q--){
		scanf("%d%d%d%d",&x1,&y1,&x2,&y2);
		printf("%d\n",a[x2][y2]-a[x1-1][y2]-a[x2][y1-1]+a[x1-1][y1-1]-(b[x2][y2]-b[x1-1][y2]-b[x2][y1]+b[x1-1][y1])-(c[y2][x2]-c[y2][x1]-c[y1-1][x2]+c[y1-1][x1]));
	}
}



Measured memory_bytes: 52736
#include<cstdio>
#include<algorithm>
#include<cstring>
#define ll long long
using namespace std;
int n;
ll a[505][505],sum[505][505],f[505][505],s[505][505];
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
	for(int j=1;j<=n;j++)
	{
		if(i!=j)scanf("%lld",&a[i][j]);
		sum[i][j]=sum[i-1][j]+sum[i][j-1]-sum[i-1][j-1]+a[i][j];
		s[i][j]=s[i-1][j]+s[i][j-1]-s[i-1][j-1]+a[i][j]*(i<j);
	}
	memset(f,0x3f,sizeof(f));
	f[0][0]=0;
	for(int i=0;i<=n;i++)
	for(int j=i;j<=n;j++)
	{
		if(f[i][j]>1e17)continue;
		for(int k=j+1;k<=n;k++)
		  f[j][k]=min(f[j][k],f[i][j]+s[k][k]-s[j][k]-s[k][j]+s[j][j]+sum[n][j]-sum[n][i]-sum[k][j]+sum[k][i]);
	}
	ll ans=1e18;
	for(int i=0;i<=n;i++)ans=min(ans,f[i][n]);
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 8064
#include<bits/stdc++.h>
#define MAX 1000000
using namespace std;
int visited[MAX+1];
bool run(int x)
{
	if(visited[1])
	{
		if(x!=1||visited[1]>1)
			return false;
	}
	for(int i=2;i*1LL*i<=x;++i)
	{
		if(x%i==0)
		{
			if(visited[i])
			{
				if(x!=i||visited[i]>1)
					return false;
			}
			if(visited[x/i])
			{
				if(x!=x/i||visited[x/i]>1)
					return false;
			}
		}
	}
	if(visited[x]>1)
		return false;
	return true;
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	/*for(int i=2;i<=MAX;++i)
	{
		if(!criba[i])
		{
			int j = i;
			while(j<=MAX)
			{
				criba[j] = i;
				j += i;
			}
		}
	}*/
	int n;
	cin>>n;
	vector<int> v;
	for(int i=0,x;i<n;++i)
		cin>>x,v.push_back(x),visited[x]++;
	int ans = 0;
	for(int i=0;i<n;++i)
		if(run(v[i]))
			ans++;
	cout<<ans;
	return 0;
}

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

#define int long long
#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 rep11(i,n) for(int i=1;i<(int)(n);++i)
#define repo(i,o,n) for(int i=o;i<(int)(n);++i)
#define repm(i,n) for(int i=(int)(n)-1;i>=0;--i)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define pb(n) push_back(n)
#define mp make_pair
#define MOD 1000000007
#define INF LONG_LONG_MAX

int modinv(int a, int m) {
    int b = m, u = 1, v = 0;
    while (b) {
        int t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}

int kr(int a, int n){
    int x = 1;
    while(n > 0){
        if(n&1){
            x = (x*a)%MOD;
        }
        a = (a*a)%MOD;
        n >>= 1;
    }
    return x%MOD;
}

int n,A[10000],hoge=1,ans;
vector<int> v[1000001],p;


signed main() {
    p.pb(2);
    for(int i = 3;i<1100000;i+=2) {
        int b = sqrt(i);
        bool f = true;
        for(auto j : p) {
            if (i%j == 0) {
                f = false;
                break;
            }
            if (j > b) break;
        }
        if (f) p.pb(i);
    }
    cin >> n;
    rep(i,n) {
        cin >> A[i];
        int a = A[i],B=sqrt(A[i]);
        rep(j,p.size()) {
            if (a==1 || B < p[j]) break;
            int cnt=0;
            while(a%p[j] == 0) {
                cnt++;
                a /= p[j];
            }
            if (cnt) v[p[j]].pb(cnt);
        }
        v[a].pb(1);

    }
    rep1(i,1000000) {
        if (v[i].size()) {
            int ma=0;
            for(auto j : v[i]) ma = max(ma, j);
            hoge = (hoge*kr(i,ma))%MOD;
        }
    }
    rep(i,n) ans = (ans + hoge*modinv(A[i], MOD))%MOD;
    cout << ans << endl;
}



Measured memory_bytes: 25204
#include <algorithm>
#include <functional>
#include <iostream>
#include <vector>

using namespace std;
using ll = long long;

vector<ll> P, M, Z;
ll K;

bool negative(ll T) {
  ll ret{};
  for (int i = 0; i != (int)P.size(); ++i) {
    ll q = (T - P[i] + 1) / P[i];
    ret += upper_bound(begin(M),end(M), q) - begin(M);
  }
  return ret >= K;
}

bool positive(ll T) {
  ll ret{};
  for (int i = 0; i != (int)P.size(); ++i) {
    ll q = T / P[i];
    ll r = upper_bound(begin(P), end(P), q) - begin(P);
    ret += r - (i < r);
  }
  for (int i = 0; i != (int)M.size(); ++i) {
    ll q = T / M[i];
    ll r = upper_bound(begin(M), end(M), q) - begin(M);
    ret += r - (i < r);
  }
  return ret / 2 >= K;
}

int main() {
  ll N, A;
  cin >> N >> K;
  while (cin >> A) {
    if (A > 0) P.push_back(A);
    else if (A < 0) M.push_back(A);
    else Z.push_back(A);
  }
  ll m = M.size(), z = Z.size(), p = P.size();
  ll nm = p * m;
  ll nz = z * (p+m) + z * (z-1)/2;
  ll ans{};
  if (K <= nm) {
    sort(rbegin(P), rend(P));
    sort(begin(M), end(M));
    ll low = -1e18-1, high = 0;
    while (high - low > 1) {
      ll mid = (low + high) / 2;
      if (negative(mid)) {
        high = mid;
      } else {
        low = mid;
      }
    }
    ans = high;
  } else if (K <= nm + nz) {
    ans = 0;
  } else {
    K -= nm + nz;
    sort(begin(P), end(P));
    for(auto &x: M) x *= -1;
    sort(begin(M), end(M));
    ll low = 0, high = 1e18;
    while (high - low > 1) {
      ll mid = (low + high) / 2;
      if (positive(mid)) {
        high = mid;
      } else {
        low = mid;
      }
    }
    ans = high;
  }
  cout << ans << endl;
}


Measured memory_bytes: 5380
import collections
MOD = 10**9 + 7
n = int(input())
a = list(map(int, input().split()))
c = collections.Counter(a)

ans = 1
for key, value in c.items():
    if key == 0:
        if n % 2 == 1 and value != 1:
            print(0)
            exit()
        else:
            continue
    elif value == 2:
        ans *= 2
        ans %= MOD
    else:
        print(0)
        exit()
print(ans)




Measured memory_bytes: 14820
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<string>
#include<algorithm>
#include<math.h>
using namespace std;

const int N=2e5+5;
const int M=5e5+5;
const int T=1e6+5;
const int mod=924844033;
const int sqr=5;
const int sqrinv=554906420;

int n,u,v,siz[N],limit,lg;
int E,ot[M],ne[M],g[N];
int fac[N],inv[N],infac[N];
int a[T],b[T],r[T];

int F_p(int x,int y)
{
    int bas=x,ret=1;
    while(y)
    {
        if(y&1) ret=1LL*ret*bas%mod;
        bas=1LL*bas*bas%mod;
        y>>=1;
    }
    return ret;
}

void add(int u,int v)
{
    ot[++E]=v;
    ne[E]=g[u];
    g[u]=E;
}

void init()
{
    int i;
    scanf("%d",&n);
    for(i=1;i<n;++i)
    {
        scanf("%d%d",&u,&v);
        add(u,v),add(v,u);
    }
}

void dfs(int x,int fath)
{
    siz[x]=1;
    int p,to;
    for(p=g[x];p;p=ne[p])
    {
        to=ot[p];
        if(to==fath) continue;
        dfs(to,x);
        siz[x]+=siz[to];
        ++a[siz[to]];
    }
    ++a[n-siz[x]];
}

int solve_complex(int x,int tp)
{
    if(~tp) return F_p(sqr,x);
    else return F_p(sqrinv,x);
}

void DFT(int *A,int tp)
{
    int i;
    for(i=0;i<limit;++i)
        if(i<r[i])
            swap(A[i],A[r[i]]);

    int len,j,k;
    for(len=1;len<limit;len<<=1)
    {
        int wn=solve_complex((mod-1)/(2*len),tp);
        for(j=0;j<limit;j+=len<<1)
        {
            int w=1;
            for(k=0;k<len;++k,w=1LL*w*wn%mod)
            {
                int x=A[j+k];
                int y=1LL*w*A[j+k+len]%mod;
                A[j+k]=x+y,A[j+k+len]=x-y;
                if(A[j+k]>=mod) A[j+k]-=mod;
                if(A[j+k+len]<0) A[j+k+len]+=mod;
            }
        }
    }
}

void prework()
{
    int i;dfs(1,0);
    fac[0]=1;for(i=1;i<=n;++i) fac[i]=1LL*fac[i-1]*i%mod;
    inv[1]=1;for(i=2;i<=n;++i) inv[i]=1LL*inv[mod%i]*(mod-mod/i)%mod;
    infac[0]=1;for(i=1;i<=n;++i) infac[i]=1LL*infac[i-1]*inv[i]%mod;
}

void work()
{
    int i;a[0]=0;
    for(i=0;i<=n;++i) a[i]=1LL*a[i]*fac[i]%mod;
    for(i=0;i<=n;++i) b[i]=infac[n-i];

    limit=1;
    while(limit<=2*n) limit<<=1,++lg;
    for(i=1;i<limit;++i) r[i]=(r[i>>1]>>1)|((i&1)<<(lg-1));

    DFT(a,1),DFT(b,1);
    for(i=0;i<limit;++i) a[i]=1LL*a[i]*b[i]%mod;
    DFT(a,-1);

    int INV=F_p(limit,mod-2);
    for(i=1;i<=n;++i) a[i+n]=1LL*a[i+n]*INV%mod*infac[i]%mod;
    for(i=1;i<=n;++i) a[i]=1LL*fac[n]*infac[i]%mod*infac[n-i]%mod*n%mod;
    for(i=1;i<=n;++i)
    {
        a[i]-=a[i+n];
        if(a[i]<0) a[i]+=mod;
    }
    for(i=1;i<=n;++i) printf("%d\n",a[i]);
}

int main()
{
    init();prework();work();
    return 0;
}

Measured memory_bytes: 29312
#include<cstdio>
#include<algorithm>
struct range{
	int l,r;
	friend bool operator <(range a,range b) {return a.r<b.r;}
}a[100005];
int main()
{
	int n,m;scanf("%d%d",&n,&m);
	for(int i=1;i<=m;i++) scanf("%d%d",&a[i].l,&a[i].r),a[i].r--;
	std::sort(a+1,a+m+1);
	int p=a[1].r,ans=1;
	for(int i=2;i<=m;i++)
	if(p<a[i].l) ans++,p=a[i].r;
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 896
#include <algorithm>
#include<iostream>
#include<stdio.h>
#include<vector>
#include<set>
#include<string>
#define rep(i,n) for(int i=0; i<(int)n; i++)//n回繰り返す
using namespace std;
using ll = long long;
using P =pair<int,int>;

int main() {
    long double A,B,C,E,D,F;
    cin>>A>>B;
    C=(100*A)/8;
    D=100*(A+1)/8;
    E=10*B;
    F=10*(B+1);
    if((int)D==D){
        D--;
    }
    if((int)F==F){
        F--;
        
    }
    if(D<E||F<C){
        cout<<-1<<endl;
    }
    else{
        if(C<=E&&E<=D){
            if(E==(int)E){
                cout<<E<<endl;
            }
            else{
                cout<<(int)E+1<<endl;
            }
        }
        else{
            if(C==(int)C){
                cout<<C<<endl;
            }
            else{
                cout<<(int)C+1<<endl;
            }
        }
    }
}
   
    
    
    
    
    
    
    
    

    




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

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

using namespace std;

typedef long long ll;
const ll LLINF = LLONG_MAX;
vector<char> op[3];

class Parsing{
private:
  string parse;
  int pos;
public:
  Parsing(string s){
    parse = s;
    pos = 0;
  }
  ll fact(){
    if(parse[pos] == '('){
      pos++;
      ll p = expression();
      pos++;
      return p;
    }else{
      ll p=0;
      while('0' <= parse[pos] && parse[pos] <= '9'){
        p *= 10LL;
        p += (ll)(parse[pos]-'0');
        pos++;
      }
      return p;
    }
  }

  ll term2(){
    ll p = fact();
    while( 1 ){
      bool found = false;
      rep(i,op[2].size()) if( parse[pos] == op[2][i] ) found = true;
      if( !found ) break;
      if(parse[pos] == '*'){pos++;p *= fact();}
      else if( parse[pos] == '-' ) {pos++;p -= fact();}
      else { pos++; p += fact(); }
    }
    return p;
  }
 
  ll term(){
    ll p = term2();
    while( 1 ){
      bool found = false;
      rep(i,op[1].size()) if( parse[pos] == op[1][i] ) found = true;
      if( !found ) break;
      if(parse[pos] == '*'){pos++;p *= term2();}
      else if( parse[pos] == '-' ) {pos++;p -= term2();}
      else { pos++; p += term2(); }
    }
    return p;
  }
 
  ll expression(){
    ll p = term();
    while( 1 ){
      bool found = false;
      rep(i,op[0].size()) if( parse[pos] == op[0][i] ) found = true;
      if( !found ) break;
      if(parse[pos] == '+'){pos++;p+=term();}
      else if( parse[pos] == '-' ){pos++;p-=term();}
      else { pos++; p*=term();}
    }
    return p;
  } 
 
};

int main(){
  string s;
  cin >> s;
  ll maxi = -LLINF;
  rep(i,3) rep(j,3) rep(k,3) {
    Parsing par(s);
    rep(l,3) op[l].clear();
    op[i].push_back('+');
    op[j].push_back('-');
    op[k].push_back('*');
    maxi = max(maxi,par.expression());
  }
  cout << maxi << endl;
  return 0;
}

Measured memory_bytes: 1240
using System;
using System.Collections.Generic;
using System.Linq;
using BitArray = System.Collections.BitArray;
using BigInteger = System.Numerics.BigInteger;

namespace AtCoderProject
{
    public class Program
    {
        int[][] sk;
        int[] p;
        public object Calc()
        {
            var line = consoleReader.SplitInt();
            var N = line[0];
            var M = line[1];
            sk = consoleReader.RepeatSplitInt(M).ToArray();
            p = consoleReader.SplitInt();

            var count = 0;
            var to = 1 << N;
            for (int i = 0; i < to; i++)
            {
                if (Calc(i))
                    count++;
            }

            return count;
        }
        bool Calc(int i)
        {
            var ba = new BitArray(BitConverter.GetBytes(i));
            for (var x = 0; x < sk.Length; x++)
            {
                var s = sk[x];
                var onCount = 0;
                for (int j = 1; j < s.Length; j++)
                {
                    if (ba[s[j] - 1])
                    {
                        onCount = ~onCount + 2;
                    }
                }
                if (onCount != p[x])
                    return false;
            }
            return true;
        }

        public const int mod = 1000000007;
        #region いつもの
        private readonly ConsoleReader consoleReader;
        public Program() : this(new ConsoleReader()) { }
        public Program(ConsoleReader consoleReader) { this.consoleReader = consoleReader; }
        static void Main() => Console.WriteLine(new Program().Calc()); static string MultiLine<T>(IEnumerable<T> source) => string.Join("\n", source);
        #endregion
    }

    public class ConsoleReader { public virtual string String() => Console.ReadLine(); public int Int() => int.Parse(String()); public long Long() => long.Parse(String()); public ulong ULong() => ulong.Parse(String()); public double Double() => double.Parse(String()); public string[] Split() => String().Split().ToArray(); public int[] SplitInt() => String().Split().Select(int.Parse).ToArray(); public long[] SplitLong() => String().Split().Select(long.Parse).ToArray(); public ulong[] SplitULong() => String().Split().Select(ulong.Parse).ToArray(); public double[] SplitDouble() => String().Split().Select(double.Parse).ToArray(); public IEnumerable<string> Repeat(int count) { for (int i = 0; i < count; i++) yield return String(); } public IEnumerable<int> RepeatInt(int count) { for (int i = 0; i < count; i++) yield return Int(); } public IEnumerable<long> RepeatLong(int count) { for (int i = 0; i < count; i++) yield return Long(); } public IEnumerable<string[]> RepeatSplit(int count) { for (int i = 0; i < count; i++) yield return Split(); } public IEnumerable<int[]> RepeatSplitInt(int count) { for (int i = 0; i < count; i++) yield return SplitInt(); } }
}

Measured memory_bytes: 13396
import java.util.*;

public class Main{
	Scanner sc = new Scanner(System.in);
	int [][] freq;
	
	private void doit(){
		freq = new int[4][2];
		while(sc.hasNext()){
			solve();
		}
		for(int i = 0; i < 4; i++){
			System.out.println(freq[i][0] + " " + freq[i][1]);
		}
	}

	private void solve() {
		double a = sc.nextDouble();
		double b = sc.nextDouble();
		int res = judge(a);
		freq[res][0]++;
		res = judge(b);
		freq[res][1]++;
	}

	private int judge(double a) {
		if(a >= 1.1){
			return 0;
		}
		else if(a >= 0.6){
			return 1;
		}
		else if(a >= 0.2){
			return 2;
		}
		return 3;
	}

	private void debug(Object... o) { System.out.println("debug = " + Arrays.deepToString(o)); }

	public static void main(String[] args) {
		new Main().doit();
	}
}

Measured memory_bytes: 20356
#include <bits/stdc++.h>
#define fi first
#define se second
#define pii pair<int,int>
#define mp make_pair
#define pb push_back
#define space putchar(' ')
#define enter putchar('\n')
#define eps 1e-10
#define MAXN 2005
#define ba 47
//#define ivorysi
using namespace std;
typedef long long int64;
typedef unsigned int u32;
typedef double db;
template<class T>
void read(T &res) {
    res = 0;T f = 1;char c = getchar();
    while(c < '0' || c > '9') {
	if(c == '-') f = -1;
	c = getchar();
    }
    while(c >= '0' && c <= '9') {
	res = res * 10 +c - '0';
	c = getchar();
    }
    res *= f;
}
template<class T>
void out(T x) {
    if(x < 0) {x = -x;putchar('-');}
    if(x >= 10) {
	out(x / 10);
    }
    putchar('0' + x % 10);
}
int S,T,Ncnt,N;
int a[2][MAXN],ty[4];
struct node {
    int to,next,cap;int64 val;
}E[MAXN * 100];
int head[MAXN * 2],sumE = 1;
int rx[MAXN],ry[MAXN],rc[MAXN];
int bx[MAXN],by[MAXN],bc[MAXN];
int dx[4] = {1,1,-1,-1};
int dy[4] = {1,-1,1,-1};

void add(int u,int v,int c,int64 a) {
    E[++sumE].to = v;
    E[sumE].next = head[u];
    E[sumE].cap = c;
    E[sumE].val = a;
    head[u] = sumE;
}
void addtwo(int u,int v,int c,int64 a) {
    add(u,v,c,a);
    add(v,u,0,-a);
}
int64 dis[MAXN];bool inq[MAXN];
int preE[MAXN];
queue<int> Q;
int64 SPFA() {
    for(int i = 1 ; i <= Ncnt ; ++i) dis[i] = -1e18;
    memset(inq,0,sizeof(inq));
    dis[S] = 0;inq[S] = 1;Q.push(S);
    while(!Q.empty()) {
	int u = Q.front();Q.pop();inq[u] = 0;
	for(int i = head[u] ; i ; i = E[i].next) {
	    int v = E[i].to;
	    if(E[i].cap) {
		if(dis[v] < dis[u] + E[i].val) {
		    dis[v] = dis[u] + E[i].val;
		    preE[v] = i;
		    if(!inq[v]) {Q.push(v);inq[v] = 1;}
		}
	    }
	}
    }
    return dis[T];
}
void Init() {
    read(N);
    S = ++Ncnt;
    for(int i = 0 ; i < 2 ; ++i) {
	for(int j = 1 ; j <= N ; ++j) {
	    a[i][j] = ++Ncnt;
	}
    }
    for(int i = 0 ; i < 4 ; ++i) ty[i] = ++Ncnt;
    T = ++Ncnt;
    for(int i = 1 ; i <= N ; ++i) {read(rx[i]);read(ry[i]);read(rc[i]);}
    for(int i = 1 ; i <= N ; ++i) {read(bx[i]);read(by[i]);read(bc[i]);}
    for(int i = 1 ; i <= N ; ++i) {
	addtwo(S,a[0][i],rc[i],0);
	for(int j = 0 ; j < 4 ; ++j) {
	    addtwo(a[0][i],ty[j],1e9,dx[j] * rx[i] + dy[j] * ry[i]);
	}
    }
    for(int i = 1 ; i <= N ; ++i) {
	addtwo(a[1][i],T,bc[i],0);
	for(int j = 0 ; j < 4 ; ++j) {
	    addtwo(ty[j],a[1][i],1e9,-dx[j] * bx[i] - dy[j] * by[i]);
	}
    }
}
void Solve() {
    int64 ans = 0;
    while(SPFA() > 0) {
	int p = preE[T],f = 1e9;
	while(p) {
	    f = min(f,E[p].cap);
	    p = preE[E[p ^ 1].to];
	}
	ans += dis[T] * f;
	p = preE[T];
	while(p) {
	    E[p].cap -= f;E[p ^ 1].cap += f;
	    p = preE[E[p ^ 1].to];
	}
    }
    out(ans);enter;
}
int main() {
#ifdef ivorysi
    freopen("f1.in","r",stdin);
#endif
    Init();
    Solve();
}



Measured memory_bytes: 768
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cstring>
#include <string>
#include <cmath>
#include <map>
#include <set>
#include <queue>
#include <vector>
#define mem(a) memset(a, 0, sizeof(a))
using namespace std;
typedef pair<int, int> Pii;
typedef long long LL;
const int MAXN = 1005;
const int inf = 0x3f3f3f3f;
const int Mod = 100000000;
inline int read()
{
    int f=1, x=0;
    char ch = getchar();
    while(ch<'0'||ch>'9')
    {
        if(ch=='-') f=-1;
        ch=getchar();
    }
    while(ch>='0'&&ch<='9')
    {
        x=x*10+ch-'0';
        ch=getchar();
    }
    return f*x;
}

int main()
{
   int x, y;
    while(~scanf("%d %d", &x, &y))
    {
        if((x==4||x==6||x==9||x==11)&&(y==4||y==6||y==9||y==11))
        {
            printf("Yes\n");
            continue;
        }
        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))
        {
            printf("Yes\n");
            continue;
        }
        printf("No\n");
    }
    return 0;
}


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

string s;

bool dfs(size_t i) {
  if (i == s.length()) return true;

  bool ret = false;
  if (s.find("dream", i) == i) ret |= dfs(i + 5);
  if (s.find("dreamer", i) == i) ret |= dfs(i + 7);
  if (s.find("erase", i) == i) ret |= dfs(i + 5);
  if (s.find("eraser", i) == i) ret |= dfs(i + 6);
  return ret;
}

int main() {
  cin >> s;

  bool ans = dfs(0);
  if (ans) {
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }
}


Measured memory_bytes: 4256
#include<iostream>
using namespace std;
int num[100];
int main()
{
	num[0] = 1;
	for (int i = 1; i < 100; ++i)
		num[i] = num[i - 1] * 2;
	int n; 
	scanf("%d", &n);
	int i;
	for ( i = 0; i < 100;++i)
	if (num[i]>n)break;
	printf("%d\n", num[i - 1]);
}

Measured memory_bytes: 256
n=int(input())

def make_divisors(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]


can=make_divisors(n)

ans=10**9

for g in can:
    
    ans=min(ans,max(len(str(g)),len(str(n//g))))


print(ans)

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

vector<vector<long long>> comb(int n, int r) {
  vector<vector<long long>> v(n + 1,vector<long long>(n + 1, 0));
  for (int i = 0; i < v.size(); i++) {
    v[i][0] = 1;
    v[i][i] = 1;
  }
  for (int j = 1; j < v.size(); j++) {
    for (int k = 1; k < j; k++) {
      v[j][k] = (v[j - 1][k - 1] + v[j - 1][k]);
    }
  }
  return v;
}

int main() {
    int n,p;
    cin >> n >> p;
    int a=0,b=0;
    for(int i = 0; i < n; i++) {
        int x;
        cin >> x;
        if(x%2==0) a++;
        else b++;
    }

    ll s=1;
    for(int i = 0; i < a; i++) s *= 2;

    ll t=0;
    for(int i = p; i <= b; i+=2) {
        vector<vector<ll>> e=comb(b,i);
        ll w=e.at(b).at(i);
        t += w;
    }

    cout << s*t << endl;

    return 0;
}

Measured memory_bytes: 3608