akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
using pll = pair<ll, ll>;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define rrep(i, m, n) for(ll i = m; i > n; i--)
#define Rep(i, m, n) for(ll i = m; i < n; i++)
#define all(vec) vec.begin(), vec.end()
#define lmax(x, y) max<ll>(x, y)
#define lmin(x, y) min<ll>(x, y)
#define tmax(x, y, z) lmax((x), lmax((y), (z)))
#define tmin(x, y, z) lmin((x), lmin((y), (z)))
#define MINUS(a) memset(a, 0xff, sizeof(a))
#define ZERO(a) memset(a, 0, sizeof(a))
const ll INF = 1LL << 60;
const ll MM = 1000000000; const ll MOD = MM + 7; const ll MMM=9223372036854775807;//2^63 -1
#define ADD(a,b) a = (a + ll(b)) % MOD
#define MUL(a,b) a = (a * ll(b)) % MOD
ll GCD(ll x, ll y){ if(y == 0) return x; else return GCD(y, x % y);}
ll LCM(ll x, ll y){ return x / GCD(x, y) * y;}
template<class T> inline bool chmin(T& a, T b){ if(a > b){ a = b; return true;} return false;}
template<class T> inline bool chmax(T& a, T b){ if(a < b){ a = b; return true;} return false;}
template<typename A, size_t N, typename T> void FILL(A (&array)[N], const T &val){ fill( (T*)array, (T*)(array+N), val );}
// struct edge{ ll from, to, cost; };
// struct edge{ ll to, cost; };
// using Graph = vector<vector<ll>>;  // 重み無し
// using Graph = vector<edge>;  // 辺
// using Graph = vector<vector<edge>>;  // 重み付き
ll dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
ll ddx[8] = {1, 1, 0, -1, -1, -1, 0, 1}, ddy[8] = {0, 1, 1, 1, 0, -1, -1, -1};
//cout << fixed << setprecision(10);
// priority_queue<ll, vector<ll>, greater<ll>> pq;

int main(){
    string s; cin >> s;
    ll k, f = 1, b = 1, sig = 0, sz = s.size(); cin >> k;
    // 最初の連続数を数える
    rep(i, sz-1){
        if(s[i] == s[i+1]) f++;
        else break;
    }
    // 最後の連続数を数える
    rrep(i, sz-1, -1){
        if(s[i] == s[i-1]) b++;
        else break;
    }
    // s単独の必要置換数を数える
    ll tmp = 1;
    rep(i, sz){
        if(s[i] != s[i+1] || i == sz-1) sig += tmp/2, tmp = 1;
        else tmp++;
    }
    // 最初と最後が別の文字
    if(s[0] != s[sz-1]){
        cout << sig * k << endl;
        return 0;
    }
    // 最後まで連続
    if(f == sz){
        cout << f*k/2 << endl;  // f/2*kではない
        return 0;
    }
    cout << (sig-f/2-b/2)*k + f/2 + b/2 + (f+b)/2*(k-1) << endl;
}


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

int main() {
    int n; cin >> n;
    vector<int64_t> a(n);
    for (auto &e : a) cin >> e;

    vector<int64_t> sum(n);
    sum.back() = a.back();
    for (int i = n - 2; 0 <= i; --i) {
        sum[i] = sum[i + 1] + a[i];
    }

    int64_t ans = 0;
    for (int i = 0; i < n - 1; ++i) {
        ans = (ans + (sum[i + 1] % 1000000007) * (a[i] % 1000000007)) % 1000000007;
    }

    cout << ans << endl;
}



Measured memory_bytes: 6416
#include <bits/stdc++.h>
#include <vector>
#include <iostream>
#include<algorithm>
#include<string>
#include <map>
#include <queue>
#include <stack>
#include<set>

#define DIV 998244353
#define TE 2e5
using namespace std;
using ll = long long;
using ldb = long double;

int main() {
	int N, M, R; cin >> N >> M >> R;
	vector<int> r(R);
	for (int i = 0; i < R; i++)
		cin >> r[i];
	vector<vector<int>> dis(N + 1, vector<int>(N + 1,1e8));
	for (int i = 0; i < M; i++) {
		int a, b, c; cin >> a >> b >> c;
		dis[a][b] = c, dis[b][a] = c;
	}
	for (int k = 1; k <= N; k++) {
		for (int i = 1; i <= N; i++) {
			for (int j = 1; j <= N; j++) {
				dis[i][j] = min(dis[i][j], dis[i][k] + dis[k][j]);
			}
		}
	}
	sort(r.begin(), r.end());
	vector<int> a(R);
	a = r;
	int ans = 1e8;
	do {
		int temp = 0;
		for (int i = 0; i < R-1; i++) {
			temp += dis[r[i]][r[i + 1]];
		}
		ans = min(ans, temp);
		!next_permutation(r.begin(), r.end());
	} while (r!=a);
	cout << ans << endl;
}

Measured memory_bytes: 512
import java.io.InputStreamReader;
import java.io.BufferedReader;
import java.io.IOException;

public class Main {
  public static void main(String args[] ) throws IOException {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    Float f = Float.parseFloat(br.readLine());
    float high = f, low = f;
    String line;
    while( ( line = br.readLine() ) != null ) {
      f = Float.parseFloat(line);
      if ( f > high ) {
        high = f;
      } else if ( f < low) {
        low = f;
      }
    }
    System.out.println( high - low );
  }
}

Measured memory_bytes: 24256
#include <bits/stdc++.h>
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 fi first
#define se second
#define endl "\n"
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;

//const ll MOD = 998244353;
const ll MOD = (1e+9) + 7;
const ll INF = 2e+9 + 10;
typedef pair<ll, ll> P;

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

  int N, x; cin >> N >> x;
  vec a(N); rep(i,N) cin >> a[i];
  sort(ALL(a));

  int res = 0;
  rep(i, N-1) {
    if (x >= a[i]) {res++; x-=a[i];}
    else {cout << res << endl; return 0;}
  }
  if(x == a[N-1]) res++;

  cout << res << endl;

