akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;

int main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int INF = 1000000000;
  int h, w;
  cin >> h >> w;
  vector<string> g(h);
  rep(i,h) cin >> g[i];
  int ans = 0;
rep(sy, h)rep(sx, w){
  if(g[sy][sx] == '#') continue;
  vvi dp(h, vi(w, INF));
  queue<pair<int,int>> q;
  q.push({sy, sx});
  vi v = {1, 0, -1, 0, 1};
  dp[sy][sx] = 0;
  while(!q.empty()){
    int y = q.front().first;
    int x = q.front().second;
    q.pop();
    rep(i,4){
      int ny = y + v[i];
      int nx = x + v[i+1];
      if(ny >= h || nx >= w || ny < 0 || nx < 0) continue;
      if(g[ny][nx] == '#') continue;
      if(dp[ny][nx] > dp[y][x] + 1){
        dp[ny][nx] = dp[y][x] + 1;
        q.push({ny, nx});
      }
    }
  }
  rep(i,h) rep(j,w) {
    if(dp[i][j] == INF) continue;
    ans = max(ans, dp[i][j]);
  }
}
  
  cout << ans << endl;
}

Measured memory_bytes: 3588
// Problem : E - ∙ (Bullet)
// Contest : AtCoder - AtCoder Beginner Contest 168
// URL : https://atcoder.jp/contests/abc168/tasks/abc168_e
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

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

#ifdef LOCAL
#define DEBUG(...) debug(#__VA_ARGS__, __VA_ARGS__);
#else
#define DEBUG(...)
#endif

template<typename T, typename S> ostream& operator << (ostream &os, const pair<T, S> &p) {return os << "(" << p.first << ", " << p.second << ")";}
template<typename C, typename T = decay<decltype(*begin(declval<C>()))>, typename enable_if<!is_same<C, string>::value>::type* = nullptr>
ostream& operator << (ostream &os, const C &c) {bool f = true; os << "["; for (const auto &x : c) {if (!f) os << ", "; f = false; os << x;} return os << "]";}
template<typename T> void debug(string s, T x) {cerr << s << " = " << x << "\n";}
template<typename T, typename... Args> void debug(string s, T x, Args... args) {cerr << s.substr(0, s.find(',')) << " = " << x << " | "; debug(s.substr(s.find(',') + 2), args...);}

const int MOD = 1e9 + 7;

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

void sub(int &a, int b) {
    a -= b;
    if (a < 0)
        a += MOD;
}

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

int power[200001];

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    
    int n;
    cin >> n;
    
    power[0] = 1;
    for (int i=0; i<n; i++)
        power[i+1] = mul(power[i], 2);
    
    int cntA = 0, cntB = 0, cntBoth = 0;
    map<pair<long long, long long>, int> mp1, mp2;
    for (int i=0; i<n; i++) {
        long long a, b;
        cin >> a >> b;
        
        if (a == 0 && b == 0) {
            cntBoth++;
        } else if (a == 0) {
            cntA++;
        } else if (b == 0) {
            cntB++;
        } else {
            long long d = __gcd(a, b);
            a /= d;
            b /= d;
            
            if (b < 0) {
                a = -a;
                b = -b;
            }
            if (a > 0)
                mp1[{a, b}]++;
            else
                mp2[{a, b}]++;
        }
    }
    
    int ret = power[cntA];
    add(ret, power[cntB]);
    sub(ret, 1);
    for (auto p : mp1) {
        long long a = p.first.first, b = p.first.second;        
        int product = power[p.second];
        add(product, power[mp2[{-b, a}]]);
        sub(product, 1);
        ret = mul(ret, product);
        mp2.erase({-b, a});
    }
    for (auto p : mp2)
        ret = mul(ret, power[p.second]);
    add(ret, cntBoth);
    sub(ret, 1);
    
    cout << ret << "\n";

    return 0;
}


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

int main()
{
   long long n,i,ans=0;

   cin >> n;

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

   cout<<ans<<endl;
}


Measured memory_bytes: 3592
#include <bits/stdc++.h>
    
using namespace std;
    
#define endl "\n"
#define ll unsigned long long
//#define int long long int
#define vi vector <int >
#define vii vector < pii >
#define vll vector <ll >
#define pii pair <int, int>
#define pdd pair< double, double>
#define piii pair < pii, int > 
#define pll pair<ll, ll >
#define umap unordered_map
#define pb push_back
#define pq priority_queue
#define forn(i, n) for(int i = 0; i < (int)n; i++)
#define rep(i,b,c) for(int i = (int)b; i < (int)c; i++)
#define double long double
#define a first
#define b second

const int N = 100010;
int n;
int dp[3][N];
int arr[3][N];

int f(int pos, int x){
    if(pos == n)
        return 0;
    
    if(dp[x][pos] != -1) return dp[x][pos];

    int ans = -1;
    for(int i = 0; i < 3; i++){
        if(i == x) continue;
        ans = max(ans, arr[i][pos] + f(pos + 1, i));
    }

    return dp[x][pos] = ans;
}


int32_t main(){
    ios::sync_with_stdio(0),cin.tie(0);	
    
    cin >> n;
    memset(dp, -1, sizeof dp);
    forn(i, n){
        cin >> arr[0][i] >>  arr[1][i] >> arr[2][i];
    }

    int ans =  max(f(0, 0), max(f(0, 1), f(0, 2)));
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 10368
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string N;
  cin >> N;
  int x=0;
  for(int i=0; i < N.size(); i++){
   if(N.at(i) == '7' ){
   x += 1;
  }
  }
  if(x != 0){
  cout << "Yes" << endl;
  }
  else{
  cout << "No" << endl;
  }
}

Measured memory_bytes: 3624
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <functional>
#include <cmath>

using namespace std;

template <class It> string join(It i1, It i2)
{
    ostringstream ss;
    for (auto it = i1; it != i2; ++it)
        ss << ((it == i1) ? "" : ", ") << (*it);
    return ss.str();
}

#ifdef DEBUG
#define Dump(x) cerr << #x << " = " << x << endl;
#define Dumps(x) cerr << #x << " : { " << join(x.begin(), x.end()) << " }" << endl;
#else
#define Dump(x)
#define Dumps(x)
#endif

using index_t = int;

