akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<int, ll> pil;
typedef pair<int, ll> pli;
typedef pair<double,double> pdd;
#define SQ(i) ((i)*(i))
#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 TIME(i) Timer i(#i)
#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 TIME(i)
#define debug(...)
#define pary(...)
#define endl '\n'
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0)
#endif
class Timer {
private:
    string scope_name;
    chrono::high_resolution_clock::time_point start_time;
public:
    Timer (string name) : scope_name(name) {
        start_time = chrono::high_resolution_clock::now();
    }
    ~Timer () {
        auto stop_time = chrono::high_resolution_clock::now();
        auto length = chrono::duration_cast<chrono::microseconds>(stop_time - start_time).count();
        double mlength = double(length) * 0.001;
        debug(scope_name, mlength);
    }
};

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

ll x;
/********** Good Luck :) **********/
int main () {
    TIME(main);
    IOS();
    cin >> x;
    REP (i, 100000) {
        if (i * (i+1) / 2 >= x) {
            cout << i << endl;
            return 0;
        }
    }
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int M = sc.nextInt();
        int[] A = new int[(int)(N)];
        int a = 0;
        for(int i = 0 ; i < N ; i++){
                A[i] = sc.nextInt();
                a = a + A[i];
        }
       
        int[] B = new int[(int)(M)];
        int h = 0;
        for(int i = 0; i < M;i++){
            B[i] = 0;
            for(int n = 0; n < N ; n++){
                if(B[i] < A[n]){
                    B[i] = A[n];
                    h = n;
                    
                }
            }
            //System.out.println(h);
            A[h] = 0;
            //System.out.println(B[i]);
        }
        //double b = a/(4*M);
        //System.out.print("a=" + a + "b=" +b);
                
        if(a > B[M-1] * M * 4 ){
        System.out.print("No");
        }else{
            System.out.print("Yes");
            }
    }
}

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