//  //WAの理由がわからない
//  int res = 0, i = 0;
//  while(x >= a[i]) {    // まだあげられる
//    x-=a[i];
//    res++; i++;
//    if(i==N-1 && x!=a[i]) break;   // 最後は，残りがちょうどの時だけ喜ばせられる
//  }
//  cout << res <<endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pii;
typedef pair<double,double> pdd;
#define MEM(a, b) memset(a, (b), sizeof(a))
#define SZ(i) int(i.size())
#define FOR(i, j, k, in) for (int i=j ; i<k ; i+=in)
#define RFOR(i, j, k, in) for (int i=j ; i>=k ; i-=in)
#define REP(i, j) FOR(i, 0, j, 1)
#define REP1(i,j) FOR(i, 1, j+1, 1)
#define RREP(i, j) RFOR(i, j, 0, 1)
#define ALL(_a) _a.begin(),_a.end()
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define X first
#define Y second
#ifdef tmd
#define debug(...) do{\
    fprintf(stderr,"%s - %d (%s) = ",__PRETTY_FUNCTION__,__LINE__,#__VA_ARGS__);\
    _do(__VA_ARGS__);\
}while(0)
template<typename T>void _do(T &&_x){cerr<<_x<<endl;}
template<typename T,typename ...S> void _do(T &&_x,S &&..._t){cerr<<_x<<" ,";_do(_t...);}
template<typename _a,typename _b> ostream& operator << (ostream &_s,const pair<_a,_b> &_p){return _s<<"("<<_p.X<<","<<_p.Y<<")";}
template<typename It> ostream& _OUTC(ostream &_s,It _ita,It _itb)
{
    _s<<"{";
    for(It _it=_ita;_it!=_itb;_it++)
    {
        _s<<(_it==_ita?"":",")<<*_it;
    }
    _s<<"}";
    return _s;
}
template<typename _a> ostream &operator << (ostream &_s,vector<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a> ostream &operator << (ostream &_s,set<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a> ostream &operator << (ostream &_s,deque<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a,typename _b> ostream &operator << (ostream &_s,map<_a,_b> &_c){return _OUTC(_s,ALL(_c));}
template<typename _t> void pary(_t _a,_t _b){_OUTC(cerr,_a,_b);cerr<<endl;}
#define IOS()
#else
#define debug(...)
#define pary(...)
#define endl '\n'
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0)
#endif

const ll MOD = 1000000007;
const ll INF = 0x3f3f3f3f3f3f3f3f;
const int iNF = 0x3f3f3f3f;
// const ll MAXN = 

ll n;
/********** Good Luck :) **********/
int main()
{
    IOS();
    cin >> n;
    cout << n * n * 3 << endl;
    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
char s[100009];
int main() {
	scanf("%s", s);
	int l = -1, r = -1;
	for(int i = 1; s[i]; i++) if(s[i - 1] == s[i]) l = i, r = i + 1;
	for(int i = 2; s[i]; i++) if(s[i - 2] == s[i]) l = i - 1, r = i + 1;
	printf("%d %d\n", l, r);
	return 0;
}

Measured memory_bytes: 256
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author aryssoncf
 */



// Taken from: https://github.com/bqi343/USACO/blob/master/Implementations/content/contest/templateShort.cpp

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ull> vul;
typedef vector<ll> vl;
typedef vector<pii> vpii;

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define F0R(i, a) FOR(i,0,a)
#define ROF(i, a, b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i, a) ROF(i,0,a)
#define trav(a, x) for (auto& a: x)

#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)
#define rsz resize

#define mp make_pair
#define pb push_back
#define f first
#define s second

const int MOD = 1e9 + 7; // 998244353; // = (119<<23)+1
const int MX = 2e5 + 5;

template<class T>
bool ckmin(T &a, const T &b) {
    return a > b ? a = b, 1 : 0;
}

template<class T>
bool ckmax(T &a, const T &b) {
    return a < b ? a = b, 1 : 0;
}

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


//
// Created by aryssoncf on 28/10/2019.
//

#include <type_traits>


#include <iterator>
#include <utility>

template<typename T>
constexpr auto hasBegin(int) -> decltype(std::begin(std::declval<T>()), true) {
    return true;
}

constexpr bool hasBegin(...) {
    return false;
}

template<typename T>
using IsContainer = std::integral_constant<bool, hasBegin<T>(0)>;


#ifndef JHELPER_EXAMPLE_PROJECT_IO_HPP
#define JHELPER_EXAMPLE_PROJECT_IO_HPP

#endif //JHELPER_EXAMPLE_PROJECT_IO_HPP

template<typename T>
std::istream &operator>>(std::istream &is, std::vector<T> &vec) {
    for (T &element: vec) {
        is >> element;
    }
    return is;
}

template<typename T, typename U>
std::istream &operator>>(std::istream &is, std::pair<T, U> &p) {
    is >> p.first;
    is >> p.second;
    return is;
}

template<class X, class Y>
std::ostream &operator<<(std::ostream &os, std::pair<X, Y> const &p) {
    return os << p.first << " " << p.second;
}

template<class Ch, class Tr, class Container>
std::basic_ostream<Ch, Tr> &operator<<(std::basic_ostream<Ch, Tr> &os, Container const &x) {
    bool first = true;
    for (auto &y : x) {
        if (first) {
            first = false;
        } else {
            os << " ";
        }
        os << y;
    }
    return os;
}

using namespace std;

class DBannedK {
public:
    void solve(std::istream &in, std::ostream &out) {
        int n;
        in >> n;
        vi A(n);
        in >> A;
        unordered_map<int, int> counter;
        ll tot = 0;
        trav(x, A) {
            tot += counter[x];
            counter[x]++;
        }
        trav(x, A) {
            ll res = tot - counter[x] + 1;
            out << res << '\n';
        }
    }

    void setup() {}
};


int main() {
    std::ios_base::sync_with_stdio(false);
    DBannedK solver;
    solver.setup();
    std::istream &in(std::cin);
    std::ostream &out(std::cout);
    in.tie(nullptr);
    out << std::fixed;
    out.precision(20);
    solver.solve(in, out);
    return 0;
}


Measured memory_bytes: 8392
#include <stdio.h>

int main(void)
{
	int n,m,sum;
	int a[100][100];
	int b[100];
	int i,j;
	
	scanf("%d %d",&n,&m);
	
	for(i=0 ; i<n ; i++){
		for(j=0 ; j<m ; j++){
			scanf("%d",&a[i][j]);
		}
	}
	
	for(i=0 ; i<m ; i++)
		scanf("%d",&b[i]);
	
	for(i=0 ; i<n ; i++){
		sum=0;
		for(j=0 ; j<m ; j++){
			sum+=a[i][j]*b[j];
		}
		printf("%d\n",sum);
	}
	
	return 0;
}


Measured memory_bytes: 2076
#include <iostream>

using namespace std;
using ll = long long;
using ld = long double;

#define ALL(x) begin(x), end(x)
#define REP(i, n) for (size_t i = 0, i##_len = (n); i < i##_len; ++i)

int main() {
  string S, T;
  cin >> S >> T;
  int ans{};
  for (int i = 0, n = S.length(); i!=n; ++i) {
    if (S[i]==T[i]) ++ans;
  }
  cout << S.length()- ans << endl;
}


Measured memory_bytes: 3856
use proconio::fastout;
use whiteread::parse_line;

#[fastout]
fn main() {
    let n: usize = parse_line().unwrap();
    let (d, x): (usize, usize) = parse_line().unwrap();

    let mut ret = x;
    for _ in 0..n {
        let a: usize = parse_line().unwrap();
        ret += (d - 1) / a + 1;
    }
    println!("{}", ret);
}


Measured memory_bytes: 2164
#include <stdio.h>
#include <string.h>

int main(){
  char keitai[10][6],r[2000];
  int tes,temp,s;
  size_t i,cnt;
    
  strcpy( keitai[1], "5.,!? " );
  strcpy( keitai[2], "3abc" );
  strcpy( keitai[3], "3def" );
  strcpy( keitai[4], "3ghi" );
  strcpy( keitai[5], "3jkl" );
  strcpy( keitai[6], "3mno" );
  strcpy( keitai[7], "4pqrs" );
  strcpy( keitai[8], "3tuv" );
  strcpy( keitai[9], "4wxyz" );

  scanf("%d",&tes);

  while(tes--){
    scanf("%s",r);
    cnt = -1;
    s = 0;
    for(i = 0;i < strlen(r);i++ ){
      temp = r[i] - '0';
      if(temp == 0){
        if(s != 0){
          printf("%c",keitai[s][(cnt % (keitai[s][0] - '0') )+1]);
        }
        cnt = -1;
        s = 0;
      }
      else{
        cnt++;
        s = temp;
      }
    }
    printf("\n");
  }

  return 0;

}

Measured memory_bytes: 0
#include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <list>
#include <iterator>
#pragma warning(disable:4996)
 
typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF 9223300000000000000
#define INF 2140000000
#define MOD 1000000007
using namespace std;



const long max_comb=300;
vector<ll> fac(max_comb+1); //n! (mod M)
vector<ll> ifac(max_comb+1); //k!^(-1) (mod M)

ll mpow(ll x, ll n){ //x^n(mod M)
    ll ans = 1;
    while(n != 0){
        if(n&1) ans = ans*x % MOD;
        x = x*x % MOD;
        n = n >> 1;
    }
    return ans;
}

ll minv(ll x){
    return mpow( x, MOD-2 );
}

ll comb(long a, long b){     // C(a,b) = a! * b!^(-1) * (a-b)^(-1)
    if(a == 0 && b == 0)return 1;
    if(a < b || a < 0)return 0;
    ll tmp = ifac[a-b]* ifac[b] % MOD;
    return tmp * fac[a] % MOD;
}

ll perm(long a, long b){     // P(a,b) = a! * (a-b)!^(-1)
    if(b == 0)return 1;
    if(a < b || a < 0)return 0;
    ll tmp = ifac[a-b] % MOD;
    return tmp * fac[a] % MOD;
}

void pre_comb()
{
    fac[0] = 1;
    ifac[0] = 1;
    for(long i = 0; i<max_comb; i++){
        fac[i+1] = fac[i]*(i+1) % MOD; // n!(mod M)
        ifac[i+1] = ifac[i]*minv(i+1) % MOD; // k!^(-1) (mod M)
    }
    return;
}



ll dp[100005];

int main(int argc, char* argv[])
{
    long n, x;
    scanf("%ld%ld", &n, &x);

    vector<long> s(n);
    long i,j;
    for(i=0; i<n; i++) {
        scanf("%ld", &s[i]);
    }
    sort(s.rbegin(), s.rend());

    pre_comb();

    dp[x]=1;
    for(i=0; i<n; i++) {
        for(j=0; j<=x; j++) {
            if(dp[j]) {
                ll curr = dp[j];
                ll tmp = minv(n-i);
                dp[j]      = (curr*(1+MOD-tmp))%MOD;
                dp[j%s[i]] = (dp[j%s[i]] + curr*tmp)%MOD;                
            }
        }
    }

    ll ans=0;
    for(i=0; i<s[n-1]; i++) {
        ans = (ans + i*dp[i])%MOD;
    }
    ans = (ans * perm(n,n))%MOD;
    printf("%lld\n", ans);

    return 0;
}


Measured memory_bytes: 512
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<cmath>
#include<cstdio>

#define all(c) (c).begin(),(c).end()

using namespace std;

const double R=6378.10;
const double PI=3.1415926535;
const double EPS=1e-10;
const double toRad=360.0/2.0/PI;

int main(void){
  double a,b,c,d;
  while(cin >> a >> b >> c >> d){
    if(a<0 && b<0 && c<0 && d<0)break;
    a/=toRad,b/=toRad,c/=toRad,d/=toRad;
    double ax=cos(b)*cos(a),ay=sin(b)*cos(a),az=sin(a);
    double bx=cos(d)*cos(c),by=sin(d)*cos(c),bz=sin(c);
    double D=sqrt(pow(ax-bx,2)+pow(ay-by,2)+pow(az-bz,2));
    double rad=acos(1-D*D/2);
    printf("%.0f",round(R*rad));
    cout << endl;
  }
  return 0;
}

Measured memory_bytes: 1320
// https://atcoder.jp/contests/abc081/tasks/abc081_a

#include <iostream>
using namespace std;

int main() {
    string s;
    int count{};
    cin >> skipws >> s;
    for (auto c : s) {
        if (c == '1') {
            ++count;
        }
    }
    cout << count << endl;
}


Measured memory_bytes: 768
#include <iostream>
#include <algorithm>
#include <string>
#define flush fflush(stdout)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, int> Pl;
const int mod = (int)1e9 + 7, INF = (int)1e9;
const int di[4] = { 1,0,-1,0 }, dj[4] = { 0,1,0,-1 };


int main(void) {
    int k;
    string s;

    scanf("%d", &k);
    cin >> s;

    if (s.size() <= k) {
        cout << s << '\n';
    }
    else {
        cout << s.substr(0, k) << "...\n";
    }

    return 0;
}

Measured memory_bytes: 3692
X, K, D = list(map(int,input().split()))

if abs(X) >= K * D:  print(abs(X) - K * D)
else:
    if X >= 0:
        ans1 = X % D
        ans2 = abs(ans1 - D)
        m = X // D
    else:
        ans1 = (-X % D)
        ans2 = -ans1 + D
        m = -X // D

    if (K - m) % 2 == 0:  print(ans1)
    else:  print(ans2)

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

struct Point{ double x, y; };

Point set_p(double a, double b)
{
    Point p;
    p.x = a; p.y = b;
    return p;
}

struct Vector{ double vx, vy; };

Vector set_v(const Point &p1, const Point &p2)
{
    Vector v;
    v.vx = p2.x - p1.x;
    v.vy = p2.y - p1.y;
    return v;
}

double dist(const Point &p1, const Point &p2)
{
    return sqrt((p1.x - p2.x) * (p1.x - p2.x) + (p1.y - p2.y) * (p1.y - p2.y));
}

double norm(const Vector &v)
{
    return (v.vx) * (v.vx) + (v.vy) * (v.vy);
}

double inpro(const Vector &v1, const Vector &v2)
{
    return (v1.vx * v2.vx) + (v1.vy * v2.vy);
}

Point move(const Point &p, const Vector &v, const double t)
{
    Point moved_p;
    moved_p.x = p.x + t * v.vx;
    moved_p.y = p.y + t * v.vy;
    return moved_p;
}

Point horizontal(Point &p1, Point &p2, Point &p3)
{
    Vector v2 = set_v(p1, p2);
    Vector v3 = set_v(p1, p3);
    double t;
    t = inpro(v2, v3) / norm(v2);
    Point p = move(p1, v2, t);
    return p;
}

int main()
{
    double p0x, p0y, p1x, p1y;
    scanf("%lf %lf %lf %lf", &p0x, &p0y, &p1x, &p1y);
    Point P0 = set_p(p0x, p0y);
    Point P1 = set_p(p1x, p1y);
 
    int q;
    scanf("%d", &q);
    double p2x, p2y;

    for(int i = 0; i < q; i++){
        scanf("%lf %lf", &p2x, &p2y);
        Point P2 = set_p(p2x, p2y);
        Point H = horizontal(P0, P1, P2);
        printf("%.12f %.12f\n", H.x, H.y);
    }

    return 0;
}

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

static const int INF = 1e9+7;

int main(){
    int H,N;
    cin>>H>>N;
    vector<int> A(N);
    vector<int> B(N);

    for(int i=0; i<N; i++) cin>>A[i]>>B[i];
    vector<vector<int>> dp(1000+10,vector<int>(10000+10,INF));
    dp[0][0] = 0;

    for(int i=0; i<N; i++){
        for(int j=0; j<=H; j++){
            dp[i+1][j] = min(dp[i+1][j],dp[i][j]);
            dp[i+1][min(j+A[i],H)] = min(dp[i+1][min(j+A[i],H)],dp[i+1][j]+B[i]);
        }
    }

    cout<<dp[N][H]<<endl;

    return 0;

}

Measured memory_bytes: 39808
from sys import exit, setrecursionlimit, stderr
from functools import reduce
from itertools import *
from collections import defaultdict
from bisect import bisect

def read():
  return int(input())

def reads():
  return [int(x) for x in input().split()]

N, M, Q = reads()

mat = [[0] * N for _ in range(N)]
for _ in range(M):
  l, r = reads()
  l, r = l-1, r-1
  mat[l][r] += 1

acc = [[0] * (N+1) for _ in range(N+1)]
for i, j in product(range(N), range(N)):
  acc[i+1][j+1] = acc[i][j+1] + acc[i+1][j] - acc[i][j] + mat[i][j]

for _ in range(Q):
  p, q = reads()
  p, q = p-1, q-1
  ans = acc[N][q+1] - acc[p][q+1]
  print(ans)


Measured memory_bytes: 15896
#include <bits/stdc++.h>
using namespace std;
const int N=1e5+5;
vector<pair<int,int> > G[N];
pair<int,int> p[N];
int a[N],f[N];
bool vis[N],flag[N<<1];
int dfs(int u) {
	vis[u]=true;
	int ans=f[u];
	for(int i=0;i<G[u].size();i++) {
		int v=G[u][i].first,id=G[u][i].second;
		if(vis[v]) continue; 
		if(dfs(v)) flag[id]=true,ans^=1;
	}
	return ans;
}
int main() {
	int n,m;
	scanf("%d%d",&n,&m);
	for(int i=1,x,y;i<=n;i++) {
		scanf("%d%d",&x,&y);
		p[i]={x,y},a[i]=x;
	}
	sort(a+1,a+n+1);
	for(int i=1;i<=n;i++) {
		int pos=lower_bound(a+1,a+n+1,p[i].first)-a;
		f[pos]=p[i].second;
	}
	for(int i=n+1;i>=1;i--) {
		f[i]^=f[i-1];
	}
	for(int i=0,l,r;i<m;i++) {
		scanf("%d%d",&l,&r);
		int u=lower_bound(a+1,a+n+1,l)-a,v=upper_bound(a+1,a+n+1,r)-a;
		G[u].push_back({v,i});
		G[v].push_back({u,i});
	}
	bool ff=true;
	for(int i=1;i<=n+1;i++) {
		if(vis[i]) continue;
		if(dfs(i)) {
			ff=false;
			break;
		}
	}
	if(!ff) printf("-1\n");
	else {
		vector<int> vec;
		for(int i=0;i<m;i++) {
			if(flag[i]) vec.push_back(i+1);
		}
		printf("%d\n",vec.size());
		for(int i=0;i<vec.size();i++) {
			printf("%d%c",vec[i],i==vec.size()-1?'\n':' ');
		}
	}
	return 0;
}

Measured memory_bytes: 14716
#define f(a,b)F[a+b]*I[a]%M*I[b]%M
struct T{int a,b;}A[3333];
long P[3333],M=1e9+7,F[2<<17],I[2<<17];
i,j,k;
c(a,b)struct T*a,*b;{return a->a-b->a?:a->b-b->b;}
p(a,b){return b?p(a%M*a%M,b/2)%M*(b%2?a:1)%M:1;}
main(y)
{
	for(*F=*I=1;++k<2<<17;)I[k]=p(F[k]=F[k-1]*k%M,M-2);
	for(;~scanf("%d%d",&A[i].a,&A[i].b);i++)i||gets(P);
	for(qsort(A,i,sizeof(struct T),c);j<i;j++)
		for(P[k=j]=f(A[j].a-1,A[j].b-1);k--;)(y=A[j].b-A[k].b)>=0?P[j]=(P[j]-f(A[j].a-A[k].a,y)*P[k]%M+M)%M:0;
	printf("%d",P[i-1]);
}

Measured memory_bytes: 4352
using System.Collections.Generic;
using static System.Math;
using System;

public class Hello
{
    public static void Main()
    {
        var d = new Dictionary<string, int>();
        var n = int.Parse(Console.ReadLine().Trim());
        var dmax = 0;
        for (int i = 0; i < n; i++)
        {
            var s = Console.ReadLine().Trim();
            if (d.ContainsKey(s)) d[s]++;
            else d[s] = 1;
            dmax = Max(dmax, d[s]);
        }
        var ans = new List<string>();
        foreach (var x in d)
            if (dmax == x.Value) ans.Add(x.Key);
        ans.Sort(StringComparer.Ordinal);
        Console.WriteLine(string.Join("\n", ans));
    }
}


Measured memory_bytes: 50808
#include<iostream>
using namespace std;
int main()
{
int a;
cin >> a;
int num100, num10, num1;
num100=a/100;
num10=(a-100*num100)/10;
num1=a-100*num100-10*num10;
if(num100==num1){
  cout<< "Yes"<<endl;
}else{
  cout<<"No"<<endl;
}
}


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> ;
using pll = pair<long long,long long>;
constexpr int INF = 1e9;
constexpr long long LINF = 1e17;
constexpr int MOD = 1000000007;
constexpr double PI = 3.14159265358979323846;

int main(){
    int a;
    cin >> a;
    cout << (a + a*a + a*a*a) << endl;
    return 0;
}

Measured memory_bytes: 3636
#include <iostream>
#include <assert.h>
#include <string.h>
#include <string>
#include <list>
using namespace std;
char a[50000];
int b[26];
int c[26];

int main()
{
    int n,i,j,ans = 0,m,f;
    char s[100];
    cin>>n;
    for(i = 0;i<n;i++)
    {
        cin>>s[i];
    }

    for(j = 1;j<n;j++)
    {
        f = 0;
        for(i = 0;i<26;i++)
        {
            b[i] = 0;
            c[i] = 0;
        }
        for(i = 0;i<j;i++)
        {
            m = s[i] - 'a';
            b[m]++;
        }
        for(i = j;i<n;i++)
        {
            m = s[i] - 'a';
            c[m]++;
        }
        for(i = 0;i<26;i++)
        {
            if(c[i]&&b[i])
            {
                f++;
            }
        }
        ans = max(ans,f);
    }
    cout<<ans;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>

int main()
{
	int  N;
	scanf("%d", &N);

	
	long long sum = 0;
	for (int i = 1; i <= N; i++)
	{
		if ((i % 3) != 0 && (i % 5) != 0)
		{
			sum += i;
		}
	

		
	}
	std::cout << sum << std::endl;
	//printf("%lld\n", sum);
	return 0;
}




Measured memory_bytes: 3228
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
const int N=2e5+5;
int a[N];
int main(){
	int n;scanf("%d",&n);
	for(int i=0;i<n;i++)scanf("%d",a+i);
	sort(a,a+n,greater<int>());
	LL ans=a[0];
	for(int i=n/2-1;i;i--)ans+=a[i]<<1;
	if(n&1)ans+=a[n/2];
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 4524
#include <iostream>
#include <vector>
using namespace std;
 
int main() {
    int N, T; cin >> N >> T;
    vector <int> A(N);
    for(int i=0;i<N;i++) cin >> A[i];
    int max_dif=0, cnt=0, minA=A[0];
    for(int i=1;i<N;i++){
    	if(A[i]-minA==max_dif) cnt++;
    	if(A[i]-minA>max_dif){
    		max_dif=A[i]-minA; cnt=1;
    	}
    	if(minA>A[i]) minA=A[i];
    }
    cout << cnt << endl;
    return 0;
}

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

template <typename tn> void read (tn & a) {
	tn x = 0, f = 1; char c = getchar();
	while (c < '0' || c > '9'){ if (c == '-') f = -1; c = getchar(); }
	while (c >= '0' && c <= '9'){ x = x * 10 + c - '0'; c = getchar(); }
	a = f == 1 ? x : -x;
}

int h, d, W;
const int MAXN = 93000;
pair<int, int> a[MAXN];
vector<int> g[MAXN], w[MAXN];
int x[MAXN];

int dis (int x, int y) {
	return abs(a[x].first - a[y].first) + abs(a[y].second - a[x].second);
}

int getit(int i, int x) {
	int l = 0, r = g[i].size();
	while (l + 1 < r) {
		int mid = (l + r) / 2;
		if (g[i][mid] == x) return w[i][mid];
		if (g[i][mid] > x) r = mid;
		else l = mid;
		
	}
	return w[i][l];
}

int main() {
	read(h);
	read(W);
	read(d);
	rep(i, 1, h) rep(j, 1, W) {
		int x;
		read(x);
			a[x].first = i;
			a[x].second = j;
		g[x % d].push_back(x);
	}
	rep(i, 0, d - 1) {
		rep(j, 0, g[i].size() - 1) {
			x[j] = g[i][j];
		}
		sort(x, x + g[i].size());
		rep(j, 0, g[i].size() - 1) {
			g[i][j] = x[j];
		}
		w[i].push_back(0);
		rep(j, 1, g[i].size() - 1) {
			w[i].push_back(w[i][w[i].size() - 1] + dis(g[i][j], g[i][j- 1]));
		}
	}
	int t; 	read(t);
	while (t--) {
		int x, y, k;
		read(x);
		read(y);
		int i = x % d;
		int xx = getit(i, x), yy = getit(i, y);
		cout << yy - xx << "\n";
	}
	return 0;
} 


Measured memory_bytes: 11136
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<cstring>
#include<vector>
using namespace std;
typedef long long ll;
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define sc(x) scanf("%d",&x);
int main(){
    int n; sc(n)
    int T[n], A[n];
    REP(i, n){
        sc(T[i])
        sc(A[i])
    }
    ll ans1 = T[0], ans2 = A[0], tmp = 0;
    for (int i = 0; i < n; i++){
        if (T[i] == A[i] && ans1 == ans2) continue;
        
        if (ans1 % T[i] == 0 && ans2 % A[i] == 0){
            tmp = max(ans1 / T[i], ans2 / A[i]);
        }else if (ans1 % T[i] == 0){
            tmp = max(ans1 / T[i], ans2 / A[i] + 1ll);
        }else if (ans2 % A[i] == 0){
            tmp = max(ans1 / T[i] + 1ll, ans2 / A[i]);
        }else tmp = max(ans1 / T[i] + 1ll, ans2 / A[i] + 1ll);
        ans1 = T[i] * tmp;
        ans2 = A[i] * tmp;
    }
    cout << ans1 + ans2 << endl;
    return 0;
}

Measured memory_bytes: 256
import math
n,a,b=map(int,input().split())
h=[int(input()) for i in range(n)]
l,r=0,10**9
while r-l>1:
    m=(l+r)//2
    count=0
    for i in h:
        count+=max(math.ceil((i-b*m)/(a-b)),0)
    if count<=m:
        r=m
    else:
        l=m
print(r)

Measured memory_bytes: 12984
import java.util.Scanner;


public class Main {
	
	static int[][] memory;
	
    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        
        int N = sc.nextInt();
   
        int count = 0;
        int[] member = new int[5];
        int select = 3;
        
        
        for(int i = 0;i<N;i++){
        	
        	String line = sc.next();
        	
        	if('M'==line.charAt(0)){
        		member[0]++;
        		
        	}else if('A'==line.charAt(0)){
        		member[1]++;
        	}else if('R'==line.charAt(0)){
        		member[2]++;
        	}else if('C'==line.charAt(0)){
        		member[3]++;
        	}else if('H'==line.charAt(0)){
        		member[4]++;
        	}
        	
        	
        	
        }
        
        long ans = result(member,select,0);
        
        System.out.println(ans);
		
	}

	private static long result(int[] member,int count,int choise) {
		
		long ans=1;
		
		if(choise==member.length-1)
			if(count==1)	return member[choise];
			else if(count==0)	return 1;
			else return 0;
		
		if(count>0&&member[choise]>0){
			ans = (result(member,count,choise+1)+result(member,count-1,choise+1)*member[choise]);
		}else{
			ans = result(member,count,choise+1);
		}
		
		return ans;
		
	}
		

    
}

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

int main() {
    vector<int> A(3);
    for(int i = 0; i < 3; ++i) {
        cin >> A[i];
    }
    sort(A.begin(), A.end());
    int ans = 0;
    while(A[1] != A[2]) {
        A[0]++; A[1]++;
        ans++;
    }
    while(A[0] < A[1]) {
        A[0] += 2;
        ans++;
    }
    ans += A[0] - A[1];
    cout << ans << '\n';
    return 0;
}


Measured memory_bytes: 256
import sys
import os
import math

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

MOD = 10 ** 9 + 7


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    l = il()
    print('Yes' if len(set(l)) == 2 else 'No')


if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <algorithm>

using namespace std;
using vi = vector<int>;
using vvi = vector<vi>;
template<class T> using hset = unordered_set<T>;
template<class Key, class T> using hmap = unordered_map<Key, T>;

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

int tax(int p, int x) { return p*(100+x)/100; }

int max_sum(int x, int y, int s) {
    int i = 1, j = s-1, tmp, max = 0;

    for (; i <= j; i++) {
        while (tax(i, x) + tax(j, x) > s) j--;
        if (tax(i, x) + tax(j, x) == s) {
            tmp = tax(i, y) + tax(j, y);
            max = tmp > max ? tmp : max;
        }
    }

    return max;
}

int main() {
    int x, y, s;

    while (cin >> x >> y >> s) {
        if (x == 0 && y == 0 && s == 0) break;
        cout << max_sum(x, y, s) << endl;
    }

    return 0;
}

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

// --------------------------------------------------------------------------------
#define fastio	ios_base::sync_with_stio(false),cin.tie(NULL),cout.tie(NULL)
#define ll long long 
#define mset(arr,val) memset(arr,val,sizeof(arr))
#define deb(name,value) cout <<"->>  "<<name<< "= " <<value<<" "
#define frepi(a,b,k) for(int i=a;i<=b;i+=k)
#define frepj(a,b,k) for(int j=a;j<=b;j+=k)
// --------------------------------------------------------------------------------

void solve(ll n,int k)
{
	int ans = 0;
	while(n)
	{
		n/=k;
		ans++;
	}
	cout<<ans<<"\n";
}

void solve_main()
{
    ll n,k;cin>>n>>k;
    solve(n,k);
}

int main()
{
	// #ifndef ONLINE_JUDGE
 //    	freopen("/home/suryakant/input.txt","r",stdin);
 //        freopen("/home/suryakant/output.txt","w",stdout);
 //    #endif
    int t=1;
    // cin>>t;
    while(t--)
    {
        solve_main();
    }
    
}

Measured memory_bytes: 3624
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <iostream>
#include <iostream>
#include <fstream>
#include <numeric>
#include <cstring>
#include <cassert>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <cmath>
#include <set>
#include <map>
#include <functional>
#include <bitset>
#include <iomanip>
#include <stack>
#include <list>
using namespace std;
#define     loop(n,i,a)     for(int i=a;i<n;i++)
#define     loopR(n,i,a)    for(int i=n-1;i>=a;i--)
#define     all(arr,n)      arr,arr+n
#define     allv(v)         (v).begin(),(v).end()
#define     rallv(v)        (v).rbegin(),(v).rend()
#define     m_p             make_pair
#define     ll              long long
#define     pii             pair<ll,ll>
#define     vi              vector<int>
#define     vll             vector<ll>
#define     vii             vector<pair<ll,ll>>
#define     sz(x)           (int)x.size()
#define     pb              push_back
#define     endl            "\n"
#define     Endl            "\n"
#define     f               first
#define     s               second
#define     mem(dp,n)       memset(dp,n,sizeof dp)
#define     test(i)        cout<<i<<endl
int dx[] = { 1 , 0 ,-1 , 0 ,-1 ,-1 , 1 , 1 };
int dy[] = { 0 , 1 , 0 ,-1 ,-1 , 1 ,-1 , 1 };
void fast(){
    std::ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    cout.tie(NULL);
}
vector<string> vec_splitter(string s) {
    s += ',';
    vector<string> res;
    while(!s.empty()) {
        res.push_back(s.substr(0, s.find(',')));
        s = s.substr(s.find(',') + 1);
    }
    return res;
}
void debug_out(
        vector<string> __attribute__ ((unused)) args,
        __attribute__ ((unused)) int idx,
        __attribute__ ((unused)) int LINE_NUM) { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(vector<string> args, int idx, int LINE_NUM, Head H, Tail... T) {
    if(idx > 0) cerr << ", "; else cerr << "Line(" << LINE_NUM << ") ";
    stringstream ss; ss << H;
    cerr << args[idx] << " = " << ss.str();
    debug_out(args, idx + 1, LINE_NUM, T...);
}
#define debug(...) debug_out(vec_splitter(#__VA_ARGS__), 0, __LINE__, __VA_ARGS__)
const ll mxN=2e5+10,oo=0x3f3f3f3f,MOD=998244353;
const double PI = 3.14159265358979323846;
int n,k;
ll arr[mxN];
bool check(ll mid){
    ll cnt=0;
    bool flag=false;
    loop(n,i,0){
        if(arr[i]>=mid)
            flag=true;
        if(arr[i]==mid)
            continue;
        cnt+=(arr[i]/mid);
    }
    return flag&&cnt<=k;

}
void solve(){
    cin>>n>>k;
    loop(n,i,0)
        cin>>arr[i];
    sort(all(arr,n));
    ll l=1,r=arr[n-1],res=0;
    while(l<=r){
        ll mid=(l+r)>>1;
        //cout<<mid<<endl;
        if(check(mid)){
            res=mid;
            r=mid-1;
        } else
            l=mid+1;
    }
    cout<<res<<endl;
}
int main() {
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    fast();
    solve();
}

Measured memory_bytes: 5168
n,m=map(int,input().split())
P=[]
S=[]
for i in range(m):
    p,s=input().split()
    P.append(int(p))
    S.append(s)
A=[0]*n #1がAC
W=[0]*n #WA数
for i in range(m):
    if A[P[i]-1]==0:
        if S[i]=="WA":
            W[P[i]-1]+=1
        else:
            A[P[i]-1]=1
for i in range(n):
    if A[i]==0:
        W[i]=0
print(sum(A),sum(W))

Measured memory_bytes: 14996
public class Main {
  private static void solve() {
    int n = ni();
    s = ni();
    a = na(n);

    System.out.println(f());
  }

  static int s;
  static int[] a;
  static int mod = 998244353;


  private static long f() {
    int n = a.length;
    long[][] dp = new long[n + 1][s + 1];
    for (int i = 0; i < n; i++) {
      dp[i][0] = 1;
    }

    for (int i = 0; i < n; i++) {
      for (int j = 0; j <= s; j++) {
        dp[i + 1][j] += dp[i][j];

        if (j >= a[i]) {
          dp[i + 1][j] += dp[i][j - a[i]];
        }

        dp[i + 1][j] %= mod;
      }
    }

    long ret = 0;
    for (int i = 0; i <= n; i++) {
      ret += dp[i][s];
      ret %= mod;
    }
    return ret;
  }

  public static void main(String[] args) {
    new Thread(null, new Runnable() {
      @Override
      public void run() {
        long start = System.currentTimeMillis();
        String debug = args.length > 0 ? args[0] : null;
        if (debug != null) {
          try {
            is = java.nio.file.Files.newInputStream(java.nio.file.Paths.get(debug));
          } catch (Exception e) {
            throw new RuntimeException(e);
          }
        }
        reader = new java.io.BufferedReader(new java.io.InputStreamReader(is), 32768);
        solve();
        out.flush();
        tr((System.currentTimeMillis() - start) + "ms");
      }
    }, "", 64000000).start();
  }

  private static java.io.InputStream is = System.in;
  private static java.io.PrintWriter out = new java.io.PrintWriter(System.out);
  private static java.util.StringTokenizer tokenizer = null;
  private static java.io.BufferedReader reader;

  public static String next() {
    while (tokenizer == null || !tokenizer.hasMoreTokens()) {
      try {
        tokenizer = new java.util.StringTokenizer(reader.readLine());
      } catch (Exception e) {
        throw new RuntimeException(e);
      }
    }
    return tokenizer.nextToken();
  }

  private static double nd() {
    return Double.parseDouble(next());
  }

  private static long nl() {
    return Long.parseLong(next());
  }

  private static int[] na(int n) {
    int[] a = new int[n];
    for (int i = 0; i < n; i++)
      a[i] = ni();
    return a;
  }

  private static char[] ns() {
    return next().toCharArray();
  }

  private static long[] nal(int n) {
    long[] a = new long[n];
    for (int i = 0; i < n; i++)
      a[i] = nl();
    return a;
  }

  private static int[][] ntable(int n, int m) {
    int[][] table = new int[n][m];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        table[i][j] = ni();
      }
    }
    return table;
  }

  private static int[][] nlist(int n, int m) {
    int[][] table = new int[m][n];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        table[j][i] = ni();
      }
    }
    return table;
  }

  private static int ni() {
    return Integer.parseInt(next());
  }

  private static void tr(Object... o) {
    if (is != System.in)
      System.out.println(java.util.Arrays.deepToString(o));
  }
}


Measured memory_bytes: 128336
import java.util.Scanner;

public class Main{
	public static void main(String [] args){
		Scanner sc = new Scanner(System.in);
		int a,b,c,count = 0;
		a = sc.nextInt();
		b = sc.nextInt();
		c = sc.nextInt();
		for(int i = a; i <= b; i++){
			if(c % i == 0){
				count++;
			}
		}
		System.out.println(count);
	}
}

Measured memory_bytes: 26320
//Love and Freedom.
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<cstring>
#define ll long long
#define inf 20021225
using namespace std;

#define mdn 1000000007
int n; char ch[1000100]; int cnt[27];
int main()
{
	scanf("%d",&n); scanf("%s",ch+1);
	for(int i=1;i<=n;i++)	cnt[ch[i]-'a']++;
	int ans=1;
	for(int i=0;i<26;i++)	ans=(ll)ans*(cnt[i]+1)%mdn;
	printf("%d\n",ans-1);
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define sz(x) int(x.size())
#define pb push_back
#define eb emplace_back
using ll=long long;
using P = pair<int,int>;
#define chmax(x,y) x = max(x,y)
#define chmin(x,y) x = min(x,y)
const ll MOD=1000000007;



int main() {
    int N;
    cin>>N;
    vector<int> W(N);
    rep(i,N)cin>>W.at(i);
    int sum=0;
    rep(i,N){sum+=W.at(i);}
    int ans=sum;
    int nowsum=0;
    rep(i,N){
        nowsum+=W.at(i);
        chmin(ans,abs(sum-2*nowsum));
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
a,b=input().split()
a=int(a)
b1=[]
for i in range(4):
    if i==0 and b[0]=='0':pass
    elif b[i]=='.':pass
    else:b1.append(b[i])
b2=''.join(b1)
b2=int(b2)
k=a*b2//100
print(int(k))

Measured memory_bytes: 9068
var d = require("fs").readFileSync("/dev/stdin", "utf8").trim().split('\n');
while (d[0] !== '0') {
  var lc = d.shift();
  var data = [];
  for (var i = 0; i < lc; i++) {
    var info = d.shift().split(' ');
    var j = -1;
    for (var k = 0; k < data.length; k++) {
      if (data[k].no === info[0]) { j = k; break; }
    }
    var person = (j === -1) ? data[data.length] = {no: info[0], sales: 0} : data[j];
    person.sales += info[1] * info[2];
  }
  console.log(data.filter(function(d) { return d.sales >= 1000000; })
    .map(function(d) { return d.no; }).join('\n') || 'NA');
}

Measured memory_bytes: 9788
N = int(input())
S = str(input())
dp = [[0 for i in range(N+1)] for i in range(N+1)]

for i in reversed(range(N)):
    for j in reversed(range(N)):
        if S[i] == S[j]:
            dp[i][j] = dp[i+1][j+1] + 1
ans = 0
for i in range(N):
    for j in range(N):
        if j > i:
            tmp = min(j-i,dp[i][j])
            ans = max(tmp,ans)
print(ans)

Measured memory_bytes: 247816
#include <bits/stdc++.h>
//#pragma GCC optimize("Ofast")
//#pragma GCC target("avx,avx2,fma")
//#pragma GCC optimization ("unroll-loops")
using namespace std;

const int N = 105, K = 1E5 + 1;
int dp[K], a[N];
int main() {
        int n, k;
        scanf("%d%d", &n, &k);
        for (int i = 1; i <= n; i++) scanf("%d", a + i);
        dp[0] = 0;
        for (int j = 1; j <= k; j++) {
                for (int i = 1; i <= n; i++) {
                        if (j - a[i] >= 0) dp[j] |= !dp[j - a[i]];
                }
        }
        printf("%s", (dp[k] ? "First" : "Second"));
}

Measured memory_bytes: 4064
#include<iostream>
#include<algorithm>
#include <vector>
#include <set>
using namespace std;
int main(){
	int a,b;
	cin>>a>>b;
	if(a==1)a=14;
	if(b==1)b=14;
	if(a>b)cout<<"Alice";
	else if(a==b)cout<<"Draw";
	else cout<<"Bob";
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

#include <iostream>
#include <complex>
#include <string>
#include <algorithm>
#include <numeric>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>

#include <functional>
#include <cassert>

typedef long long ll;
using namespace std;

#ifdef LOCAL
#define debug(x) cerr << __LINE__ << " : " << #x << " = " << (x) << endl;
#else
#define debug(x) ;
#endif

#define mod 1000000007 //1e9+7(prime number)
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 200010

int inedge[SIZE] = {};
vector<int> edge[SIZE];
int dp[SIZE];

int main(){
  int n, m;

  scanf("%d%d", &n, &m);

  for(int i=0;i<m;i++){
    int x, y;
    scanf("%d%d", &x, &y);
    x--; y--;
    inedge[y]++;
    edge[x].push_back(y);
  }

  queue<int> que;

  for(int i=0;i<n;i++){
    if(inedge[i] == 0) que.push(i);
  }

  int ans = 0;

  while(que.size()){
    int p = que.front();
    que.pop();

    ans = max(ans, dp[p]);

    for(int i=0; i<edge[p].size(); i++){
      int to = edge[p][i];
      dp[to] = max(dp[to], dp[p]+1);
      inedge[to]--;
      if(inedge[to] == 0) que.push(to);
    }
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 9088
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
using namespace std;
typedef pair<int, int> pii;
bool comp(const pii &a, const pii &b){
    return (a.second != b.second)? a.second < b.second : a.first < b.first; 
}

int main(){
    int n,m;
    cin >> n >> m;
    vector<pii> range(m);
    for(int i=0; i<m; i++){
        cin >> range[i].first >> range[i].second;
    }
    sort(range.begin(), range.end(), comp);

    int ans = 1;
    int now = range[0].second;
    for(int i=0; i<m; i++){
        if(range[i].first >= now){
            now = range[i].second;
            ans++;
        }
    }
    cout << ans << endl;
    return 0;
}

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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

#define fi first
#define se second
#define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rep(i,n) repl(i,0,n)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt __builtin_popcountll

#define INF 1e16
#define mod 1000000007

ll K;
ll a[505][505];

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

  cin>>K;
  if(K==1){
    cout<<1<<endl;
    cout<<1<<endl;
    return 0;
  }
  ll N=2*((K+3)/4);
  rep(r,N){
    rep(c,N){
      a[r][c]=(r+c)%N;
      if(r%2==1)a[r][c]+=N;
    }
  }
  for(ll rm=2*N-1;rm>=K;rm--){
    rep(r,N){
      rep(c,N){
        if(a[r][c]==rm)a[r][c]-=N;
      }
    }
  }

  cout<<N<<endl;
  rep(i,N){
    rep(j,N){
      cout<<a[i][j]+1<<" ";
    }
    cout<<endl;
  }

  return 0;
}


Measured memory_bytes: 3200
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        int x_y;
        double p1=0,p2=0,p3=0,pinf=0;
        String str[] = br.readLine().split(" ");
        String str2[] = br.readLine().split(" ");
        for(int i=0;i<n;i++){
            x_y = Math.abs(Integer.parseInt(str[i]) - Integer.parseInt(str2[i]));
            p1 += x_y;
            p2 += Math.pow(x_y, 2);
            p3 += Math.pow(x_y, 3);
            if(pinf<x_y) pinf = x_y;
        }
        p2 = Math.sqrt(p2);
        p3 = Math.cbrt(p3);
        System.out.printf("%.6f\n%.6f\n%.6f\n%.6f\n", p1,p2,p3,pinf);
    }
}

Measured memory_bytes: 24684
#include<bits/stdc++.h>
 
#define rep(i,n) for(ll i = 0;i < n;++i)
#define all(v) v.begin(),v.end()
using namespace std;
using ll = long long;
typedef pair<int,int> P;
 
const int INF = 1001001001;
const long double PI = (acos(-1));


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

    int n;
    string s;
    cin >> n >> s;
    int ans = 0;
    rep(i,s.length()){
        if(s[i] == s[i+1]){
            continue;
        }
        ans++;
    }
    cout << ans << endl;

    cout << endl;
    return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define REP(i,n) for (int i = 1; i < (int)(n); i++)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define vout(x) rep(i,x.size()) cout << x[i] << " "
template<class T> bool chmin(T &a, T b) {if(a>b) {a=b;return 1;}return 0;}
template<class T> bool chmax(T &a, T b) {if(a<b) {a=b;return 1;}return 0;}
using namespace std;
using vint = vector<int>;
using vvint = vector<vector<int>>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<int,int>;
const int inf = 1e9;
const ll inf_l = 1e18;
const int MAX = 1000;

int main() {
    int n, m; cin >> n >> m;
    vvint g(3*n);
    rep(i,m) {
        int u, v; cin >> u >> v;
        u--; v--;
        g[3*u].push_back(3*v+1);
        g[3*u+1].push_back(3*v+2);
        g[3*u+2].push_back(3*v);
    }
    int s, t; cin >> s >> t;
    s--; t--;
    vint dis(3*n,inf);
    queue<int> q;
    dis[3*s] = 0;
    q.push(3*s);
    while (!q.empty()) {
        int v = q.front(); q.pop();
        for (int n_v : g[v]) {
            if (dis[n_v] != inf) continue;
            dis[n_v] = dis[v] + 1;
            q.push(n_v);
        }
    }
    if (dis[3*t] != inf) cout << dis[3*t]/3 << endl;
    else cout << -1 << endl;
}

Measured memory_bytes: 17792
import heapq
from collections import defaultdict, deque
from math import ceil, factorial, gcd
import sys
import bisect


sys.setrecursionlimit(10 ** 7)
INF = float("inf")
MOD = 10 ** 9 + 7

si = lambda: input().strip()
ii = lambda: int(input())
mii = lambda: map(int, input().split())
lmii = lambda: list(map(int, input().split()))
smii = lambda: sorted(map(int, input().split()))

K = ii()

ans = 0


for i in range(1, K+1):
    for j in range(1, K+1):
        g = gcd(i, j)
        for k in range(1, K+1):
            ans += gcd(g, k)

print(ans)

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

int main(void)
{
    int n; cin >> n;
    long long ans = 0;
    for (int i = 1; i < n + 1; i++)
    {
        if (i % 3 > 0 && i % 5 > 0) ans += i;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3560