int main()
{
    int D, G;
    cin >> D >> G;
    G /= 100;

    vector<int> P(D), C(D);
    for (int i = 0; i < D; ++i)
    {
        cin >> P[i] >> C[i];
        C[i] /= 100;
    }

    auto score = [&](int i, int n) -> int
    {
        return (i + 1) * n + ((n == P[i]) ? C[i] : 0);
    };

    vector<int> SC(D); // score on complete
    for (int i = 0; i < D; ++i)
        SC[i] = score(i, P[i]);
    Dumps(SC);
        
    vector<bool> completed(D, false);
    int n = 0;

    /*
    {
        vector<index_t> I(D);
        for (int i = 0; i < D; ++i) I[i] = i;
        sort(I.begin(), I.end(),
             [&](int i, int j) { return ((double)SC[i] / P[i]) > ((double)SC[j] / P[j]); });
        for (auto i : I)
        {
            if (SC[i] > G) break;

            G -= SC[i];
            n += P[i];
            completed[i] = true;
        }
    }
    */
    
    // スコア g 以上を得る最小の問題数を返す
    function<int(int)> search;
    search = [&](int g) -> int
    {
        if (g == 0) return 0;
        
        vector<int> nums;
        for (int i = 0; i < D; ++i)
        {
            if (completed[i]) continue;

            if (P[i] > 1 && g <= score(i, P[i] - 1))
            {
                int s = score(i, 1);
                nums.push_back((g + s - 1) / s);
            }
            else if (g <= SC[i])
                nums.push_back(P[i]);
            else if (g > SC[i])
            {
                completed[i] = true;
                nums.push_back(P[i] + search(g - SC[i]));
                completed[i] = false;
            }
        }
        return *min_element(nums.begin(), nums.end());
    };

    cout << (n + search(G)) << endl;
}


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


int calcAns(string n) {
     int sum = 0;
     for (auto d : n) {
          int digit = d - '0';
          sum += digit;
     }
     return sum;
}

signed main() {
     srand(time(NULL));
     string n; cin >> n;
     int sum = calcAns(n);
     
     string m = n;
     for (int pos = n.size()-1; pos >= 0; pos--) {
          if (m[pos] == '0') continue;
          
          m[pos]--;
          for (int i = pos+1; i < n.size(); i++) {
               m[i] = '9';
          }
          
          sum = max(sum, calcAns(m));
     }
     
     cout << sum << endl;
     
     return 0;
}


Measured memory_bytes: 256
#include <iostream> 
#include <vector>
#include <string>
#include <math.h>
#include <stack>
#include <fstream>
using namespace std;
#define ll long long int

int main( int argc, char *argv[] ) {
  int n;cin >> n;
  string s;cin >> s;
  int ans = 0;
  for ( int i = 0; i < n; i++ ) {
    int temp = 0;
    for ( int j = 0; j < 26; ++j ) {
      char x = 'a' + j;
      //cout << x << endl;
      bool left = false, right = false;
      for ( int k = 0; k < i; k++ ) {
        if (s[k] == x) left = true;  
      }
      for ( int k = i; k < n; k++ ) {
        if (s[k] == x) right = true;  
      }
      if ( (left == true) && (right == true) )temp++;
    }
    ans = max(ans,temp);
    //cout << "when i is " << i << "," << endl;
    //cout << "ans is " << ans << endl;
    //cout << "temp is " << temp << endl;
  }

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


Measured memory_bytes: 256
#include<iostream>

using namespace std;

void swap(int *v, int *u){
    int temp = *v;
    *v = *u;
    *u = temp;
}

void BubbleSort(int a[], int n, int *count){
    int flag = 1;
    while(flag){
        flag = 0;
        for(int j=n-1;j>=1;j--){
            if(a[j]<a[j-1]){
                swap(&a[j], &a[j-1]);
                flag = 1;
                *count = *count + 1;
            }
        }
    }
}

int main(void){
    int n, count = 0;
    cin >> n;
    int a[n];
    for(int i=0;i<n;i++){
        cin >> a[i];
    }
    BubbleSort(a, n, &count);
    for(int i=0;i<n;i++){
        if(i>0) cout << " ";
        cout << a[i];
    }
    cout << endl;
    cout << count << endl;
    return 0;
}


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

public class Main {
    static IO io = new IO();

    public static void main(String[] args) {

        int n = io.nextInt();
        double ans = 100000;
        for (int i = 0; i < n; i++) ans = Math.ceil((ans + ans * 0.05)/1000)*1000;
        System.out.println((int)ans);

    }

    static class IO extends PrintWriter {
        private final InputStream in;
        private final byte[] buffer = new byte[1024];
        private int ptr = 0;
        private int buflen = 0;

        IO() {
            this(System.in);
        }

        IO(InputStream source) {
            super(System.out);
            this.in = source;
        }

        boolean hasNextByte() {
            if (ptr < buflen) return true;
            else {
                ptr = 0;
                try {
                    buflen = in.read(buffer);
                } catch (IOException e) {
                    e.printStackTrace();
                }
                if (buflen <= 0) return false;
            }
            return true;
        }

        int readByte() {
            if (hasNextByte()) return buffer[ptr++];
            else return -1;
        }

        boolean isPrintableChar(int c) {
            return 33 <= c && c <= 126;
        }

        void skipUnprintable() {
            while (hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;
        }

        boolean hasNext() {
            skipUnprintable();
            return hasNextByte();
        }

        long nextLong() {
            if (!hasNext()) throw new NoSuchElementException();
            long n = 0;
            boolean minus = false;
            int b = readByte();
            if (b == '-') {
                minus = true;
                b = readByte();
            }
            if (b < '0' || '9' < b) throw new NumberFormatException();
            while (true) {
                if ('0' <= b && b <= '9') {
                    n *= 10;
                    n += b - '0';
                } else if (b == -1 || !isPrintableChar(b)) return minus ? -n : n;
                else throw new NumberFormatException();
                b = readByte();
            }
        }

        int nextInt() {
            long nl = nextLong();
            if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
            return (int) nl;
        }

        public void close() {
            super.close();
            try {
                in.close();
            } catch (IOException ignored) {
            }
        }
    }
}

Measured memory_bytes: 23840
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
const int INF = 1000000000;
#define REP(i,s,n) for(int i=(int)(s);i<(int)(n);i++)
#define rep(i,n) REP(i, 0, n)
int x[100001], y[100001];
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, W, H, x_, y_, w_;
    cin >> N >> W >> H;
    memset(x, 0, sizeof(x));
    memset(y, 0, sizeof(y));
    rep(i, N){
        cin >> x_ >> y_ >> w_;
        x[max(0, x_ - w_)]++;
        x[min(W, x_ + w_)]--;
        y[max(0, y_ - w_)]++;
        y[min(H, y_ + w_)]--;
    }
    bool xc = false, yc = false;
    rep(i, W){
        if(i) x[i] += x[i - 1];
        if(x[i] <= 0){
            xc = true;
            break;
        }
    }
    rep(i, H){
        if(i) y[i] += y[i - 1];
        if(y[i] <= 0){
            yc = true;
            break;
        }
    }
    if(xc && yc) cout << "No"; else cout << "Yes";
    cout << endl;
    return 0;
}

Measured memory_bytes: 1984
#include <iostream>
#include <cstdio>
using namespace std;
int main(void){
    int a,b;
    cin >> a >> b;
    if(a > b){
        cout << "a > b" << endl;
    }
    else if(a < b){
        cout << "a < b" << endl;
    }
    else{
        cout << "a == b" << endl;
    }
}


Measured memory_bytes: 3068
/*CODE BY VIJAY MUKHIJA*/
#include<bits/stdc++.h>
#define lli long long int
#define ld long double
#define fi first
#define se second
#define pb push_back
#define MOD 1000000007
#define SMOD 998244353
#define what_is(x) cout << #x << " is " << x << endl
#define what_are(x,y) cout<< #x <<" is " << x << " "<< #y <<" is " << y <<endl
using namespace std;

lli Powerm(lli a,lli b,lli m){ if(b==0) return 1; if(b==1) return a%m; lli t=Powerm(a,b/2,m); t=(t*t)%m; if(b&1)t=(t*a)%m; return t;}
lli Power(lli a,lli b){ if(b==0) return 1; if(b==1) return a; lli t=Power(a,b/2); t=(t*t); if(b&1)t=(t*a); return t;}
lli Gcd(lli a,lli b) { if(b==0) { return a; } else { return Gcd(b,a%b); } }
lli LeftMostSetBit(lli n){ if (n == 0){return 0; } lli msb = 0; while (n != 0) {n = n / 2; msb++; } return msb; }
lli RightMostSetBit(lli n){ return __builtin_ffsl(n); }
lli LLsqrt(lli x){ if(x==0 || x==1) return x; lli start=1, end=x/2, ans; while(start<=end) { lli mid=(start+end)/2; if(mid*mid==x) return mid;
else if(mid <= x/mid) ans=mid,start=mid+1; else end=mid-1; }  return ans; }
void input()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
}