int main(){
    int a[3];
    cin>>a[0]>>a[1]>>a[2];
    sort(a,a+3);
    if((a[0]==a[1]&& a[1]!=a[2])||(a[1]==a[2]&& a[0]!=a[1])){
        cout<<"Yes"<<endl;

           }

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



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

int main() {
    int N; cin >> N;
    string S; cin >> S;
    for (int i = 0; i < S.size(); i++) {
        char c = S[i];
        if(c + N > 'Z') {
            cout << char(c + N - 26);
        } else {
            cout << char(c + N);
        }
    }
    cout << endl;
}


Measured memory_bytes: 256
#!/usr/bin/env python3

import sys


def main():
    lines = sys.stdin.readlines()
    (_, quantum) = lines[0].split(' ')
    quantum = int(quantum)

    processes = []
    for line in lines[1:]:
        if line.strip() == '':
            break

        (k, v) = line.strip().split(' ')
        processes.append((k, int(v)))

    time = 0
    result = []
    while True:
        (process, process_time) = processes.pop(0)  # Dequeue

        if process_time <= quantum:
            time += process_time
            result.append((process, time))
        else:
            time += quantum
            processes.append((process, process_time - quantum))

        if len(processes) == 0:
            break

    for item in result:
        print("%s %s" % (item[0], item[1]))

if __name__ == "__main__":
    main()

Measured memory_bytes: 19508
#include <bits/stdc++.h>
using namespace std;
//#include <ext/pb_ds/assoc_container.hpp>
//using namespace __gnu_pbds;
//typedef tree <int,null_type,less <int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
// #include <ext/rope>
// using namespace __gnu_cxx;
typedef long long int ll;
typedef long double ld;
#define FAST ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define rep(g, i, n) for (ll g = i; g < n; g++)
#define rev(g, n, i) for (ll g = n - 1; g >= i; g--)
#define all(v) v.begin(), v.end()
#define pb push_back
#define mxe(v) *max_element(v.begin(),v.end())
#define mne(v) *min_element(v.begin(),v.end())
#define ve vector
#define lb lower_bound
#define ub upper_bound
#define bb break
#define cc continue
#define rem 1000000007
#define PI 3.141592653589793238462643383279502
ll power(ll x, ll y, ll p) 
{ 
    ll res = 1;      // Initialize result 
    x = x % p;  // Update x if it is more than or 
    while (y > 0) 
    { 
        if (y & 1) 
            res = (res*x) % p; 
        y = y>>1; // y = y/2 
        x = (x*x) % p; 
    } 
    return res; 
} 
ll modInverse(ll n, ll p) 
{ 
    return power(n, p-2, p); 
} 
struct point
{
    ll x,y;
};
int main()
{
    FAST
    // freopen("input1.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    /*ll tests;
    cin>>tests;
    rep (gg,0,tests)
    {}*/
    ll n,k;
    cin>>n>>k;
    cout<<min(n%k,k-n%k)<<"\n";
}


Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cstring>
#include <queue>
#include <stack>
#include <functional>
#include <set>
#include <map>
#include <deque>
#define WMAX 10000
#define HMAX 10000

//コメントアウトするとdebug()を実行しない
#define DEBUG

using namespace std;
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

typedef pair<int ,int > P;
typedef long long ll;

int A,B,C,D,N,W,H,ans,dp[HMAX][WMAX];
string S;
static const int dx[8] = {0,1,1,1,0,-1,-1,-1},
					dy[8] = {1,1,0,-1,-1,-1,0,1};

void solve(){

}

void debug(){

}

void answer(){
	cout << max(A*B,C*D) << "\n";
}

int main(){
	cin >> A >> B >> C >> D;
	solve();
	#ifdef DEBUG
	debug();
	#endif
	answer();

	return 0;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
signed main() { 
  ios::sync_with_stdio(false); cin.tie(0);
  int s, w;
  cin >> s >> w;
  cout << (s > w ? "safe\n" : "unsafe\n");
  return 0;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define fi first
#define se second
#define pii pair<int,int>
#define pdi pair<db,int>
#define mp make_pair
#define pb push_back
#define enter putchar('\n')
#define space putchar(' ')
#define eps 1e-8
#define mo 974711
#define MAXN 200005
//#define ivorysi
using namespace std;
typedef long long int64;
typedef double db;
template<class T>
void read(T &res) {
    res = 0;char c = getchar();T f = 1;
    while(c < '0' || c > '9') {
	if(c == '-') f = -1;
	c = getchar();
    }
    while(c >= '0' && c <= '9') {
	res = res * 10 + c - '0';
 	c = getchar();
    }
    res *= f;
}
template<class T>
void out(T x) {
    if(x < 0) {x = -x;putchar('-');}
    if(x >= 10) {
	out(x / 10);
    }
    putchar('0' + x % 10);
}
int X,Y,Z;
int64 A[MAXN],B[MAXN],C[MAXN],ans,f[MAXN],b[MAXN];
int id[MAXN];
multiset<int64> S;
void Solve() {
    read(X);read(Y);read(Z);
    for(int i = 1 ; i <= X + Y + Z ; ++i) {
	read(A[i]);read(B[i]);read(C[i]);
	ans += C[i];
	A[i] -= C[i];B[i] -= C[i];
	id[i] = i;
    }
    sort(id + 1,id + X + Y + Z + 1,[](int a,int b){return A[a] - B[a] < A[b] - B[b];});
    int64 all = 0;
    for(int i = 1 ; i <= X + Y + Z ; ++i) {
	S.insert(B[id[i]]);
	all += B[id[i]];
	if(S.size() > Y) {
	    all -= *(S.begin());
	    S.erase(S.begin());
	}
	f[i] = all;
    }
    S.clear();all = 0;
    for(int i = X + Y + Z ; i >= 1 ; --i) {
	S.insert(A[id[i]]);
	all += A[id[i]];
	if(S.size() > X) {
	    all -= *(S.begin());
	    S.erase(S.begin());
	}
	b[i] = all;
    }
    int64 tmp = f[Y] + b[Y + 1];
    for(int i = Y + 1; i <= Y + Z ; ++i) {
	tmp = max(tmp,f[i] + b[i + 1]);
    }
    out(ans + tmp);enter;
}
int main() {
#ifdef ivorysi
    freopen("f1.in","r",stdin);
#endif
    Solve();
    return 0;
}


Measured memory_bytes: 11904
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        final Scanner scanner = new Scanner(System.in);
        final int a = scanner.nextInt();
        final int b = scanner.nextInt();

        System.out.println(Math.max(a + b, Math.max(a - b, a * b)));
    }
}


Measured memory_bytes: 21844
import java.util.Scanner;

public class Main {

	static void print_ab( String str, int a, int b ) {
		System.out.println( str.substring( a, b+1 ) );
	}

	static String reverse_ab( String str, int a, int b ) {

		String rev_str = "";

		if ( a > 0 ) {
			rev_str = str.substring( 0, a );
		}

		for ( int i = b ; i > a-1 ; i-- ) {
			rev_str += str.charAt( i );
		}

		if ( b+1 < str.length() ) {
			rev_str += str.substring( b+1, str.length() );
		}

		return rev_str;
	}

	static String replace_ab( String str, int a, int b, String p_str ) {

		String rep_str = "";

		if ( a > 0 ) {
			rep_str = str.substring( 0, a );
		}

		rep_str += p_str;

		if ( b+1 < str.length() ) {
			rep_str += str.substring( b+1, str.length() );
		}

		return rep_str;
	}

	public static void main(String[] args) {

		int op_num = 0;
		int num1 = 0;
		int num2 = 0;

		String str = "";
		String p_str = "";
		String op = "";

		Scanner sc= new Scanner( System.in );

		str = sc.next();
		op_num = sc.nextInt();


		for ( int i = 0 ; i < op_num ; i++ ) {

			op = sc.next();

			switch(op) {
			case ("print"):
				num1 = sc.nextInt();
				num2 = sc.nextInt();
				print_ab( str, num1, num2 );
				break;
			case ("reverse"):
				num1 = sc.nextInt();
				num2 = sc.nextInt();
				str = reverse_ab( str, num1, num2 );
				break;
			case ("replace"):
				num1 = sc.nextInt();
				num2 = sc.nextInt();
				p_str = sc.next();
				str = replace_ab( str, num1, num2, p_str );
				break;
			}
		}
		sc.close();
	}
}


Measured memory_bytes: 61620
#include <iostream>
#include <vector>
#include <iomanip>
#include <cmath>
using namespace std;

////////////////////////////
// 基本要素 (点, 線分)
////////////////////////////

using DD = double;
const DD INF = 1LL<<35;      // to be set appropriately
const DD EPS = 1e-6;        // to be set appropriately
const DD PI = acos(-1.0);
DD torad(int deg) {return (DD)(deg) * PI / 180;}
DD todeg(DD ang) {return ang * 180 / PI;}

/* Point */
struct Point {
    DD x, y;
    Point(DD x = 0.0, DD y = 0.0) : x(x), y(y) {}
    friend ostream& operator << (ostream &s, const Point &p) {return s << '(' << p.x << ", " << p.y << ')';}
};
inline Point operator + (const Point &p, const Point &q) {return Point(p.x + q.x, p.y + q.y);}
inline Point operator - (const Point &p, const Point &q) {return Point(p.x - q.x, p.y - q.y);}
inline Point operator * (const Point &p, DD a) {return Point(p.x * a, p.y * a);}
inline Point operator * (DD a, const Point &p) {return Point(a * p.x, a * p.y);}
inline Point operator * (const Point &p, const Point &q) {return Point(p.x * q.x - p.y * q.y, p.x * q.y + p.y * q.x);}
inline Point operator / (const Point &p, DD a) {return Point(p.x / a, p.y / a);}
inline Point conj(const Point &p) {return Point(p.x, -p.y);}
inline Point rot(const Point &p, DD ang) {return Point(cos(ang) * p.x - sin(ang) * p.y, sin(ang) * p.x + cos(ang) * p.y);}
inline Point rot90(const Point &p) {return Point(-p.y, p.x);}
inline DD cross(const Point &p, const Point &q) {return p.x * q.y - p.y * q.x;}
inline DD dot(const Point &p, const Point &q) {return p.x * q.x + p.y * q.y;}
inline DD norm(const Point &p) {return dot(p, p);}
inline DD abs(const Point &p) {return sqrt(dot(p, p));}
inline DD amp(const Point &p) {DD res = atan2(p.y, p.x); if (res < 0) res += PI*2; return res;}
inline bool eq(const Point &p, const Point &q) {return abs(p - q) < EPS;}
inline bool operator < (const Point &p, const Point &q) {return (abs(p.x - q.x) > EPS ? p.x < q.x : p.y < q.y);}
inline bool operator > (const Point &p, const Point &q) {return (abs(p.x - q.x) > EPS ? p.x > q.x : p.y > q.y);}
inline Point operator / (const Point &p, const Point &q) {return p * conj(q) / norm(q);}


DD solve(int i, const vector<Point> &vp) {
    // vp[i] が原点に、辺 (vp[i], vp[i+1]) が x 軸上正の向きに来るように回転する
    int N = vp.size();
    Point p = vp[i];
    Point q = vp[(i+1) % N];
    DD th = atan2(q.y - p.y, q.x - p.x);
    vector<Point> nvp = vp;
    for (int i = 0; i < N; ++i) {
        nvp[i] = nvp[i] - p;
        nvp[i] = rot(nvp[i], -th);
    }

    // 各頂点から左右に 60 度の方向にビームを打つ
    DD mi = 0, ma = 0;
    for (int i = 0; i < N; ++i) {
        mi = min(mi, nvp[i].x - nvp[i].y / sqrt(3.0));
        ma = max(ma, nvp[i].x + nvp[i].y / sqrt(3.0));
    }
    return ma - mi;
}


int main() {
    int N; cin >> N;
    vector<Point> vp(N);
    for (int i = 0; i < N; ++i) cin >> vp[i].x >> vp[i].y;

    DD res = INF;
    for (int i = 0; i < N; ++i) res = min(res, solve(i, vp));
    cout << fixed << setprecision(10) << res << endl;
}



Measured memory_bytes: 3840
#include <string>
#include <vector>
#include <stdio.h>
#include <stdlib.h>
#include <unordered_map>
#include <iostream>
using namespace std;

vector<string>split(string s, char delim){
  int len = s.length();
  string currStr = "";
  vector<string>retVec;
  for(int i = 0;i<len;i++){
    char ch = s[i];
    if(ch==delim){
      retVec.push_back(currStr);
      currStr = "";
    }else{
      currStr += ch;
    }
  }
  retVec.push_back(currStr);
  return retVec;
}



vector<int>strToIntVec(string s){
  int len = s.length();
  //  s = s.substr(1,len-2);
    vector<string>strVec = split(s,' ');
  vector<int>retVec;
  for(int i=0;i<(int)strVec.size();i++){
    int el = atoi(strVec[i].c_str());
    retVec.push_back(el);
  }
  return retVec;
}

class Tag{
public:
  string canCatch(int a, int b, int v, int w, int t){
    string retS = "NO";
    if(v>w){
      int deltaS = v-w;
      int dis = abs(b-a);
      int timeReq = dis/deltaS;
      if((dis%deltaS)>0){
	timeReq++;
      }
      if(timeReq<=t){
	retS = "YES";
      }
    }
    return retS;
  }
};

int main(int argc, const char*argv[]){
  Tag tagObj;
  string avLn,bwLn,tLn;
  getline(cin,avLn);
  getline(cin,bwLn);
  getline(cin,tLn);
  vector<int>avVec = strToIntVec(avLn);
  vector<int>bwVec = strToIntVec(bwLn);
  int t = atoi(tLn.c_str());
  string poss = tagObj.canCatch(avVec[0],bwVec[0],avVec[1],bwVec[1],t);
  cout<<poss<<endl;
  return 0;
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(c) reverse((c).begin(),(c).end())
#define ALL(x) (x).begin(),(x).end()
const long long MOD = 1000000007;
const long long INF = 1LL << 60;

int main(){
	int N, L;
	cin >> N >> L;
	vector<string> S(N);
	rep(i,N)cin >> S[i];
	sort(ALL(S));
	rep(i, N)cout << S[i];
	cout << endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cassert>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <vector>
#include <sstream>
#include <set>
using namespace std;
using ll = long long;

class range {private: struct I{int x;int operator*(){return x;}bool operator!=(I& lhs){return x<lhs.x;}void operator++(){++x;}};I i,n;
public:range(int n):i({0}),n({n}){}range(int i,int n):i({i}),n({n}){}I& begin(){return i;}I& end(){return n;}};

const int MOD = 1000*1000*1000+7;
int add(int a, int b) { return ((ll)a+b)%MOD; }
int mul(int a, int b) { return ((ll)a*b)%MOD; }
void chadd(int& a, int b) { a = ((ll)a+b)%MOD; }

struct I {
  int lo, hi;
};
bool include(I i1, I i2) {
  return i1.lo <= i2.lo && i2.hi <= i1.hi;
}

int combin[3020][3020];
int dp[3020][3020];

int main() {
  combin[0][0] = 1;
  for (int i : range(1, 3010)) {
    combin[i][0] = combin[i][i] = 1;
    for (int j : range(1, i)) {
      combin[i][j] = (combin[i-1][j-1] + combin[i-1][j])%MOD;
    }
  }

  int N, M;
  while (cin >> N >> M) {
    string s; cin >> s;
    vector<I> vi(M), vi2;
    for (int i : range(M)) {
      cin >> vi[i].lo >> vi[i].hi;
      vi[i].lo--;
      vi[i].hi--;
    }
    vi2.push_back(I{-1, -1});
    // erase redundant elements
    for (int i : range(M)) {
      if (!include(vi2.back(), vi[i])) {
        vi2.push_back(vi[i]);
        // cout<<"##"<<endl;
      }
    }
    vi = vi2;
    M = vi.size();

    for (int i : range(M)) {
      //cout << "#" << vi[i].lo <<" " << vi[i].hi<<endl;
    }

    memset(dp, 0, sizeof(dp));
    dp[0][0] = 1;
    for (int i : range(1, M)) {
      int len = vi[i].hi + 1 - vi[i].lo;
      int l = (i < M - 1)
            ? (min(vi[i + 1].lo, vi[i].hi + 1) - vi[i].lo)
            : len;
      int m = max(vi[i - 1].hi - vi[i].lo + 1, 0);

      int t = 0;
      for (int j : range(len - m)) {
        t += s[vi[i].lo + m + j] - '0';
      }

      for (int ones : range(0, len - l + 1)) {
        for (int pones : range(max(0, ones - t), m + 1)) {
          // pones + t - ones >= 0
          if (pones + t - ones > l) break;

          int val = mul(dp[i - 1][pones], combin[l][pones + t - ones]);
          chadd(dp[i][ones], val);
        }
      }
    }
    
    int res = 0;
    for (int ones : range(N + 1)) chadd(res, dp[M - 1][ones]);
    cout << res << endl;
  }
}


Measured memory_bytes: 63616
def Insertion_Sort(a,n):
  for i in range(1,n+1):
    print(' '.join(map(str,a)))
    if n > i:
      temp = a[i]
      j = i - 1
      while j >= 0 and a[j] > temp:
        a[j+1] = a[j]
        j -= 1
      a[j+1] = temp


num = int(input())
s = list(map(int,input().split()))
Insertion_Sort(s,num)



Measured memory_bytes: 5604
//  RAKSHIT KADAM
//ALWAYS USE &IT FOR ITERATING USING AUTO ...
//USE COUNT(STARTING ADDRESS, ENDING ADRESS ,VALUE) FOR FINDING THE COUNT IN THE RESPECTIVE DATA STRUCTURE
//NOTE THAT MEMSET CANT ASSIGN A VALUE OF 10^18 IT WILL ASSIGN A LOWER VALUE THAN THAT!!!
 #include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
// #define ordered_set tree< int ,  null_type ,  less<int> ,  rb_tree_tag ,  tree_order_statistics_node_update>
#warning !!!check the size of arrayss!!!

// NUMERIC DEFINITIONS :
    #define INF 2000000000000000005
    #define MOD  1000000007
    #define newMOD  998244353
    #define MAX 300006
    #define pi 3.1415926535897932384626433832795
 #define ll long long
 #define int long long
 #define P(gg) for(auto rax:gg){cout<<rax<<" ";}cout<<endl;
 #define Need_for_speed(activated) ios_base :: sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)
 #define satisfy ll t; cin>> t; while(t--)
 #define inp(n) int n;cin >> n
 #define mp make_pair
 #define pb push_back
 #define endl "\n"
 #define x first
 #define y second
 #define fore(i,a,b) for(ll i=a;i<b;i++)
 #define forci(i,n) for(ll i=0;i<n;i++)
 #define vi vector<ll>
 #define Endl endl
 #define lb lower_bound
 #define ub upper_bound
#define pii pair<ll,ll>
 #define input freopen("input.txt", "r", stdin),freopen("output.txt", "w", stdout)
 #define time        cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
using namespace std;
//ll gcd(ll a, ll b){if (b == 0)return a;return gcd(b, a % b);}n..
//int power(int x, unsigned int y, unsigned int m){ if (y == 0) return 1;int p = power(x, y/2, m) % m;  p = (p * p) % m;                                                  return (y%2 == 0)? p : (x * p) % m;}
//ll modInverse(int a, int m){int g = gcd(a, m); { return power(a, m-2, m);}}

vi v[200005];
ll ans[200005];
ll vis[200005];
void solve()
{
    ll n,k;cin>>n>>k;
    for(ll i=1;i<=n;i++)
    {
        ll x;cin>>x;
        v[i].pb(x);
    }
    ll kk= 1;
    ll count=0;ll p=0;
    while(!vis[kk])
    {
        vis[kk]=1;kk=v[kk][0];
        count++;
        ans[count]=kk;
        p = kk;
    }
    if(k<=count)
    {
        cout<<ans[k]<<endl;
    }
    else
    {
        memset(vis,0,sizeof vis);
        memset(ans,0,sizeof ans);
        k-=count;count=0;
        
        while(!vis[p])
        {
            vis[p]=1;
            p  = v[p][0];
            ans[count++] = p;
           // cout<<count-1<<" "<<ans[count-1]<<endl;
        }
        k--;
        k%=count;
        cout<<ans[k]<<endl;
    }
    
}
signed main()
{
 
    Need_for_speed(activated);
//satisfy
//    {
//   solve();
//    }

 solve();
    return 0;
}



Measured memory_bytes: 17712
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;

public final class Main {

    public static void main(String[] args) {
        final Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        final int n = in.nextInt();
        final int k = in.nextInt();
        final int[] arr = new int[n];
        for (int i = 0; i < n; i++) {
            arr[i] = in.nextInt();
        }
        for (int i = k; i < n; i++) {
            if (arr[i - k] >= arr[i]) {
                System.out.println("No");
            } else {
                System.out.println("Yes");
            }
        }
    }
}


Measured memory_bytes: 60292
def main(n, xs):
    # type: (int, List[int]) -> None
    even = lambda x: x % 2 == 0 # type: Callable[[int],bool]
    allEven = lambda xs: all(map(even, xs)) # type: Callable[[Iterable[int]],bool]
    cnt = 0
    while allEven(xs):
        cnt = cnt + 1
        xs = list(map(lambda x: x // 2, xs))
    print(cnt)
    return

if __name__ == '__main__':
    # main(sys.argv[1:])
    n = int(input())
    xs = list(map(int, input().split()))
    main(n, xs)


Measured memory_bytes: 3060
#include<iostream>
#include<vector>
#include<string>
#include<array>
#include<cmath>
#include<algorithm>
#include<map>
#include<set>

int main()
{
long long int n, c, k;
std::vector<long long int> t;
std::cin >> n >> c >> k;
for(long long int i = 0; i < n; i++){
    long long int temp;
    std::cin >> temp;
    t.push_back(temp);
}
std::sort(t.begin(),t.end());
long long int count = 0;
long long int cbuf = 0;
long long int kpoint = t[0];
long long int kflag = 0;
for(long long int i = 0; i < n; i++){
    cbuf++;
    while(t[i] > kpoint + k || cbuf > c){
        if(t[i] > kpoint + k){
            count++;
            if(kflag + c > i){
                kflag = i;
            } else {
                kflag = kflag + c;
            }
            kpoint = t[kflag];
            cbuf = 1;
        } else if(cbuf > c){
            count++;
            cbuf = cbuf - c;
            kflag = kflag + c;
            kpoint = t[kflag];
        }
    }
}
count++;
std::cout << count << std::endl;
return 0;
}

Measured memory_bytes: 1400
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

/**
 * @author Pavel Mavrin
 */
public class Main {

    private void solve() throws IOException {
        int n = nextInt();
        long a = nextInt();
        long b = nextInt();
        long c = nextInt();
        long d = nextInt();
        for (int i = 0; i < n; i++) {
            int j = n - 1 - i;
            long max = Math.min(a + d * i, b + d * j);
            long min = Math.max(a + c * i, b + c * j);
            if (max >= min) {
                out.println("YES");
                return;
            }
        }
        out.println("NO");
    }

    // ------------------

    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    StringTokenizer st;
    PrintWriter out = new PrintWriter(System.out);

    String next() throws IOException {
        while (st == null || !st.hasMoreTokens()) {
            st = new StringTokenizer(br.readLine());
        }
        return st.nextToken();
    }

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

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

    private void run() throws IOException {
        solve();
        out.close();
    }

}


Measured memory_bytes: 23380
#include <stdio.h>

int main () {
	long long int n, sum = 0;
	scanf("%lld", &n);
	for(int i = 1; i <= n; i++) {
		if(i % 3 != 0 && i % 5 != 0) {
			sum += i;
		}
	}
	printf("%lld", sum);
	
	
	return 0;
}

Measured memory_bytes: 1732
#include<iostream>
#include<algorithm>
#include<vector>
#include<functional>
#include<string>
#include<cmath>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<cstdio>
using namespace std;
using ll = long long;
int main(){
  int a, b;
  char c;
  cin >> a >> c >> b;
  if(c == '+'){
    cout << a + b << endl;
  }else{
    cout << a - b << endl;
  }

  return 0;
}

Measured memory_bytes: 256
from operator import itemgetter

n, m = map(int, input().split())
ab = []
for _ in range(m):
    ab.append(list(map(int, input().split())))
abs = sorted(ab, key=itemgetter(1))
las = abs[0][1]
count = 1
for i in range(1, m):
    if las - 1 < abs[i][0]:
        las = abs[i][1]
        count += 1
print(count)

Measured memory_bytes: 29920
#include <bits/stdc++.h>
#define f(i,a,b) for(int i=a;i<b;i++)
using namespace std;
int X[4]={1,0,-1,0};
int Y[4]={0,1,0,-1};
const int m=501;
int n;
int near[m][m];
int visited[m][m];
void dfs(int x_val, int y_val, int visited[][501], int near[][501]){
	if(x_val>=0 and y_val>=0 and x_val<=n and y_val<=n){
		int z=visited[x_val][y_val]+near[x_val][y_val];
		f(i,0,4){
			int x=X[i]+x_val;
			int y=Y[i]+y_val;
			if(x>=0 and y>=0 and x<=n and y<=n and z<near[x][y]){
				near[x][y]=z;
				dfs(x,y,visited,near);
			}
		}
	}
}
int main(){
	#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    cin>>n;
    // vector<vector<int>> near(n+1,vector<int> (n+1,0));
    // vector<vector<int>> visited(n+1,vector<int> (n+1,1));
    f(i,1,n+1){
    	f(j,1,n+1){
    		near[i][j]=min(min(i,n-i+1),min(j,n-j+1))-1;
    		visited[i][j]=1;
    	}
    }
    int ans=0;
    for (int it = 0; it < n*n; it++){
        int value;cin >> value;
        int x = (value+n-1)/n;
        int y = value % n;
        if (y == 0) y += n;
        ans += near[x][y];
        visited[x][y] = 0;
        dfs(x, y, visited, near);
    }
    cout<<ans<<"\n";
	return 0;
}

Measured memory_bytes: 24868
import sys
input = lambda : sys.stdin.readline().rstrip()

import sys
sys.setrecursionlimit(max(1000, 10**9))


s = int(input())
x1, y1 = 0, 0
# k : k*k <= sである最大のk
k = int(s**0.5) - 2
while k<0 or k*k<s:
    k += 1
k -= 1

if k*k==s:
    x2, y3 = k, k
    x3, y2 = 0, 0
elif k*(k+1)>=s:
    x2, y3 = k, k+1
    x3, y2 = 1, (x2*y3 - s)
else:
    x2, y3 = k+1, k+1
    x3, y2 = 1, (x2*y3 - s)
print(" ".join(map(lambda x: str(int(x)), [x1, y1, x2, y2, x3, y3])))

Measured memory_bytes: 38384
#include <bits/stdc++.h>
#define f first
#define s second
#define mp make_pair
#define pb push_back
#define lp(i,a,n) for(int i=a;i<=n;++i)
#define lpd(i,a,n) for(int i=a;i>=n;--i)
#define mem(a,b) memset(a,b,sizeof a)
#define all(v) v.begin(),v.end()
#define println(a) cout <<(a) <<endl
#define sz(x) ((int)(x).size())
#define readi(x) scanf("%d",&x)
#define read2i(x,y) scanf("%d%d",&x,&y)
#define read3i(x,y,z) scanf("%d%d%d",&x,&y,&z)
#define mod 1000000007
#define eps 1e-9
#define infi 1000000000
#define infll 1000000000000000000ll
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef set<int> si;
typedef map<int,int> mii;

const int N = 100002;
int t,n,a[N];

int main(){
    readi(n);
    lp(i,1,n) readi(a[i]);
    int mx = *max_element(a+1, a+1+n);
    int sum = accumulate(a+1, a+1+n, 0) - mx;
    if(mx < sum) cout <<"Yes";
    else cout <<"No";
}

/*
uniform_int_distribution<type>(l, r)(rng)
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
*/


Measured memory_bytes: 256
import java.util.*;

public class Main{
  public static int mod=1000000007;
  public static long dp[];
  public static long func(int s,int sum)
  {
    if(sum>s)
    return 0;
    if(sum==s)
    return 1;
    if(dp[sum]!=-1)
    return dp[sum];
    long ans=0;
    for(int i=3;i<=s;i++)
    {
      ans+=func(s,sum+i)%mod;
    }
    return dp[sum]=ans%mod;
  }
  public static void main(String[] args)
  {
    Scanner sc=new Scanner(System.in);
    int s=sc.nextInt();
    dp=new long[s+1];
    for(int i=0;i<=s;i++)
    dp[i]=-1;
    System.out.println(func(s,0));
  }
}


Measured memory_bytes: 35700
#include<iostream>
#include<string>
#include<vector>
#include<utility>
#include<queue>
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<complex>
#define INF 2147483647
#define llINF 9223372036854775807
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long

using namespace std;
int main(){
  int n,t;
  while(cin>>t>>n,n+t){
    bool Map[200][200]={};
    bool Map2[200][200]={};

    for(int i=0;i<n;i++){
      int a,b;cin>>a>>b;
      Map2[a+100][b+100]=true;
    }
    int aa,bb;cin>>aa>>bb;
    Map[aa+100][bb+100]=true;
    int ans=0;
    int vx[6]={1,0,-1,0,1,-1};
    int vy[6]={0,-1,0,1,1,-1};
    queue<pair<pair<int,int>,int> >que;
    que.push(mp(mp(aa+100,bb+100),0));
    while(!que.empty()){
      pair<pair<int,int>,int >now=que.front();
      que.pop();
      //cout<<now.F.F<<" "<<now.F.S<<endl;
      if(now.S>=t)break;;
      for(int i=0;i<6;i++){
	int x=now.F.F+vx[i],y=now.F.S+vy[i];
	if(Map[x][y]==false&&Map2[x][y]==false){
	  Map[x][y]=true;
	  que.push(mp(mp(x,y),now.S+1));
	}
      }
    }
    for(int i=0;i<200;i++)
      for(int j=0;j<200;j++)
	if(Map[i][j])
	  ans++;
    cout<<ans<<endl;
  }
  return 0;
}



Measured memory_bytes: 3236
S = input()

odd = ["R","U","D"]
even = ["L","U","D"]

flg = 0
for i in range(len(S)):
    if i % 2 == 1:
        if not S[i] in even:
            flg = 1
    else:
        if not S[i] in odd:
            flg = 1

print("Yes" if flg ==0 else "No")
        

Measured memory_bytes: 2940
#include<stdio.h>
int main(void){
    int a, b, c,d;
    scanf("%d",&a);
    scanf("%d",&b);
    scanf("%d",&c);
    d = 0;
    if(a -c ==0){
        d = b;
    }else if(b-c==0){
        d = a;
    }else if(a-b==0){
        d = c;
    }else{
    }
    printf("%d",d);
    return 0;
}

Measured memory_bytes: 128
import math
x=int(input())
if x<4:
    print(1)
else:
    buf=0
    while buf==0 and x>1:
        r=int(math.sqrt(x))
        for i in range(2,r+1):
            ans=1
            while ans<x:
                ans*=i
            if ans==x:
                buf=1
                break
        if buf==0:
            x-=1
    print(x)

Measured memory_bytes: 3060
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <string>
#include <map>

#define ll long long
#define REP(i,n) for(int i = 0; i < n; i++)
#define PI 3.141592653589
#define MOD 1000000007

using namespace std;

template<typename T> T gcd(T a, T b){return (a % b)? gcd(b, a % b) : b;}
template<typename T> T lcm(T a, T b){return a * b / gcd(a, b);}

void solve_126C(){
    int n, k;
    cin >> n >> k;

    double ans = 0;
    for(int i = 1; i <= n; i++){
        if(i < k){
            int power = 0;
            int now = i;
            while(1){
                now *= 2;
                power++;
                if(now >= k) break;
            }
            ans += pow(0.5, power);
        } else ans += 1.0;
    }
    printf("%.10f\n", ans/n);
}

int main(void){
    solve_126C();
    
    return 0;
}

Measured memory_bytes: 384
#include<iostream>
#include<cmath>

using namespace std;

int main() {
  double a, b;
  cin >> a >> b;
  int c(ceil(a / 0.08 - 0.000001)), d(ceil(b * 10-0.000001));
  int e = max(c, d);
  if (int(e * 0.08) == a && int(e * 0.1) == b)cout << e << endl;
  //cout << c<< ' ' << d << endl;
  else cout << -1 << '\n';
  //else 
	return 0;
}

Measured memory_bytes: 256
M,D=map(int, input().split())
a=0
for i in range(1,M+1):
  for j in range(1,D+1):
    if len(str(j))==2:
      if int(str(j)[0])>=2 and int(str(j)[1])>=2 and int(str(j)[0])*int(str(j)[1])==i:
        a+=1

print(a)

Measured memory_bytes: 3060
N = gets.to_i
A = gets.split.map(&:to_i)

ans = 0

until A.empty?
  v = A.first

  u = 1
  uf = true
  d = 1
  df = true

  A[1..-1].each do |a|
    break if !uf && !df

    if v <= a && uf
      u += 1
    else
      uf = false
    end

    if v >= a && df
      d += 1
    else
      df = false
    end

    v = a
  end

  A.shift([u, d].max)
  ans += 1
end

puts ans


Measured memory_bytes: 11012
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int r, D, x;
  cin >> r >> D >> x;
  vector<int> a(11);
  a.at(0) = x;
  for (int i = 0; i < 10; i++) {
    a.at(i + 1) = r * a.at(i) - D;
    cout << a.at(i + 1) << endl;
  }
}

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


#define li          long long int
#define rep(i,to)   for(li i=0;i<((li)(to));i++)
#define repp(i,start,to)    for(li i=(li)(start);i<((li)(to));i++)
#define pb          push_back
#define sz(v)       ((li)(v).size())
#define bgn(v)      ((v).begin())
#define eend(v)     ((v).end())
#define allof(v)    (v).begin(), (v).end()
#define dodp(v,n)       memset(v,(li)n,sizeof(v))
#define bit(n)      (1ll<<(li)(n))
#define mp(a,b)     make_pair(a,b)
#define rin rep(i,n)
#define EPS 1e-12
#define ETOL 1e-8
#define MOD 1000000007
typedef pair<li, li> PI;

#define INF bit(60)

#define DBGP 1


#define idp if(DBGP)
#define F first
#define S second
#define p2(a,b)     idp cout<<a<<"\t"<<b<<endl
#define p3(a,b,c)       idp cout<<a<<"\t"<<b<<"\t"<<c<<endl
#define p4(a,b,c,d)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<endl
#define p5(a,b,c,d,e)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<endl
#define p6(a,b,c,d,e,f)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<endl
#define p7(a,b,c,d,e,f,g)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<endl
#define p8(a,b,c,d,e,f,g,h)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<endl
#define p9(a,b,c,d,e,f,g,h,i)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<endl
#define p10(a,b,c,d,e,f,g,h,i,j)        idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<"\t"<<j<<endl
#define foreach(it,v)   for(__typeof((v).begin()) it=(v).begin(); it!=(v).end(); ++it)
#define p2p(x)      idp p2((x).F, (x).S)
#define dump(x,n)   idp{rep(i,n){cout<<x[i]<<" ";}puts("");}
#define dump2(x,n)  idp{rep(i,n){cout<<"["<<x[i].F<<" , "<<x[i].S<<"] ";}puts("");}
#define dumpi(x)    idp{foreach(it, x){cout<<(*it)<<" ";}puts("");}
#define dumpi2(x)   idp{foreach(it, x){cout<<"["<<(it)->F<<" , "<<(it)->S<<"] ";}puts("");}

#define read2d(a,w,h)   rep(i,h)rep(j,w)cin>>a[i][j]
#define dump2d(a,w,h)   rep(i,h){rep(j,w)cout<<a[i][j]<<" ";puts("");}

typedef pair<li, li> PI;

li a, b, c, x;

int main() {
    cin >> a >> b >> c >> x;
    li res = 0;
    rep(i500, a + 1) {
        rep(i100, b + 1) {
            rep(i50, c + 1) {
                if (i500 * 500 + i100 * 100 + i50 * 50 == x) {
                    res++;
                }
            }
        }
    }
    cout << res << endl;
    return 0;
}

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

int main(void) {
  ll N, K;
  cin >> N >> K;
  ll A[N+1];
  for (ll i = 1; i <= N; i++)
    cin >> A[i];
  for (ll i = K+1; i <= N; i++) { //K, K+1...K-2,K-1,K vs K-1,K,K+1 ... K-2 vs K+1
    if (A[i-K] < A[i]) cout << "Yes" << endl;
    else cout << "No" << endl;
  }
}

Measured memory_bytes: 5176
#include <bits/stdc++.h> 
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define size_of_array(array) (sizeof(array)/sizeof(array[0]))
#define MAX 100005
#define NIL -1
using ll =long long;
using namespace std;
using Graph=vector<vector<int>>;
using Field=vector<vector<int>>;

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

const double PI=(acos(-1));

int main(){
    int n,m;
    cin>>n>>m;
    vector<int> x(m);
    rep(i,m)cin>>x[i];
    vector<int> diff(m-1);
    if(n>=m){
        cout<<0<<endl;
        return 0;
    }else{
        sort(x.begin(),x.end());
        rep(i,m-1){
            diff[i]=x[i+1]-x[i];
        }
        sort(diff.begin(),diff.end());
        int ans=x[m-1]-x[0];
        rep(i,n-1){
            //cout<<diff[m-2-i]<<" ";
            ans-=diff[m-2-i];
        }
        cout<<ans<<endl;
        return 0;
    }
}


Measured memory_bytes: 4016
from operator import itemgetter

n, m = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(m)]

cd = sorted(ab, key=itemgetter(1))
#print(cd)
removed = -1
ans = 0

for a, b in cd:
  if a > removed:
    removed = b - 1
    ans += 1
    
print(ans)

Measured memory_bytes: 29456
#include <bits/stdc++.h>
using namespace std;
long long int N,H[100000];
int main(){
    cin >> N;
    for (int i=0;i<N;i++) cin >> H[i];
    int c,m;
    for (int i=0;i<N-1;i++){
        if (H[i]>=H[i+1]){
            c++;
            if (c>m) m=c;
        }
        else c=0;
    }
    cout << m << endl;
}

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

int main(){
    int x,y;
    cin >>x>>y;
    int g[] = {0,1,3,1,2,1,2,1,1,2,1,2,1};
    cout << (g[x]==g[y] ? "Yes":"No") << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <iomanip>
#include <limits>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;

int main() {
    int N,M;
    cin >> N;
    string s[N];
    for(int i=0;i<N;i++){
        cin >> s[i];
    }
    cin >> M;
    string t[M];
    for(int i=0;i<M;i++){
        cin >> t[i];
    }
 
    int i;
    int ans=0;
    int score[100] = {0};
    for(int i=0;i<N;i++){
        for(int j=0;j<N;j++){
            if(s[i] == s[j]) score[i]++;
        }
        for(int k=0;k<M;k++){
            if(s[i] == t[k]) score[i]--;
        }
        ans = max(score[i],ans);
    }
    
    cout << ans << endl;
}

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

int main(){
  
  int n;
  
  cin >> n;
  if(!n) cout << "-1";
  int m = sqrt(n);
  
  int i;
  for(i = m;i<=n;i++){
    if(n%i==0) break;
  }
  if(i<=9&&n/i<=9) cout << "Yes";
  else cout << "No";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  char c;
  cin >> c;

  if(c >= 'a' && c <= 'z'){
    cout << "a" << endl;
  }else if(c >= 'A' && c <= 'Z'){
    cout << "A" << endl;
  }

  return 0;
}

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

typedef long long int ll;
#define T int t,q; scanf("%d",&t); for(q=1;q<=t;q++)

int main(){
	ll a,b,n;
	cin >> a >> b >> n;
	ll x=n/b;
	x*=b;
	x-=1;
	x=min(x,n);
	n=min(b-1,n);
		ll ans=floor((a*n)/b)-a*(n/b);
	cout << ans << endl;
	return 0;
}

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

using namespace std;
typedef long long ll;
typedef pair<int, int> i_i;
typedef pair<ll, ll> l_l;
#define EPS (1e-7)
#define INF 1000000000
#define int ll
#define PI (acos(-1))
//const ll mod = 1000000007;

int n, m, p;
int a, b, c;

struct edge {
    int from, to, cost;
};

vector<edge> edges; // 辺
vector<int> d(2510);  // 最短距離[頂点の最大数]
int V;     // V:頂点数

void shortest_path(int start) {
    // 初期化
    fill(d.begin(), d.end(), INF);
    d[start] = 0;

    // BellmanFord
    for (int i = 0; i < V - 1; i++) {
        for (auto &e:edges) {
            if (d[e.from] != INF && d[e.to] > d[e.from] + e.cost) d[e.to] = d[e.from] + e.cost;
        }
    }

    // 負の閉路の発見
    for (auto &e:edges) {
        if (d[e.from] != INF && d[e.to] > d[e.from] + e.cost) d[e.to] = -INF;
    }

    // 負の閉路の伝播(-INFは発散)
    for (int i = 0; i < V - 1; i++) {
        for (auto &e:edges) {
            if (d[e.from] == -INF) d[e.to] = -INF;
        }
    }
}

signed main() {
    cin >> n >> m >> p;
    for (int i = 0; i < m; i++) {
        cin >> a >> b >> c;
        edges.emplace_back(edge{a, b, p - c});
    }

    V = n;
    shortest_path(1);

    if (d[n] == -INF) cout << -1 << endl;
    else cout << max(-d[n], 0LL) << endl;

}

// グラフ
// コスト最大化(ベルマンフォード)

Measured memory_bytes: 576
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin>>n;
  vector<int> b(100000,0);
  for(int i=0;i<n;i++){
    int a;
    cin>>a;
    b.at(a)++;
  }
  int m=0;
  for(int i=0;i<100000;i++)
    m=max(m,(i>0?b.at(i-1):0)+b.at(i)+(i<n-1?b.at(i+1):0));
  cout<<m<<endl;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define rrep(i,n) RREP(i,n-1,0)
#define all(v) v.begin(), v.end()
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;
const ld eps = 1e-10;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int h, w, k; cin >> h >> w >> k;
  int sx, sy, tx, ty; cin >> sx >> sy >> tx >> ty;
  sx--; sy--; tx--; ty--;
  vector<string> S(h); rep(i, h) cin >> S[i];
  priority_queue<pair<ll, int>, vector<pair<ll, int>>, greater<pair<ll, int>>> q;
  int dx[] = {-1, 0, 1, 0};
  int dy[] = {0, 1, 0, -1};
  vector<bool> vis(h*w*4);
  vector<ll> D(h*w*4, longinf);
  rep(k, 4) {
    int id = (sx*w+sy)*4+k;
    D[id] = 0;
    q.push({0, id});
  }
  while(!q.empty()) {
    auto ele = q.top(); q.pop();
    ll dist = ele.first;
    int id = ele.second;
    int x = id/4/w;
    int y = id/4%w;
    int d = id%4;
    if(vis[id]) continue;
    if(D[id] != dist) continue;
    vis[id] = true;
    rep(i, 4) {
      int ne = (x*w+y)*4+i;
      if(D[ne] > (dist+k-1)/k*k) {
        D[ne] = (dist+k-1)/k*k;
        q.push({D[ne], ne});
      }
    }
    {
      int nx = x+dx[d];
      int ny = y+dy[d];
      if(nx < 0 || nx >= h || ny < 0 || ny >= w) continue;
      if(S[nx][ny] == '@') continue;
      int ne = (nx*w+ny)*4+d;
      if(D[ne] > dist+1) {
        D[ne] = dist+1;
        q.push({D[ne], ne});
      }
    }
  }
  ll mn = longinf;
  rep(i, 4) {
    int id = (tx*w+ty)*4+i;
    mn = min(D[id], mn);
  }
  cout << (mn == longinf ? -1 : (mn+k-1)/k) << "\n";
  return 0;
}


Measured memory_bytes: 44508
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <cstring>
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <cmath>
#include <numeric>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef unsigned long long ll;


int main(){
int N,T ; cin >> N >> T;
vector<int> t(N);
rep(i,N) cin >> t[i];
int sum = T;
rep(i,N-1){
	if(t[i+1]-t[i] >= T){
		sum+=T;
	}
	else sum+=t[i+1]-t[i];
}
cout << sum << endl;
}

Measured memory_bytes: 1024
#include<stdio.h>
int main()
{
	char a;
	scanf("%c",&a);
	if(a=='A'||a=='B'||a=='C'||a=='D'||a=='E'||a=='F'||a=='G'||a=='H'||a=='I'||a=='J'||a=='K'||a=='L'||a=='M'||a=='N'||a=='O'||a=='P'||a=='Q'||a=='R'||a=='S'||a=='T'||a=='U'||a=='W'||a=='V'||a=='X'||a=='Y'||a=='Z'){
		printf("A\n");
	}
	else printf("a\n");
	return 0;
}


Measured memory_bytes: 1596
import java.util.Scanner;

public class Main {


    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        final int n = sc.nextInt();
        final int m = sc.nextInt();
        sc.nextLine();
        String first = sc.nextLine();
        String second = sc.nextLine();
        if (first.charAt(0) != second.charAt(0)) {
            System.out.println(-1);
            return;
        }
        final long lcm = lcm(n, m);


        final long result;
        if (n < m) {
            result = check(first, second, lcm);
        } else {
            result = check(second, first, lcm);
        }
        System.out.println(result);
    }

    private static long check(String a, String b, long lcm) {
        final long al = lcm / a.length();
        final long bl = lcm / b.length();
        for (int i = 0; i < a.length(); i++) {
            final char c1 = a.charAt(i);
            final long i1 = al * i;
            if (i1 % bl == 0 && b.charAt((int) (i1 / bl)) != c1) {
                return -1;
            }
        }
        return lcm;
    }

    private static long gcd(long a, long b) {
        return a % b == 0 ? b : gcd(b, a % b);
    }

    private static long lcm(long a, long b) {
        return a * b / gcd(a, b);
    }
}


Measured memory_bytes: 27316
#include <iostream>
#include <numeric>
#include <algorithm>
#include <vector>

int main()
{
    char a;
    std::cin >> a;
    if ('a' <= a && a <= 'z') {
        std::cout << 'a';
    }
    else {
        std::cout << 'A';
    }

    return 0;
}


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

vector<unsigned long long> next_p_mod(unsigned N, long long mod) { //next_permutation
  vector<unsigned long long> Next_p(N);
  unsigned long long Next_p_buff = 1;
  for (int i = 0; i < N; i++)
  {
    Next_p_buff *= (i + 1) % mod;
    Next_p.at(i) = Next_p_buff % mod;
  }
  return Next_p;
}
unsigned long long modpow(unsigned long long a, unsigned long long n, unsigned long long mod) {
   unsigned long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
void comb(vector<vector <long long int> > &v,unsigned long long mod) {
  //vector<入れたい型> v(配列の個数(x),vector<入れたい型> (配列の個数,初期値));
  for (int i = 0; i < v.size(); i++) {
    v[i][0] = 1;
    v[i][i] = 1;
  }
  for (int k = 1; k < v.size(); k++) {
    for (int j = 1; j < k; j++) {
      v[k][j] = (v[k - 1][j - 1] + v[k - 1][j])%mod;
    }
  }
}
// a^{-1} mod を計算する
unsigned long long modinv(unsigned long long a, unsigned long long mod) {
    return modpow(a, mod - 2, mod);
}


int main() {
  string S;
  bool flag=0;
  cin >> S;
  for(int i=0;i<S.size()-1;i++){
    if(S.at(i)==S.at(i+1)){
    cout<<"Bad"<<endl;
      flag=1;
      break;
    }
  }
  if(flag!=1){
    cout<<"Good"<<endl;
  }
  return 0;
}


Measured memory_bytes: 256
import collections
#n = (int(i) for i in input().split())  
n=int(input())
prime = [2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101]
num=[1] * n
count = 0
for i in range(0,n):
    S = input()
    for s in S:
        num[i] = num[i] * prime[ord(s)-97]
#    for j in range(0,i):
#        if num[i] == num[j]:
#            count = count + 1
c = collections.Counter(num)
for v in c.values():
    if v > 1:
        count = count + v*(v-1)/2
#print(c)
print(int(count))

Measured memory_bytes: 17404