int main()
{
    input();
    string s,t;
    cin>>s>>t;
    lli ans=0;
    for(int i=0;i<s.length();i++){
        if(s[i]!=t[i]){
            ans++;
        }
    }
    cout<<ans<<endl;

    
}

Measured memory_bytes: 3796
#include<bits/stdc++.h>
#define rep(i,a) for(int i=0;i<(int)(a);i++)
#define all(a) (a).begin(),(a).end()
#define pb push_back
#define sz size()
using namespace std;
typedef vector<int> vi;

const int INF = 1e9;

struct edge{
  int from,to,cost,cap,rev;
  edge(int a,int b,int c,int d,int e)
    :from(a),to(b),cost(c),cap(d),rev(e){}
};

struct FordFulkerson{
  int n;
  vector< vector<edge> > graph;
  vi use;

  FordFulkerson(int a=0):n(a){
    graph.resize(a); use.resize(a);
  }

  void init_use(void){fill(all(use),0);}

  void AddEdge(int s,int g,int c,int p){
    graph[s].pb( edge(s,g,c,p,graph[g].sz) );
    graph[g].pb( edge(g,s,-c,0,graph[s].sz-1) );
  }

  void DeleteEdge(int s, int g){
    int id = -1, rev = -1;
    rep(e,graph[s].sz){
      if(graph[s][e].to == g && graph[s][e].cost>0){
	id = e; rev = graph[s][e].rev; break;
      }
    }
    if(id<0)return;

    swap(graph[s][id],graph[s].back());
    swap(graph[g][rev],graph[g].back());

    edge e = graph[s][id];
    if(id+1!=(int)graph[s].size())graph[e.to][e.rev].rev = id;
    e = graph[g][rev];
    if(rev+1!=(int)graph[g].size())graph[e.to][e.rev].rev = rev;
    graph[s].pop_back(); graph[g].pop_back();
  }
  
  int dfs(int v, int t, int f){
    if(v==t)return f;
    use[v] = 1;
    rep(i,graph[v].sz){
      edge &e = graph[v][i];
      if(!use[e.to] && e.cap > 0){
	int d = dfs(e.to,t,min(f,e.cap));
	if(d > 0){
	  e.cap -= d;
	  graph[e.to][e.rev].cap += d;
	  return d;
	}
      }
    }
    return 0;
  }
  
  int max_flow(int s, int t){
    int res = 0;
    for(;;){
      init_use();
      int f = dfs(s,t,INF);
      if(!f)return res;
      res += f;
    }
  }
};

int main(){
  cin.tie(0); ios::sync_with_stdio(0);
  int n,E,q;
  cin >> n >> E >> q;
  FordFulkerson mf(n);
  rep(i,E){
    int f,t;
    cin >> f >> t; f--; t--;
    mf.AddEdge(f,t,1,1);
    mf.AddEdge(t,f,1,1);
  }

  int F = mf.max_flow(0,n-1);
  rep(i,q){
    int m,a,b;
    cin >> m >> a >> b; a--; b--;
    if(m==1){
      mf.AddEdge(a,b,1,1);
      mf.AddEdge(b,a,1,1);
      F += mf.max_flow(0,n-1);
    }else{
      int use = 0;
      for(edge e : mf.graph[a]){
	if(e.to == b && e.cost>0 && e.cap == 0){
	  use |= 1; break;
	}
      }
      for(edge e : mf.graph[b]){
	if(e.to == a && e.cost>0 && e.cap == 0){
	  use |= 2; break;
	}
      }
      mf.DeleteEdge(a,b);
      mf.DeleteEdge(b,a);

      if(use==1 || use==2){
	rep(i,n)mf.use[i] = 0;
	int another = 0;
	if(use==1)another = mf.dfs(a,b,1);
	if(use==2)another = mf.dfs(b,a,1);

	if(!another){
	  mf.init_use();
	  mf.dfs(use==1?a:b,0,1);
	  mf.init_use();
	  mf.dfs(n-1,use==1?b:a,1);
	  F--;
	}
      }
    }

    cout << F << endl;
  }
}

Measured memory_bytes: 3400
import Data.Maybe
import qualified Data.ByteString.Char8 as C8

main :: IO ()
main = do
  [h, w] <- readInts
  [a, b] <- readInts
  print $ (h - a) * (w - b)

readInts :: IO [Int]
readInts = map (fst . fromJust . C8.readInt) . C8.words <$> C8.getLine

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

int main(){
  int a,b,c;
  cin>>a>>b>>c;
  bool flag=false;
  if(a==7 and b==5 and c==5) flag=true;
  if(a==5 and b==7 and c==5) flag=true;
  if(a==5 and b==5 and c==7) flag=true;
  if(flag) cout<<"YES"<<endl;
  else cout<<"NO"<<endl;
  return 0;
}

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

const int mod = 1000000007;
//const int mod = 998244353;

struct mint {
  ll x;
  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 { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= 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 { return mint(*this) /= a;}
};
istream& operator>>(istream& is, mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}


int main()
{
    int n;
    cin >> n;
    vector<int> a(3*n);
    rep(i, 0, 3*n) cin >> a[i];
    sort(a.rbegin(), a.rend());
    ll ans = 0;
    rep(i, 0, n){
        ans += a[i*2 + 1];
    }
    cout << ans << endl;
    return 0;
}


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

using namespace std;

#define debug(n) cerr << #n << ':' << n << endl;
#define dline    cerr << __LINE__ << endl;

using ll = long long;
using ull = unsigned long long;
template<class T, class U> using P = pair<T,U>;
template<class T> using Heap = priority_queue<T>;
template<class T> using heaP = priority_queue<T,vector<T>,greater<T>>;
template<class T,class U> using umap = unordered_map<T,U>;
template<class T> using uset = unordered_set<T>;

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

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

template<class T, size_t N, class U>
void Fill(T (&a)[N], const U&v){
    fill((U*)a,(U*)(a+N),v);
}

template<class T>
istream& operator >> (istream&is, vector<T>&v){
  for(auto&e:v)is >> e;
  return is;
}

int main(){
  ll x,y; cin >> x >> y;
  int cnt = 0;
  while(x <= y){
    x *= 2;
    cnt++;
  }
  cout << cnt << endl;
}



Measured memory_bytes: 3628
#![allow(non_snake_case)]

use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let S: String = read();
    let T: String = read();
    let mut S = S.chars();
    let mut T = T.chars();
    let mut count = 0;
    for _ in 0..3 {
        if S.next() == T.next() {
            count += 1;
        }
    }
    println!("{}", count);
}


Measured memory_bytes: 4352
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <set>
#include <string>
#include <vector>
using namespace std;

int main()
{
  cin.tie(0);
  int a, b;
  cin >> a >> b;
  int x = 0;

  if (a >= b) {
    x += a;
    a--;
  } else {
    x += b;
    b--;
  }

  if (a >= b) {
    x += a;
    a--;
  } else {
    x += b;
    b--;
  }

  cout << x << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;
 
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        
        int x = sc.nextInt();
        int y = sc.nextInt();
        
        int xGroup;
        if(x==1 || x==3 || x==5 || x==7 || x==8 || x==10 || x==12){
            xGroup = 1;
        }else if(x ==4 || x==6 || x==9 || x==11){
            xGroup = 2;
        }else{
            xGroup = 3;
        }
        int yGroup;
        if(y==1 || y==3 || y==5 || y==7 || y==8 || y==10 || y==12){
            yGroup = 1;
        }else if(y ==4 || y==6 || y==9 || y==11){
            yGroup = 2;
        }else{
            yGroup = 3;
        }
        if(xGroup == yGroup){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }       
}

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


int main(){
    long double a, b, c;
    cin >> a >> b >> c;
    if(c - a - b > 2*sqrtl(a*b)){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    int b = sc.nextInt();
    int c = sc.nextInt();
    int d = sc.nextInt();
    if((Math.abs(a - c) <= d) || (Math.abs(a - b) <= d && Math.abs(b - c) <= d)){
      System.out.println("Yes");
    }else{
      System.out.println("No");
    }
  }
}

Measured memory_bytes: 23124
#include <bits/stdc++.h>
#define int long long
#define len(x) x.size()
#define rep(i,a) for(int i=0;i<a;i++)
#define f(i,a,b) for(int i=a;i<=b;i++)
using namespace std;

signed main(){
    
	int n,x;
	scanf("%lld",&n);
	unordered_map<int,int> m;
	rep(i,n) {
		cin>>x;
		m[x]++;
		if(m[x]>1) {
			printf("NO\n");
			return 0;
		}
	}
	printf("YES\n");
	return 0;
}


Measured memory_bytes: 8520
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
  ll x,y,a,b,c,i;scanf("%lld%lld%lld%lld%lld",&x,&y,&a,&b,&c);
  ll p[a],q[b],r[c],t[x+y];
  for(i=0;i<a;i++) scanf("%lld",&p[i]);
  for(i=0;i<b;i++) scanf("%lld",&q[i]);
  for(i=0;i<c;i++) scanf("%lld",&r[i]);
  sort(p,p+a,greater<ll>());sort(q,q+b,greater<ll>());sort(r,r+c,greater<ll>());
  for(i=0;i<x;i++) t[i] = p[i];
  for(i=0;i<y;i++) t[x+i] = q[i];
  sort(t,t+x+y);
  for(i=0;i<min(c,x+y);i++){
    if(r[i]>t[i]) t[i] = r[i];
    else break;
  }
  ll ans = 0;
  for(i=0;i<x+y;i++) ans += t[i];
  printf("%lld\n",ans);
}

Measured memory_bytes: 3968
package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strconv"
)

//Util
func nextStr() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func maxInt(a, b int) int {
	if a > b {
		return a
	} else {
		return b
	}
}

func minInt(a, b int) int {
	if a > b {
		return b
	} else {
		return a
	}
}

func absInt(a int) int {
	if a >= 0 {
		return a
	} else {
		return -a
	}
}

func absFloat64(a float64) float64 {
	if a >= 0 {
		return a
	} else {
		return -a
	}
}

func maxFloat64(a, b float64) float64 {
	if a > b {
		return a
	} else {
		return b
	}
}

func minFloat64(a, b float64) float64 {
	if a > b {
		return b
	} else {
		return a
	}
}

func str2Int(s string) int {
	n, _ := strconv.Atoi(s)
	return n
}

func reverse(s string) string {
	runes := []rune(s)
	for i, j := 0, len(runes)-1; i < j; i, j = i+1, j-1 {
		runes[i], runes[j] = runes[j], runes[i]
	}
	return string(runes)
}

func pow(p, q int) int {
	return int(math.Pow(float64(p), float64(q)))
}

func isPrime(x int) bool {
	if x == 1 {
		return false
	}
	if x == 2 {
		return true
	}
	if x%2 == 0 {
		return false
	}

	b := true
	rootx := int(math.Sqrt(float64(x)))
	i := 3
	for i <= rootx {
		if x%i == 0 {
			b = false
			break
		}
		i += 2
	}
	return b
}

//Main
const (
	initialBufSize = 10000
	maxBufSize     = 1000000
	mod            = 1e9 + 7
)

var (
	sc *bufio.Scanner = func() *bufio.Scanner {
		sc := bufio.NewScanner(os.Stdin)
		buf := make([]byte, initialBufSize)
		sc.Buffer(buf, maxBufSize)
		return sc
	}()
)

var H, W int

func main() {
	sc.Split(bufio.ScanWords)
	H, W = nextInt(), nextInt()

	if H == 1 || W == 1 {
		fmt.Println(1)
		return
	}
	fmt.Println(W*(H/2) + (H%2)*((W+1)/2))

}


Measured memory_bytes: 640
#include <stdio.h>
#include <string.h>
int main(){
	int i=0, j, out=0;
	char s[30];
	scanf("%s", s);
	for(i=0;i<strlen(s);i++){
		for (j = i+1;j<strlen(s); j++){
			if(s[i]==s[j]){
				out=1;
			}
		}
		
	}
	if(out!=1){
		printf("yes\n");
	}else{
		printf("no\n");
	}
	return 0;
}



Measured memory_bytes: 128
#include <iostream>
#include <math.h>
using namespace std;

typedef long long ll;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define memset(v, h) memset((v), h, sizeof(v))
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

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

int main(){
    ll n;
    cin >> n;
    string n1, n2;
    cin >> n1 >> n2;

    string l;

    rep(i,n){
        l += n1[i];
        l += n2[i];
    }


    cout << l << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main() {
    int N, T, rota_barata = -1;
    int custo, tempo;
    int c_barato = 1e5;

    cin >> N >> T;

    for(int i = 0; i < N; i++) {
        cin >> custo >> tempo;

        if(custo < c_barato) {
            if(tempo <= T) {
                rota_barata = i + 1;
                c_barato = custo;
            }
        }
    }

    if(rota_barata != -1) {
        cout << c_barato << endl;
    }

    else {
        cout << "TLE" << endl;
    }

    return 0;
}

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

using namespace std;

const int nax = 1e5 + 13;

vector<int>g[nax];

int dp[nax], deg[nax];

void dfs(int s){

    int i, a = g[s].size();

    for(i = 0; i < a; i++){

        int b = g[s][i];

        dp[b] = max(dp[b], dp[s] + 1);

        deg[b]--;

        if(deg[b] == 0){

            dfs(b);
        }
    }
}

int main(){

    int n, m, i;

    cin >> n >> m;

    dp[0] = 0;

    deg[0] = 0;

    for(i = 1; i <= n; i++){

        g[0].push_back(i);

        dp[i] = 0;

        deg[i] = 1;
    }
    for(i = 0; i < m; i++){

        int u, v;

        cin >> u >> v;

        g[u].push_back(v);

        deg[v]++;
    }
    dfs(0);

    int ans = 0;

    for(i = 1; i <= n; i++){

        ans = max(ans, dp[i]);
    }
    ans--;

    cout << ans;

    return 0;
}

Measured memory_bytes: 8312
#include<iostream>
#include<vector>
#include<set>
#include<algorithm>
#include<map>
#include <bits/stdc++.h>
typedef long long ll;
#define N 100010
using namespace std;
int a[N];
void solve()
{
	ll a,b;
	cin>>a;
	string s;
	cin>>s;
	b=(s[0]-'0')*100+(s[2]-'0')*10+s[3]-'0';
	//cout<<"b:"<<b<<endl;
	cout<<((a*b)/100);	
}

int main() 
{
	ios::sync_with_stdio(false);
	cin.tie(0);cout.tie(0);
//	int t;
//	cin>>t;
//	while (t--) 
	solve();
	return 0;
}

Measured memory_bytes: 3656
<?php

// 入力
fscanf(STDIN, "%d", $a);
fscanf(STDIN, "%d", $b);
fscanf(STDIN, "%d", $c);
fscanf(STDIN, "%d", $d);
fscanf(STDIN, "%d", $e);
fscanf(STDIN, "%d", $k);

// ソート
$cities = [$a, $b, $c, $d, $e];
asort($cities);
if (($cities[4] - $cities[0]) > $k) {
    // 出力
    echo ":(\n";
} else {
    // 出力
    echo "Yay!\n";
}


Measured memory_bytes: 4728
#include<bits/stdc++.h>
using namespace std;
int main(){
    int x,n;
    cin>>x>>n;
    vector<int> v;
    vector<int> diff;
    for(int i=0;i<n;i++){
        int k;
        cin>>k;
        v.push_back(k);
        diff.push_back(abs(x-k));
    }
    sort(diff.begin(),diff.end());
    for(int i=0;;i++){
        if(find(diff.begin(),diff.end(),i)==diff.end()){
            cout<<x-i<<endl;
            break;
        }else{
            if(find(v.begin(),v.end(),x-i)==v.end()){
                cout<<x-i<<endl;
                break;
            }
            if(find(v.begin(),v.end(),x+i)==v.end()){
                cout<<x+i<<endl;
                break;
            }
        
        }

    }
}

Measured memory_bytes: 3612
/*
	Name: 
	Copyright: gwj's
	Author: GaryMr
	Date: 02/06/19 19:34
	Description: 
*/

/*######################################################################
	是否可以简化问题：
	二分答案!
	抓住数据范围哪里小
	dfs or bfs
	是否可以化具体为抽象
	字符串问题是否可以用数学模拟递归过程（取c[i]或不取来算结果）
	二分？左闭右开？
	long long？
	逆向思维？
	dp？
	贪心？
	树的直径:随便找一点再走到它最远的点A，再从A最远的点走到最远B的点。AB就是树的直径
	匹配括号 左减右>=0
	字符串赋值字符加单引号
	double> printf("%lf")输出小数点6位，%.16lf输出后十六位
	多组数据清空？
	dp优化用g？
	线段树：大小为n的8倍
	线段树：左闭右开！
	线段树：find： if(l>=b||r<=a) return 0x3f3f3f3f; if(r<=b&&l>=a) return tree[k];
	线段树：满二叉树 
	循环跳出条件 
	代数设出每个值寻找关系？
	优先队列：priority_queue<类型> q;   
	priority_queue<类,vector<类>, less<类> > pq1; 　　　 // 使用递减	
	priority_queue<类，vector<类>, greater<类> > pq2; 　　// 使用递增
	判断括号，判断是否长度为偶数
	1<<int(ceil(log2(double(n))))
	分析样例：奇数or偶数
	偶数
	线段离散化
	make_pair 慢
	坐标离散化
	不同子序列: dp[i]=dp[i-1]*2-dp[last[i]-1]
*/
#include<bits/stdc++.h>
#define rb(a,b,c) for(int a=b;a<=c;a++)
#define rl(a,b,c) for(int a=b;a>=c;a--)
#define niv vector<int>
#define LL long long
#define IT iterator
#define PB(a) push_back(a)
#define II(a,b) make_pair(a,b)
#define FIR first
#define SEC second
using namespace std;
const int INF=0x3f3f3f3f;
typedef pair<int,int> mp;
typedef pair<mp,mp> superpair;
int main(){
	int n,a,b,c,d;
	cin>>n>>a>>b>>c>>d;
	string s;
	cin>>s;
	rb(i,0,n-2){
		if(s[i]=='#'&&s[i+1]=='#'){
			if(a<i&&c>i){
				printf("No");
				return 0;
			}
			if(b<i&&d>i){
				printf("No");
				return 0;
			}
		}
	} 
	if(a<b&&c<d){
		printf("Yes");
		return 0;
	}
	if(a>b&&c>d){
		printf("Yes");
		return 0;
	}
	if(c>d){
		int last=-1;
		rb(i,0,b-1){
			if(s[i]=='#') last=i;
		}
		rb(i,b-1,d-1){
			if(s[i]=='#') last=i;
			else{
				if(i-last>=2&&s[i+1]=='.'){
					printf("Yes");
					return 0;
				}
			}
		}
	}
	else
	{
		int last=-1;
		rb(i,0,a-1){
			if(s[i]=='#') last=i;
		}
		rb(i,a-1,c-1){
			if(s[i]=='#') last=i;
			else{
				if(i-last>=2&&s[i+1]=='.'){
					printf("Yes");
					return 0;
				}
			}
		}
	}
	printf("No");
	return 0;
}

Measured memory_bytes: 640
import java.util.Scanner;

public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.next());//int型
		String sline = sc.next();
		int k = Integer.parseInt(sc.next());
		sc.close();
		String[] s = new String[n];
		for (int i=0; i<n; i++){
			s[i] = String.valueOf(sline.charAt(i));
		}
		String dels = s[k-1];
		for(int i=0; i<n; i++) {
			if (!s[i].equals(dels)) {
				s[i] = "*";
			}
			System.out.print(s[i]);
		}
	}
}


Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
int main(void) {
    long int n, d, count = 0;
    cin>>n>>d;
    long double atmost = d * 1.0;
    while(n--){
        long double x, y;
        cin>>x>>y;
        long double ans = sqrt(pow(x,2) + pow(y,2));
        if(ans <= atmost)
            count++;
    }
    cout<<count<<endl;
    return 0;
}

Measured memory_bytes: 3780
#include<cstdio>
#include<algorithm>
#define ll long long
using namespace std;
int n;
ll ans;
int main()
{
	scanf("%d",&n);
	bool flag=0;
	int X=1<<30;
	for (int i=1;i<=n;i++)
	{
		int x,y;
		scanf("%d%d",&x,&y);
		if (x!=y) flag=1;
		ans+=x;
		if (x>y) X=min(X,y);
	}
	if (X!=1<<30) ans-=X;
	if (!flag) ans=0;
	printf("%lld\n",ans);
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <cstdio>
#include <vector>
#include <map>
#include <queue>
#include <set>
#include <cmath>
#include <iomanip>
using namespace std;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define Rreps(i,n,e) for(int i = n - 1; i >= e; --i)
#define Rrep(i,n) Rreps(i,n,0)
#define ALL(a) a.begin(), a.end()
#define endl "\n"
typedef long long ll;
#define traceV(v) for(auto x:v)cout<<x<<" ";cout<<endl
#define traceM(mp) for(auto x:mp)cout<<x.first<<" "<<x.second<<endl
#define MOD 1000000007

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

  // https://drken1215.hatenablog.com/entry/2020/04/05/150900
  // 解法２
  int K; cin>>K;

  queue<ll> q;
  reps(i,1,10) q.push(i);
  rep(i, K-1) {   // 小さい方からK-1個popするまで
    ll val = q.front();
    q.pop();
    for(int j=-1; j<=1; ++j) {
      int add = val % 10 + j;
      if (add >= 0 && add <= 9) q.push(val * 10 + add);
    }
  }
  cout << q.front() << endl;

  return 0;
}

Measured memory_bytes: 1792
A,B,K = map(int, input().split())

#以下を満たす整数をすべて昇順に出力してください。
#A 以上 B 以下の整数の中で、小さい方から K 番目以内であるか、大きい方から K 番目以内である
ans = []
for i in range(A,min(B+1,A+K)):
  ans.append(i)  
for i in range(max(A,B-K+1),B+1):
  ans.append(i)
  
single_ans = list(set(ans))
single_ans.sort(reverse=False)

for i in range(len(single_ans)):
  print(single_ans[i])

Measured memory_bytes: 3064
/*Author
   SaJiB */

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


#define pb   push_back
#define fi   first
#define se   second
#define all(x)    x.begin(),x.end()

#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))

typedef long long int ll;
typedef unsigned long long int ull;
const double pi = 2.0*acos(0.0);

char small[26] = {'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'} ;

ll big_mod(ll BASE, ll POWER, ll MOD){

    if(POWER == 0) return 1;
    else if(POWER %2 ==0){
        ll RESULT = big_mod(BASE,POWER/2,MOD);
        return ((RESULT % MOD)*(RESULT % MOD))% MOD;
    }
    else return ((BASE % MOD)*(big_mod(BASE,POWER-1,MOD)% MOD))% MOD;

}

int main(){

ll a;
cin>>a;

cout<<(a+a*a+a*a*a)<<endl;

}



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

for i in range(3):
    j = (i+1) % 3
    diff1 = grid[i][0] - grid[j][0]
    diff2 = grid[i][1] - grid[j][1]
    diff3 = grid[i][2] - grid[j][2]

    if diff1 != diff2 or diff2 != diff3 or diff1 != diff3:
        print("No")
        exit()

for i in range(3):
    j = (i+1) % 3
    diff1 = grid[0][i] - grid[0][j]
    diff2 = grid[1][i] - grid[1][j]
    diff3 = grid[2][i] - grid[2][j]

    if diff1 != diff2 or diff2 != diff3 or diff1 != diff3:
        print("No")
        exit()

print("Yes")


Measured memory_bytes: 3064
# -*- coding: utf-8 -*-
w = raw_input()

alphabet = [0]*26
for i in range(len(w)):
    alphabet[ord(w[i])-97] += 1
for i in range(26):
    alphabet[i] = True if alphabet[i]%2 == 0 else False
print ('Yes' if all(alphabet) else 'No')

Measured memory_bytes: 2568
#include<bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define dofloat cout<<fixed<<setprecision(8)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define bitcount __builtin_popcount
#define all(vec) vec.begin(),vec.end()
#define rall(vec) vec.rbegin(),vec.rend()
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<long long> vl;
typedef pair<long long,long long> pll;
typedef vector<pair<long long,long long> > vll;
typedef vector<pair<int,int> > vii;
typedef vector<int> vi;
typedef pair<int,int> ii;
const long long MOD=1000000007;
const long long MAX=100005;
const long double PI=3.14159265359;
const long double G=9.807;
const long long INF=1e18;
const long double EPS=1e-6;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
bool isprime(ll a){
  if(a==2)return 1;
  if(!(a&1))return 0;
  for(ll i=3;i*i<=a;i+=2)
    if(a%i==0)return 0;
  return 1;
}
ll mpow(ll base,ll exponent,ll modulus){
  if(modulus==1)return 0;
  long long result = 1;
  base=base%modulus;
  while(exponent){
    if(exponent%2 == 1)
    result=(result*base)%modulus;
    exponent=exponent>>1;
    base=(base*base)%modulus;
  }
  return result;
}
ll minv(ll a,ll mod){
  ll _gcd=gcd(a,mod);
  assert(_gcd==1);
  return mpow(a,mod-2,mod);
}


/*
ll ncr(ll N,ll K){
  if(N<K)return 0;
  if(K==0)return 1;
  if(N==0)return 0;

  ll den=1;
  for(ll i=1;i<=K;i++)den*=i;
  ll num=1;
  while(K--){
    num*=N;
    if(num%den==0){
      num/=den;
      den=1;
    }
    N--;
  }

  return num;
}
*/
ll n;
string s;
ll pre[27][4005];

int main(){FAST;
cin>>n;
cin>>s;


for(ll i=0;i<26;++i){
  pre[i][0] = (s[0] == 'A'+i); 
  for(ll j=1;j<n;++j){
    pre[i][j] = pre[i][j-1] + (s[j] == 'A'+i);
  }
}

ll ans = 0;
for(ll i=0;i<n;++i){
  for(ll j=i+1;j<n;++j){
    if(s[i] == s[j])continue;
    set<char>f;
    f.insert('R');
    f.insert('G');
    f.insert('B');
    f.erase(s[i]);
    f.erase(s[j]);
    char x = *f.begin();
    ll ways = pre[x-'A'][j]-pre[x-'A'][i];
    if((j+i)%2 == 0){
      if(s[(j+i)/2] == x)ways--;
    }
    ans+=ways;
    // cout<<i<<' '<<j<<' '<<ways<<'\n';
  }
}
cout<<ans;
return 0;
}

/*
 WA? check edge cases, N=1,M=1 etc. Read code fully once and check all variables.
 Read the question again and see what you might have missed.
 Consider changing your solution or find more cases.
 */


Measured memory_bytes: 4432
import math
from functools import reduce
from collections import deque
import sys
sys.setrecursionlimit(10**7)

def s(generator, splitter, mapper):
    return [ mapper(s) for s in generator().split(splitter) ]

# スペース区切りの入力を読み込んで数値リストにして返します。
def get_nums_l():
    return [ int(s) for s in input().split(" ")]

# 改行区切りの入力をn行読み込んで数値リストにして返します。
def get_nums_n(n):
    return [ int(input()) for _ in range(n)]

n,a,b = get_nums_l()

print(min(n*a, b))

Measured memory_bytes: 38384
#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
#include <queue>
#include <cstdio>
#include <iomanip>
using namespace std;
typedef long long ll;

int gcd(int a,int b){
    if(b==0)return a;
    return gcd(b,a%b);
}

int lcm(int a,int b){
    return a*b/gcd(a,b);
}

int main(){
    double a,b,c,d,e,k,l,m,n,o=0,p,q,r,x,y,z,max1=0,ans=0,a1,b1;
    string s,t,u;
    cin>>a>>b>>x;
    if(a*a*b/2<x){
    a1=x/a/a;
    y=2*a1-b;
    b1=b-y;
    ans=b1/a;
    ans=atan(ans);
    cout<<setprecision(10)<<(ans*57.29577951308232)<<endl;
    }
    else if(a*a*b/2==x){
        
    ans=atan(b/a);
    cout<<setprecision(10)<<(ans*57.29577951308232)<<endl;
    }
    else{
     
        c=b*b*a/x/2;
    d=atan(c);
    cout<<setprecision(10)<<d*57.29577951308232<<endl;
    }
    
}






Measured memory_bytes: 256
#include <bits/stdc++.h>
#define MAXN 300005
#define LL long long
using namespace std;

int n, f[MAXN][2];
LL ans[MAXN], a[MAXN];

void solve(int x, int y)
{
	if(f[x][0]==y || f[x][1]==y) return;
	if(a[f[x][1]]<a[y])
	{
		f[x][1]=y;
		if(a[f[x][0]]<a[f[x][1]]) swap(f[x][0], f[x][1]);
	}
}

int main()
{
	scanf("%d", &n);
	for(int i=0; i<(1<<n); i++)
	{
		scanf("%lld", &a[i]);
		f[i][0]=i;
	}
	for(int i=0; i<(1<<n); i++) for(int j=0; j<n; j++)
	{
		if((i>>j)&1) continue;
		solve(i|(1<<j), f[i][0]);
		solve(i|(1<<j), f[i][1]);
	}
	for(int i=1; i<(1<<n); i++)
	{
		ans[i]=max(ans[i-1], a[f[i][0]]+a[f[i][1]]);
		printf("%lld\n", ans[i]);
	}
} 

Measured memory_bytes: 9856
import java.util.*;

public class Main {
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        int n,maxW;
        n = sc.nextInt();
        maxW = sc.nextInt();
        int weights[] = new int[n+1];
        int values[] = new int[n+1];

        for(int i=1;i<=n;i++){
            weights[i] = sc.nextInt();
            values[i] = sc.nextInt();
        }

        long dp[][] = new long[n+2][maxW+1];

        for(int i=n;i>=1;i--){
            for(int j=1;j<=maxW;j++){
                if(j >= weights[i]){
                    dp[i][j] = Math.max(values[i] + dp[i+1][j-weights[i]], dp[i+1][j]);
                }
                else{
                    dp[i][j] = dp[i+1][j];
                }
            }
        }

        System.out.println(dp[1][maxW]);
    }
}

Measured memory_bytes: 126932
import Data.List
import qualified Data.ByteString.Char8 as B
import Debug.Trace 

main :: IO ()
main = breads >>= print . solve 

solve :: [Int] -> Int 
solve [n, k]
    | k == 0 = res - n
    | otherwise = res
    where
        res = foldl' ff 0 [(k + 1)..n]
        ff acc b = acc + m * (b - k) + max 0 (r - k + 1)
            where
                (m, r) = n `divMod` b

breads :: IO [Int]
breads = unfoldr uff <$> B.getLine
    where
        uff b = check <$> B.readInt b
        check (a, b)
            | B.null b = (a, b)
            | otherwise = (a, B.tail b)



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

#define debug(a) cerr << #a << " = " << (a) << endl;
#define fst first
#define snd second
#define sz(x) (int)(x).size()
#define all(X) begin(X), end(X)

typedef long long int ll;
typedef unsigned long long int ull;
typedef pair<int, int> pii;

template<typename T, typename U> ostream& operator<<(ostream& o, const pair<T, U>& x) { 
  o << "(" << x.fst << ", " << x.snd << ")"; return o;
}

template<typename T> ostream& operator<<(ostream& o, const vector<T>& x) {
  o << "["; int b = 0; for (auto& a : x) o << (b++ ? ", " : "") << a; o << "]"; return o;
}

template<typename T> ostream& operator<<(ostream& o, const set<T>& x) {
  o << "{"; int b = 0; for (auto& a : x) o << (b++ ? ", " : "") << a; o << "}"; return o;
}

template<typename T, typename U> ostream& operator<<(ostream& o, const map<T, U>& x) {
  o << "{"; int b = 0; for (auto& a : x) o << (b++ ? ", " : "") << a; o << "}"; return o;
}

int n, k;
int dp[100005];
int A[100005];

//f(i) gives minimum cost to reach stone n starting from stone i
int f(int i) {
  if(i == n) return 0;
  
  int& x = dp[i];
  if(x != -1) return x;
  
  x = abs(A[i] - A[i+1]) + f(i+1);
  for(int j = 2; j <= k; ++j) {
    if(i+j <= n) x = min(x, abs(A[i] - A[i+j]) + f(i+j));
  }
  
  return x;
}

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

  cin >> n >> k;
  for(int i = 1; i <= n; ++i) {
    cin >> A[i];
    dp[i] = -1;
  }

  cout << f(1) << endl;  
}



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

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll n,k,q,a;
	cin>>n>>k>>q;
	vector<ll>v(n);
	for(ll i=0;i<q;i++){
		cin>>a;
		v.at(a-1)++;
	}
	for(ll i=0;i<n;i++){
		if(v.at(i)>q-k){
			cout<<"Yes"<<endl;
		}else{
			cout<<"No"<<endl;
		}
	}
}


Measured memory_bytes: 1408
#define _USE_MAT_DEFINES
#include<iostream>
#include <iomanip>
#include<stdio.h>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include <queue>
#include <utility>
#include <map>
#include <set>
#include <stack>
#include <deque>
#include <numeric>
#include <functional>
using namespace std;

int main() {
    int N;
    cin >> N;
    vector<int>a(N + 1), b(N + 1, 0);
    for (int i = 1; i <= N; i++)cin >> a[i];

    int cnt = 0;
    vector<int>ans;
    for (int i = N; i >= 1; i--) {
        //ballの個数を数える
        int ball = 0;
        int now = 2*i;
        while (now <= N) {
            ball += b[now];
            now += i;
        }
        //偶奇が違ったら追加
        if (ball % 2 != a[i]) {
            b[i] = 1;
            cnt++;
            ans.push_back(i);
        }
    }

    cout << cnt << endl;
    for (int i = 0; i < ans.size(); i++)cout << ans[i] << " ";

}


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

int main(){
  string n;cin >> n;
  if(n[n.length()-1] == '2'|| n[n.length()-1] == '4'|| n[n.length()-1] == '5' || n[n.length()-1] == '7' || n[n.length()-1] == '9'){
    cout << "hon";
  } else if(n[n.length()-1] != '3'){
    cout << "pon";
  } else {
    cout << "bon";
  }
  return 0;
}

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

#define int long long

using namespace std;

const int maxn = 2e5 + 10;
int a[maxn], n, k;
vector<int> pos, neg;

signed main()
{
        cin >> n >> k;

        for (int i = 0; i < n; i++) {
                cin >> a[i];
                a[i] >= 0 ? pos.push_back(a[i]) : neg.push_back(-a[i]);
        }
        sort(pos.begin(), pos.end());
        sort(neg.begin(), neg.end());

        int l = -(1e18) - 1, r = (1e18) + 1;
        while (r - l > 1) {
                int mid = (l + r) / 2;

                int cur = 0;
                if (mid >= 0) {
                        cur = (int)pos.size() * (int)neg.size();
                        for (int i = 0; i < pos.size(); i++)
                                cur += pos[i] ? upper_bound(pos.begin() + i + 1, pos.end(), mid / pos[i])
                                        - (pos.begin() + i + 1)
                                              : pos.size() - i - 1;
                        for (int i = 0; i < neg.size(); i++)
                                cur += upper_bound(neg.begin() + i + 1, neg.end(), mid / neg[i])
                                    - (neg.begin() + i + 1);
                } else {
                        for (int x : pos)
                                cur += x ? neg.end() - lower_bound(neg.begin(), neg.end(), (-mid + x - 1) / x) : 0;
                }

                if (cur >= k)
                        r = mid;
                else
                        l = mid;
        }

        cout << r;

        return 0;
}


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

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef pair<LL, LL> PLL;

#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SORT(c) sort((c).begin(),(c).end())

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

#define FF first
#define SS second
template<class S, class T>
istream& operator>>(istream& is, pair<S,T>& p){
  return is >> p.FF >> p.SS;
}

const double EPS = 1e-10;
const double PI  = acos(-1.0);
const LL MOD = 1e9+7;


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

  int N, M; cin >> N >> M;
  vector<PII> xs(M);
  REP(i,M){
	cin >> xs[i];
  }
  SORT(xs);

  VI l(N+1), r(N+1);
  REP(i,N+1) l[i] = r[i] = i;
	
  REP(i,M){
	int a = xs[i].SS, b = xs[i].SS+1;
	l[a] = l[b] = min(l[a], l[b]);
	r[a] = r[b] = max(r[a], r[b]);
  }

  REP(i,N) cout << (i?" ":"") << (r[i+1]-l[i+1]+1);
  cout << endl;

  return 0;
}

Measured memory_bytes: 5100