akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
//#include <iomanip>
//#include <algorithm>
//#include <numeric>
//#include <queue>
//#include <stack>
//#include <math.h>
//#include <vector>
#include <string>
typedef long long LL;
using namespace std;

LL gcd(LL a, LL b){
    LL tmp; 
    if(a<b){
        tmp = a;
        a = b;
        b = tmp;
    }
    tmp = a%b;
    while(tmp!=0){
        a = b;
        b = tmp;
        tmp = a%b;
    }

    return b;
}

int main(){
    LL a;
    LL b;
    LL ans;

    cin >> a >> b;
    ans = a*b/gcd(a,b);
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(long long i=0; i<(long long)(n); i++)
#define REP(i, k, n) for(long long i=(long long)(k); i<(long long)(n); i++)
#define all(a) (a).begin(), (a).end()
#define pb push_back
#define PQ(T) priority_queue<T>
#define PQS(T) priority_queue<T, vector<T>, greater<T> >
#define deci cout << fixed << setprecision(15);
typedef long long ll;
const int INF = INT_MAX;
const ll inf = 1e18;
const ll mod = 1e9 + 7;
typedef pair<ll, ll> P;
typedef pair<ll, P> PP;
template<class T> bool chmin(T&x,T y){if(x>y){x=y;return true;}return false;}
template<class T> bool chmax(T&x,T y){if(x<y){x=y;return true;}return false;}
ll gcd(ll x, ll y){ if(x>y) swap(x, y);while(x!=0){ y%=x; swap(x, y); }return y; }
ll mpow(ll x, ll r){if(r==0) return 1;if(r%2==1){ return x*mpow(x, r-1)%mod; }else{ ll aa = mpow(x, r/2); return aa*aa%mod; }}

int main(){
	ll ans = 1e9;
	int N, M, X; cin >> N >> M >> X;
	int C[N], A[N][M];
	rep(i, N){
		cin >> C[i];
		rep(j, M) cin >> A[i][j];
	}
	for(int bit=0; bit<(1<<N); bit++){
		ll cnt = 0;
		vector<int> num(M, 0);
		rep(i, N){
			if(bit & (1<<i)){
				cnt += C[i];
				rep(j, M){
					num[j] += A[i][j];
				}
			}
		}
		int f = 1;
		rep(i, M){
			if(num[i] < X) f = 0;
		}
		if(f) chmin(ans, cnt);
	}
	if(ans == 1e9) cout << -1 << endl;
	else cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3644
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <string>
#include <iomanip>
#include <algorithm>
#include <cmath>

using namespace std;

int main() {
    int n;
    cin >> n;
    vector <int> p(n+1);
    for (int i = 1; i <= n; ++i) {
        cin >> p[i];
    }

    bool can = true;
    int cnt = 0;
    for (int i = 1; i <=n ; ++i) {
        if (p[i] == i) {
            continue;
        }
        if (p[p[i]] != i) {
            can = false;
        }
        if (cnt > 1) can = false;
        cnt++;
    }
    if (can) cout << "YES" << endl;
    else cout << "NO" << endl;
    return 0;
}



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

#define ll long long
#define rep(i, n) for(int i = 0; i < n; i++)
#define rrep(i, n) for(int i = 1; i <= n; i++)
#define drep(i, n) for(int i = n-1; i >= 0; i--)
#define srep(i, s, t) for (int i = s; i < t; i++)
#define vi vector<int>
#define P pair<ll, ll>
using namespace std;
int mod = 1'000'000'000 + 7;
struct edge {
    int to;
    ll cost;
};

void COME_LET_THE_GAMES_BEGIN() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << setprecision(20);
}

int N, M;
int X[50];

int main() {
    COME_LET_THE_GAMES_BEGIN();
    cin >> N >> M;
    rep(i, N) {
        int K;
        cin >> K;
        rep(j, K) {
            int A;
            cin >> A;
            X[A]++;
        }
    }
    int ans = 0;
    for (int i = 0; i < 50; i++) {
        if (X[i] == N)ans++;
    }
    cout << ans << endl;
}

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

using namespace std;

int main() {

	ios::sync_with_stdio(0);
	cin.tie(0);

	int n, k;
	cin >> n >> k;

	vector<int> a(n);

	for(int i = 0; i < n; i++) {
		cin >> a[i];
	}

	// double wdw = 1;

	// for(int i = 0; i < k; i++) {
	// 	wdw *= (1.0 * a[i]);
	// }

	// cout << wdw << '\n';

	for(int i = k; i < n; i++) {
		// double prev = wdw;
		// wdw = (wdw * a[i]) / a[i - k];
		// cout << wdw << '\n';


		if(a[i] > a[i-k]) {
			cout << "Yes\n";
		}else{
			cout << "No\n";
		}
	}

	return 0;
}

Measured memory_bytes: 3964
#include <bits/stdc++.h>
using namespace std;
template <class T> inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T> inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return 1;
    }
    return 0;
}
typedef long long int ll;

#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define endl "\n"
const double EPS = 1e-7;
const int INF = 1 << 30;
const ll LLINF = 1LL << 60;
const double PI = acos(-1);
const int MOD = 1000000007;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

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

int toi(string s) {
    int res = 0;
    for(int i = 0; i < s.size(); i++) {
        if(s[i] == 'm') {
            if(i == 0) {
                res += 1000;
            } else {
                res += 1000 * (s[i - 1] - '0');
            }
        } else if(s[i] == 'c') {
            if(i == 0 || s[i - 1] == 'm') {
                res += 100;
            } else {
                res += 100 * (s[i - 1] - '0');
            }
        } else if(s[i] == 'x') {
            if(i == 0 || (s[i - 1] == 'c' || s[i - 1] == 'm')) {
                res += 10;
            } else {
                res += 10 * (s[i - 1] - '0');
            }
        } else if(s[i] == 'i') {
            if(i == 0 ||
               (s[i - 1] == 'x' || s[i - 1] == 'c' || s[i - 1] == 'm')) {
                res += 1;
            } else {
                res += 1 * (s[i - 1] - '0');
            }
        }
    }
    return res;
}

string tos(int n) {
    string res = "";
    int c = n / 1000;
    if(c == 1) {
        res += "m";
    } else if(c > 1) {
        res += to_string(c) + "m";
    }
    n -= 1000 * c;
    c = n / 100;
    if(c == 1) {
        res += "c";
    } else if(c > 1) {
        res += to_string(c) + "c";
    }
    n -= 100 * c;
    c = n / 10;
    if(c == 1) {
        res += "x";
    } else if(c > 1) {
        res += to_string(c) + "x";
    }
    n -= 10 * c;
    c = n / 1;
    if(c == 1) {
        res += "i";
    } else if(c > 1) {
        res += to_string(c) + "i";
    }
    return res;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int t;
    cin >> t;
    while(t--) {
        string s, t;
        cin >> s >> t;
        cout << tos(toi(s) + toi(t)) << endl;
    }
}


Measured memory_bytes: 3144
#include <iostream>
#include <algorithm>
#include <cstring>
#include <string>
#include <cmath>
#include <vector>
#define ll long long
#define si(n) scanf("%d",&n)
#define sl(n) scanf("%lld",&n)
#define pi(n) prllf("%d",n)
#define pl(n) prllf("%d",n)
using namespace std;

int main(){
  string s;
  cin >> s;
  int cnt = 0;
  for(int i=0;i<s.length();i++){
    if(s[i]=='1')
      cnt++;
  }
  cout << cnt << endl;
}


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

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

    if(n % 2 == 0) {
        cout << n / 2 << endl;
    } else {
        cout << ((n - 1) / 2) + 1 << endl;
    }

    return 0;
}


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

int n,m;
int G[100][100];

int visited[100];
int used[10000];

bool dfs(int pos,int a,int b){
  if( pos == 0 && a == n && b == m ){
    return true;
  }
  
  for(int i=0;i<n;i++){
    int id=G[pos][i];
    if( id < 0 )continue;
    if( used[id] )continue;
    used[id]=1;
    int na=a;
    if( visited[i]==0 )na++;
    visited[i]=1;
    if( dfs(i,na,b+1) )return true;
    else return false;
  }
  
  for(int i=0;i<n;i++){
    int id=G[pos][i];
    if( id != -1 )continue;
    G[pos][i]=-2;
    G[i][pos]=-2;
    int na=a;
    if( visited[i]==0 )na++;
    visited[i]=1;
    if( dfs(i,na,b) )return true;
    else return false;
  }

  return false;
}

int main(){
  memset( G, -1, sizeof(G) );
  
  cin>>n>>m;
  for(int i=0;i<m;i++){
    int a,b;
    cin>>a>>b;
    a--,b--;
    G[a][b]=i;
    G[b][a]=i;
  }

  bool ans = dfs(0,0,0);
  if( !ans ){
    cout<<-1<<endl;
    return 0;
  }

  vector<int> va,vb;
  
  for(int i=0;i<n;i++){
    for(int j=i+1;j<n;j++){
      if( G[i][j]==-2 ){
        va.push_back(i);
        vb.push_back(j);
      }
    }
  }
  cout<<va.size()<<endl;
  for(int i=0;i<(int)va.size();i++){
    cout<<va[i]+1<<' '<<vb[i]+1<<endl;
  }
  return 0;
}



Measured memory_bytes: 3260
#include <stdio.h>

int main(){
  int K,A,B;
  scanf("%d %d %d",&K,&A,&B);
  
  int L=A;
  int sw=0;
  
  while(L<=B){
    if(L%K==0){
      sw=1;
  }
  L=L+1;
  }
    
  if(sw==1){
    printf("OK\n");
  }else{
    printf("NG\n");
  }
  return 0;
}

Measured memory_bytes: 1624
import java.util.Scanner;

class Main{
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);

		long moto=sc.nextLong();
		long max=sc.nextLong();

		long wari=max/moto;
		long base=1;
		long suu=1;

		while(true) {
			if(wari<2) {
				break;
			}
			else {
				wari=wari/2;
				suu++;
			}
		}
		System.out.println(suu);
	}
}

Measured memory_bytes: 21844
#include <vector>
#include <math.h>
#include <iostream>
#include <string>
#include <algorithm>
#include <queue>
#include <iomanip>
#include <deque>
#include <cctype>
#include <unordered_map>

using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pll = pair<long, long>;
template <class T> using V = vector<T>;
template <class T> using VV = V<V<T>>;
#define rep(i, n) for(int i = 0; i<n; i++)
#define rep_s(i, start, n) for(int i= start;  i<n; i++)
#define rep_down(i, n) for(int i = n-1; i>=0; i--)
#define rep_down_s(i, n, start) for(int i = n-1; i>=start; i--)
#define ALL(a) (a).begin(), (a).end()
#define ALL_str(a) (a).cbegin(), (a).cend()

string alphabet_upper = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
string alphabet_lower  = "abcdefghijklmnopqrstuvwxyz";
string numbers = "0123456789";

/*
using edge = struct {int to; ll cost;};
vector<edge> tree[limit];
ll depth[limit];

void dfs(int v, int p, ll d){
  depth[v] = d;
  //cout <<"v: " << v << endl;
  for (auto &e: tree[v]){
    //cout << "e.to: " << e.to << endl;
    if (e.to == p) continue;
    dfs(e.to, v, d+e.cost);
  }
}
*/
int keta_sum(int num){
  int dig, sum = 0;
  while(num){
    dig = num % 10;
    sum = sum + dig;
    num = num / 10;
  }
  return sum;
}

ll binary_search(ll left_key, ll border, ll low, ll high) {
     // 配列 a の左端と右端
    ll mid = (low+high)/2;
    while (high > low+1) {
       mid = (low+high)/2;
        if (left_key*mid>border) high = mid;
        else if (left_key*mid<border) low = mid;
        else {
          mid =mid-1;
          break;
        }
    }
    return mid;
}

bool IsPrime(ll a){
  ll b = sqrt(a);
  b++;
  while(b-->=2){
    if (a%b==0) return false;
  }
  return true;
}

struct UnionFind {
    vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

    UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
        for(int i = 0; i < N; i++) par[i] = i;
    }

    int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) { // xとyの木を併合
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
    }

    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};

int main(void){
  ll N, M, A, B, C, D, K,W, H, Q, X, Y;
  ll ans;
  string S, T;
  cin >> N >> K;
  ll x[N];
  ll count_zero = 1e+6;
  rep(i, N) cin >> x[i];
  ans = 1e+17;
  ll count_now;
  rep(i, N-K+1){
    count_now = abs(x[i]) + abs(x[i+K-1]-x[i]);
    //cout <<"count_now: " << count_now << endl;
    ans = min(ans, count_now);
    count_now = abs(x[i+K-1]) + abs(x[i+K-1] - x[i]);
    //cout <<"count_now1: " << count_now << endl;
    ans = min(ans, count_now);
  }
  cout << ans << endl;

}


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

#define lli long long int
#define REP(i,s,n) for(int i=s;i<n;i++)
#define MOD 1000000007
#define NUM 2520
#define INF (1LL<<50)
#define DEBUG 0
#define mp(a,b) make_pair(a,b)
#define SORT(V) sort(V.begin(),V.end())
#define PI (3.141592653589794)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

//dp[i][j],i前の日にしたもの,j:index
lli dp[101000];

int main(){

	lli N,W;
	cin>>N>>W;
	REP(i,0,101000)dp[i]=-INF;
	dp[0]=0;

	REP(i,0,N){
		lli w,v;
		cin>>w>>v;
		for(lli j=W;j>=0;j--){
			if(j+w>W)continue;
			chmax(dp[j+w],dp[j]+v);
		}
	}
	lli maxV=0;
	REP(i,0,W+1)chmax(maxV,dp[i]);
	cout<<maxV<<endl;

    return 0;
}


Measured memory_bytes: 1024
#include "bits/stdc++.h"
 
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
#define int ll
#define fi first
#define se second
#define SORT(a) sort(a.begin(),a.end())
#define rep(i,n) for(int i = 0;i < (n) ; i++) 
#define REP(i,n) for(int i = 0;i < (n) ; i++) 
#define MP(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define INF LLONG_MAX/2
#define all(x) (x).begin(),(x).end()
#define debug(x) cerr<<#x<<": "<<x<<endl
#define debug_vec(v) cerr<<#v<<":";rep(i,v.size())cerr<<" "<<v[i];cerr<<endl
//----------------------------------------------------------------

int MOD = 998244353;
// int MOD = 1000000007;

//----------------------------------------------------------------
signed main(){

	int n;
	cin >> n;

	rep(i,9){
		rep(j,9){
			if((i+1)*(j+1) == n){
				cout << "Yes" << endl;
				return 0;
			}
		}
	}
	cout << "No" << endl;



	

	return 0;
}

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

// g++ -std=c++14 code1.cpp
// sudo pip3 install --upgrade online-judge-tools
// rm -r -f test;oj dl https://code-festival-2018-quala.contest.atcoder.jp/tasks/code_festival_2018_quala_c
// rm -r -f test;oj dl https://ddcc2017-final.contest.atcoder.jp/tasks/ddcc2017_final_b
// rm -r -f test;oj dl https://abc144.contest.atcoder.jp/tasks/abc144_b

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

int main()
{
    int N;

    cin>> N;
int A[N],b[N];
    for(int i=0;i<N;i++)
    {
        cin>>A[i];
    }
    int j=0;
    for(int i=0;i<N;i++)
    {
        if(A[i]%2==0)
        {
            b[j]=A[i];
            j++;
        }
    }
     int flag=0;
        for(int i=0;i<j;i++)
    {
        if(b[i]%3==0||b[i]%5==0)
        {
            flag++;
        }

    }
       if (flag==j)
       {
           cout<<"APPROVED"<<endl;
       }
       else
        cout<<"DENIED"<<endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cctype>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>

using namespace std;

#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 1e9
#define MOD 1000000007
#define rep(i,n) for(i=0;i<(n);i++)
#define loop(i,a,n) for(i=a;i<(n);i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int,int> pii;

int main(void) {
  int i,j;
  int r,c;
  while(cin>>r>>c,r){
    
      int a[10][10000];
    
      rep(i,r)rep(j,c)cin>>a[i][j];
    
      int ans=0;
    
      int bit;
      rep(bit,1<<r){
        rep(i,r)
          if((bit&(1<<i))!=0){//裏返す
    	rep(j,c)a[i][j]=1-a[i][j];
          }
    
        int tmp=0;
    
        rep(j,c){
    
          vi x(2,0);
    
          rep(i,r)x[a[i][j]]++;
    
          tmp+=max(x[0],x[1]);
    
        }
    
        ans=max(ans,tmp);
    
        rep(i,r)
          if((bit&(1<<i))!=0){//戻す
    	rep(j,c)a[i][j]=1-a[i][j];
          }
    
      }
    
    
      cout<<ans<<endl;
    }
}



Measured memory_bytes: 3468
# -*- coding:utf-8 -*-
import sys


def cross_section_diagram(diagram):
    stack = []
    area = []
    for i, ch in enumerate(diagram):
        if ch == "\\":
            stack.append(i)
        elif ch == "/":
            if stack:
                point = stack.pop()
                area.insert(0, (point, i - point))
        else:
            pass
    result = []
    if area:
        p1, cnt1 = area.pop(0)
        for p2, cnt2 in area:
            if p1 < p2:
                cnt1 += cnt2
            else:
                result.insert(0, cnt1)
                p1 = p2
                cnt1 = cnt2
        result.insert(0, cnt1)

    print(sum(result))
    result.insert(0, len(result))
    print(" ".join([str(n)for n in result]))
    return result


if __name__ == "__main__":
    diagram = [val for val in sys.stdin.read().splitlines()]
    cross_section_diagram(diagram[0])

Measured memory_bytes: 8356
#include<stdio.h>
#include<string.h>
#include<math.h>
#include<stdlib.h>

typedef long long ll;

ll mod=1000000000+7;


int main(void){
    int X;
    int div;
    int mod;

    int num[5];
    int i;

    scanf("%d", &X);

    div = X/100;
    mod = X%100;
    int five=mod/5;
    int other = mod %5;

    if(other != 0){
        printf("%d", five+1<=div ? 1:0);
    }else{
        printf("%d", five<=div?1:0);
    }
    return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <algorithm>
#include <functional>
#include <string>
#include <utility>
#include <cstdio>
#include <cmath>
#include <deque>

#define REP(i,n) for(int i = 0; i < (n); ++i)
#define REP1(i,n) for(int i = 1; i <= (n); ++i)
#define RREP(i, n) for(int i = (n) - 1; i >= 0; --i)
#define ALL(a) begin(a), end(a)
#define MP(a,b) make_pair((a), (b))
#define ROUNDUP(a,b) ((a) / (b) + ((a) % (b) == 0 ? 0 : 1))
#define X first
#define Y second
#define DEBUG(a) cout << #a << ": " << a << "\n"
// #define DEBUG(a) {}

using namespace std;
using ll = long long;
using vi = vector<int>;
using pii = pair<int, int>;

constexpr int MOD = 1e9 + 7;
constexpr int INF = 1e9 + 1;
constexpr ll LLINF = 4 * 1e18 + 1;
// constexpr int INF = 2147483647; // 2 * 1e9
// constexpr ll LLINF = 9223372036854775807; // 9 * 1e18

template<typename T>
T debug(T x) {
	DEBUG(x);
	return x;
}

int main(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	string s; 
	cin >> s;
	if((int)s.find("AC") != -1) cout << "Yes\n";
	else cout << "No\n";
	return 0;
}


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

using namespace std;

main(){
	while (1){
		int a,b;
		cin >> a >> b;
		if(a == 0 && b == 0){
			break;
		}else if(a <= b){
			printf("%d %d\n",a,b);
		}else if(a >= b){
			printf("%d %d\n",b,a);
		}
	}
}


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

int main(){
	
	int a,b,c,d;
	cin >> a >> b >> c >> d;
	int x = c - a, y = d - b;
	
	cout << c - y << " " << d + x << " " << a - y << " " << b + x;
	
	
}



Measured memory_bytes: 256
package main

import (
	"fmt"
)

func abs(x int) int{
	if x < 0 {
		return -x
	} else {
		return x
	}
}

func main() {
	var n int
	fmt.Scan(&n)

	a := make([]int, n)
	for i, _ := range a {
		fmt.Scan(&a[i])
	}
	a = append([]int{0}, a...)
	a = append(a, 0)
	//fmt.Println(a)

	d := 0
	for i := 0; i < len(a)-1; i++ {
		d += abs(a[i+1] - a[i])
	}
	for i := 1; i < len(a)-1; i++ {
		dd := abs(a[i+1] - a[i-1])
		ddd := abs(a[i] - a[i-1])
		dddd := abs(a[i+1] - a[i])
		fmt.Println(d + dd - ddd -dddd)
	}


	/*as = append([]int{0}, as...)
	fmt.Println(as)
	as = append(as, 0)
	sum := 0
	ds := make([]int, len(as)-1)
	for i := 0; i < len(as)-1; i++ {
		d := as[i+1] - as[i]
		if d < 0 {
			d = -d
		}
		ds[i] = d
		sum += d
	}
	for i := 1; i < len(as)-1; i++ {
		d1 := as[i+1] - as[i-1]
		if d1 < 0 {
			d1 = -d1
		}
		d2 := as[i] - as[i-1]
		if d2 < 0 {
			d2 = -d2
		}
		d3 := as[i+1] - as[i]
		if d3 < 0 {
			d3 = -d3
		}
		fmt.Printf("%d\n", sum+d1-d2-d3)
	}*/
}


Measured memory_bytes: 6656
#include<bits/stdc++.h>
#define LL long long
#define clr(x,i) memset(x,i,sizeof(x))
using namespace std;
const int N=100005;
inline int read()
{
	int x=0,f=1;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	return x*f;

}
int n,a[N],s;
int main()
{
	n=read();
	for(int i=0;i<n;i++) a[i]=read(),s+=a[i];
	int mn=1e9,p=0;
	for(int i=0;i<n;i++) if(abs(s-a[i]*n)<mn) mn=abs(s-a[i]*n),p=i;
	cout<<p;
}


Measured memory_bytes: 256
using System;
using System.Linq;
using System.Numerics;
namespace Sample
{
  class Sample
  {
    static void Main(string[] args)
    {
      
     BigInteger A=BigInteger.Parse(Console.ReadLine());
     BigInteger B=BigInteger.Parse(Console.ReadLine());
      if(A>B){
        Console.WriteLine("GREATER");
      }else if(A==B){
        Console.WriteLine("EQUAL");
      }else{
        Console.WriteLine("LESS");
      }
    }
     
  }

}
  

Measured memory_bytes: 27640
#include <bits/stdc++.h>
using namespace std;
struct Fast {
    Fast() {
        cin.tie(0);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(20);
    }
} fast;
template <typename A, size_t N, typename T> void Fill(A (&array)[N], const T& val) {
    std::fill((T*)array, (T*)(array + N), val);
}
// long long mod = 998244353;
#define REP(i, n) for (long long i = 0; i < (n); i++)
#define rep(i, a, n) for (long long i = a; i < (n); i++)
typedef long long ll;
typedef pair<ll, ll> P;
long long mod = 1000000007;
long long modpow(long long m, long long n, long long modvalue) {
    if (n == 0) return 1;
    if (n % 2 == 0) {
        long long t = modpow(m, n / 2, modvalue);
        return t * t % modvalue;
    } else {
        return modpow(m, n - 1, modvalue) * m % modvalue;
    }
}

long long moddiv(long long a, long long b, ll modvalue) { return (a * modpow(b, mod - 2, modvalue)) % modvalue; }

const ll INF = 1LL << 60;

string change_binary(long long a) {
    string ret;
    for (int i = 31; i >= 0; i--) {
        ret += (a >> i & 1) + '0';
    }
    return ret;
}

ll nCkmod(ll n, ll k, ll modvalue) {
    ll numera = 1;
    for (int i = n; i > n - k; i--) {
        numera *= i;
        numera %= modvalue;
    }
    ll denomi = 1;
    REP(i, k) {
        denomi *= (i + 1);
        denomi %= modvalue;
    }
    return moddiv(numera, denomi, modvalue);
}

map<ll, ll> cnt;
void primeFactors(long long n) {
    while (n % 2 == 0) {
        cnt[2]++;
        n = n / 2;
    }
    for (int i = 3; i <= sqrt(n); i = i + 2) {
        while (n % i == 0) {
            cnt[i]++;
            n = n / i;
        }
    }
    if (n > 2) {
        cnt[n]++;
    }
}
struct UnionFind {
    vector<int> parent, size;
    UnionFind(int n) {
        parent.resize(n, -1);
        size.resize(n, 1);
    }
    void unite(int x, int y) {
        if (same(x, y)) {
            return;
        }
        x = root(x);
        y = root(y);
        if (size[x] <= size[y]) {
            swap(x, y);
        }
        parent[y] = x;
        size[x] += size[y];
    }
    bool same(int x, int y) { return (root(x) == root(y)); }
    int root(int x) {
        while (parent[x] != -1) {
            x = parent[x];
        }
        return x;
    }
    int getsize(int x) { return size[root(x)]; }
};
int main() {
    ll x, k, d;
    cin >> x >> k >> d;
    x = abs(x);
    if (__int128(k) * d <= x) {
        cout << x - k * d << endl;
    } else {
        k = k - x / d;
        x -= (x / d) * d;
        k = k % 2;
        cout << abs(x - k * d) << endl;
    }
}

Measured memory_bytes: 3580
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const long long mod = 1e9 + 7;

ll gcd(ll a, ll b) {
	return b ? gcd(b, a % b) : a;
}

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

int main() {
	int n, t;
	cin >> n >> t;

	int ans = 0;

	vector<int> a(n);

	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}

	for (int i = 1; i < n; i++) {
		int tmp = a[i] - a[i - 1];
		if (tmp >= t) {
			ans += t;
		} else {
			ans += tmp;
		}
	}

	cout << ans + t << endl;
}


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

class Main
{
	public static void main( String[] args )
	{
		Scanner sc = new Scanner(System.in);
		String str = sc.nextLine();
		System.out.println(update(str));
	}
	static String update(String str)
	{
		char[] ch = str.toCharArray();
		for(int i = 0; i < 3; i++)
		{
			if(ch[i] == '1') ch[i] = '9';
			else ch[i] = '1';
		}
		return String.valueOf(ch);
	}

}

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

int main() {
  int N;
  bool j = false;
  cin >> N;

  // ここにプログラムを追記
  for(int i = 1; i <= N; i++) {
    string A;
    cin >> A;
    if(A == "Y"){
      j = true;
    }
  }
  
  if(j) {
   cout << "Four" << endl; 
  }
  else {
    cout << "Three" << endl;
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i <(n); ++i)
#define REP2(i,x,n) for (int i = x; i <(n); ++i)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
using namespace std;
using ll = long long;
using P = pair<int,int>;
static const double PI = acos(-1);
static const int INF = 1e9+7;



int main(){
  int n, m;
  cin >> n >> m;
  int p = 1;
  REP(i,m){
    p *= 2;
  }

  int ans = ((n-m)*100 + m * 1900)*p;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repr(i, n) for (int i = (n); i >= 0; --i)
#define FOR(i, m, n) for (ll i = (m); i < (n); ++i)
#define FORR(i, m, n) for (int i = (m); i >= (n); --i)
#define equals(a, b) (fabs((a) - (b)) < EPS)
using namespace std;
typedef long long ll;
const ll mod = 1000000007;
const ll mod2 = 998244353;
const ll INF = 1e18;
const long double EPS = 1e-10;

int main() {
  ll n;
  cin >> n;

  ll ans = 1;
  FOR(i, 1, n + 1) {
    ans = (ans * i) % mod;
  }
  cout << ans << endl;


  
  return 0;
}

Measured memory_bytes: 256
from heapq import heappush, heappop, heapify
from collections import deque, defaultdict, Counter
import itertools
from itertools import permutations, combinations, accumulate
import sys
import bisect
import string
import math
import time


def I(): return int(input())


def S(): return input()


def MI(): return map(int, input().split())


def MS(): return map(str, input().split())


def LI(): return [int(i) for i in input().split()]


def LI_(): return [int(i)-1 for i in input().split()]


def StoI(): return [ord(i)-97 for i in input()]


def ItoS(nn): return chr(nn+97)


def input(): return sys.stdin.readline().rstrip()


yn = {False: 'No', True: 'Yes'}
YN = {False: 'NO', True: 'YES'}
MOD = 10**9+7
inf = float('inf')
IINF = 10**10
l_alp = string.ascii_lowercase
u_alp = string.ascii_uppercase
ts = time.time()
sys.setrecursionlimit(10**6)
nums = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10']

show_flg = False
# show_flg = True

def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a % b)


def gcd_n(a, n):
    ans = a[0]
    for i in range(1, n):
        ans = gcd(ans, a[i])
    return ans


def divisor(n):
    ret = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            ret.append(i)
            if n // i != i:
                ret.append(n // i)
    return ret


def main():
    K = I()
    ans = 0

    for a in range(1, K+1):
        for b in range(1, K+1):
            for c in range(1, K+1):
                # print(a, b, c, gcd_n([a, b, c], 3))
                ans += gcd_n([a, b, c], 3)

    print(ans)


if __name__ == '__main__':
    main()


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

typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))

int main(){
  int x, a;
  cin >> x >> a;
  if(x < a){
    cout << 0 <<endl;
  }else{
    cout << 10 <<endl;
  }
}

Measured memory_bytes: 256
#include<map>
#include<string>
#include<iostream>

using namespace std;

int main(){
	char *finv[]={"Rock","Fire","Scissors","Snake","Human","Tree","Wolf","Sponge",
					"Paper","Air","Water","Dragon","Devil","Lightning","Gun"};
	map<string,int> f;
	for(int i=0;i<15;i++)	f[finv[i]]=i;

	for(int n;cin>>n,n;){
		bool hand[15]={};
		for(int i=0;i<n;i++){
			string s;	cin>>s;
			hand[f[s]]=true;
		}

		int ans=-1;
		for(int i=0;i<15;i++){
			if(hand[i]){
				bool win=false;
				for(int j=(i+1)%15,k=0;k<7;j=(j+1)%15,k++){
					if(hand[j]){ win=true; break; }
				}

				bool lose=false;
				for(int j=(i+8)%15,k=0;k<7;j=(j+1)%15,k++){
					if(hand[j]){ lose=true; break; }
				}

				if(win && !lose){ ans=i; break; }
			}
		}

		cout<<(~ans?finv[ans]:"Draw")<<endl;
	}

	return 0;
}

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

const int N=305;
const int mod=998244353;
int n,k,dp[N][N][N],m,f[N][N][N],g[N][N][N];

main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    string s;
    cin>>s>>m;
    n=s.size();
    m=min(n,m);
    s="."+s;
    int cur=-1;
    vector<int>seg;
    for(int i=1;i<=n;i++)
    {
        if(s[i]=='0')
        {
            cur=i;
            break;
        }
    }
    if(cur==-1) return cout<<1,0;
    seg.push_back(cur-1);
    while(cur<=n)
    {
        int j=cur+1;
        while(j<=n&&s[j]!='0') j++;
        j--;
        seg.push_back(j-cur);
        cur=j+1;
    }
    dp[0][0][0]=1;
    for(int i=0;i<=n;i++)
    {
        g[0][i][i]=1;
        f[0][i][0]=1;
    }
    cur=0;
    int res=0;
    for(int i=1;i<=seg.size();i++)
    {
        int num=seg[i-1];
        cur+=num;
        for(int j=cur;j<=n;j++)
        {
            for(int k=0;k<=m;k++)
            {
                dp[i][j][k]=(f[i-1][j][k]-f[i-1][j-num][k]+mod)%mod;
                (dp[i][j][k]+=g[i-1][j-num][k])%=mod;
                if(j&&k) g[i][j][k]=(g[i][j-1][k-1]+dp[i][j][k])%mod;
                else g[i][j][k]=dp[i][j][k];
                if(j) f[i][j][k]=(f[i][j-1][k]+dp[i][j][k])%mod;
                else f[i][j][k]=dp[i][j][k];
                if(i==seg.size()&&j==cur) (res+=dp[i][j][k])%=mod;
            }
        }
    }
    cout<<res;
}


Measured memory_bytes: 649772
import numpy as np
from numba import njit
N=int(input())
a=np.array([int(i) for i in input().split()],dtype=np.int64)
dp=np.full((N,N),-1,dtype=np.int64)
for i in range(N):
    dp[i][i]=a[i]

@njit('i8(i8,i8,i8[:,:],i8[:])', cache=True)
def calc(i,j,dp,a):
    if dp[i][j]!=-1:
        return dp[i][j]
    dp[i][j]=max(a[i]-calc(i+1,j,dp,a),a[j]-calc(i,j-1,dp,a))
    return dp[i][j]

calc(0,N-1,dp,a)
print(dp[0][N-1])


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

int main(void)
{
	ios_base::sync_with_stdio(false);    
	cin.tie(NULL);
	cout.tie(NULL);
	
	double x;
	cin>>x;
	int n=0;
	double t=100;
	while(t<x)
	{
		t=floor(t*1.01);
		n++;
	}
	
	cout<<n<<"\n";
	
	return 0;
}

Measured memory_bytes: 3736
#include <iostream>
#include <algorithm>
#include <vector>
#include <numeric>
using namespace std;
 
int main() {
    int n, r;
    while(cin >> n >> r, n) {
        vector<int> v(n);
        for(int i=0; i<n; ++i) {
            v[i] = n-i;
        }
         
        for(int i=0; i<r; ++i) {
            vector<int> tmp;
            int p, c;
            cin >> p >> c;
            tmp.insert(tmp.begin(), v.begin()+p-1, v.begin()+p+c-1);
            v.erase(v.begin()+p-1, v.begin()+p+c-1);
            v.insert(v.begin(), tmp.begin(), tmp.end());
        }
        cout << v[0] << endl;
    }
}


Measured memory_bytes: 3096
#include<stdio.h>
int main()
{
    int i,n;
    long long ara[87];
    ara[0]=2,ara[1]=1;
    for(i=2;i<87;i++)
    {
        ara[i]=ara[i-2]+ara[i-1];
    }
    while(scanf("%d",&n)==1)
    {
        printf("%lld\n",ara[n]);
    }
    return 0;
}


Measured memory_bytes: 128
#include <algorithm>
#include <cmath>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>

using namespace std;

using ll = long long;
using ld = long double;

const ld pi = 3.141592653589793;

int main() {
  ll n;
  cin >> n;
  cout << 1000 * ((n + (1000 - 1)) / 1000) - n << endl;
}

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

int main(){
  int N;
  cin >> N;
  
  vector<int64_t> L(N+1);
  L.at(0)=2LL;
  L.at(1)=1LL;
  for(int i=2;i<=N;i++){
    L.at(i)=L.at(i-1)+L.at(i-2);
  }
  cout << L.at(N) << endl;
}

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

int main(){
    int n;
    cin >> n;
    int x=0;
    rep(i,n){
        int a;
        cin >> a;
        x ^= a;
    }
    if(!x)cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#include <chrono>
#include <random>
#include <cstdio>
#define ll long long int
#define endl '\n'
#define pb push_back
#define mp make_pair
#define rep(i,n) for(ll i=0;i<n;i++)
#define vi vector <int>
#define vs vector <string>
#define vc vector <char>
#define vl vector <ll>
#define pll pair<ll, ll>
#define pint pair<int, int>
#define S second
#define F first
#define all(c) (c).begin(),(c).end()
using namespace std;
const int N=500001;
ll gcd(ll a, ll b) { if (a == 0) return b; return gcd(b % a, a); } 
ll lcm(ll a, ll b){return a*b/gcd(a, b);}
#define pi 3.14159265358979323846264338
using namespace std; 
ll max(ll a, ll b){ if(a>b)return a;return b;}
ll min(ll a, ll b){ if(a < b) return a;return b;}
ll inf = 100000000000000000;

void solve() 
{
    ll n, d;
    cin>>n>>d;

    ll dist = d*d;

    ll ans = 0;

    rep(i, n)
    {
        ll x, y;
        cin>>x>>y;

        ll curr = x*x + y*y;

        if(curr <= dist)
        {
            ans++;
        }
    }

    cout<<ans<<endl;
}



int main()
{
    #ifndef ONLINE_JUDGE
        // for getting input from input.txt
        freopen("input.txt", "r", stdin);
        // for writing output to output.txt
        freopen("output.txt", "w", stdout);
    #endif

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int T=1;
    // cin>>T;
    int t=0;
    while(t++<T)

    {
        // cout<<"Case #"<<t<<":"<<' ';
        solve();
        // cout<<'\n';
    }

    cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
}


Measured memory_bytes: 3804
#include<stdio.h>

int N[45];

int fib(int n)
{
  if(n==0 || n==1)return N[n]=1;
  if(N[n]!=-1)return N[n];
  return N[n]=fib(n-1)+fib(n-2);
}

int main()
{
  int n,i;

  for(i=0;i<45;i++) N[i]=-1;

  scanf("%d",&n);
  printf("%d\n",fib(n));

  return 0;
}



Measured memory_bytes: 2108
n = int(input())
stack =[]
for i in range(n):
    ln = input().split()+[i+1]
    ln[1] = -int(ln[1])
    stack.append(ln)

s = sorted(stack,key=lambda x:(x[0],x[1]))
for i in range(n):
    print(s[i][2])

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

int main()
{
    string s;
    cin>>s;
    int n = s.size();
    int num = 0;
    int num2 = 0;
    if(s[0]!='A' || s[1]-'A'<32 || s[n-1]-'A'<32){
        cout<<"WA"<<endl;
        return 0;
    }
    repd(i,2,n-1){
        if(s[i]=='C')num++;
        if(s[i]-'A'>=32)num2++;
    }
    if(num==1&&num+num2==n-3)cout<<"AC"<<endl;
    else cout<<"WA"<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
 
int main() {
  ll n,p,q;
  cin >> n >> p >> q;
  ll c[n],x=0,y=0;
  for(ll i=0; i<n; i++) {
    cin >> c[i];
    c[i]+=i*p;
    x+=c[i];
    y+=i*p;
  }
  sort(c,c+n);
  ll ans=x-y;
  for(ll i=0; i<n; i++) {
    x-=c[i];
    x+=(i*2LL+q)*p;
    ans=max(ans,x-y);
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 5076
/*
 ALDS1_1_A
*/

#include <iostream>

using namespace std;

static const int MAX = 1000;

void outArray(int N, const int (&A)[MAX]) {
    for(int i = 0; i < N; i++) {
        cout << A[i];
        if(i < N-1) {
            cout << " ";
        }
    }
    cout << endl;
}

int main() {
    int n, A[MAX];

    cin >> n;

    for(int i = 0; i < n; i++) {
        cin >> A[i];
    }

    outArray(n, A);

    for(int i = 1; i < n; i++) {
        int v = A[i];
        int j = i-1;
        while( (j >= 0) && (A[j] > v) ) {
            A[j+1] = A[j];
            j--;
        }
        A[j+1] = v;
        outArray(n, A);
    }

}


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

vector<int> vn;

void init() {
    int n1, n2, n3, n4;
	cin >> n1 >> n2 >> n3 >> n4;
	vn.push_back(n1);
	vn.push_back(n2);
	vn.push_back(n3);
	vn.push_back(n4);
	sort(vn.begin(), vn.end());
}

string solve(){
    if(vn.at(0) != 1) return "NO";
    if(vn.at(1) != 4) return "NO";
    if(vn.at(2) != 7) return "NO";
    if(vn.at(3) != 9) return "NO";
    return "YES";
}

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

	init();
    
    cout << solve() << "\n";

	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(void)
{
 unsigned long a,b,sum;
 while(scanf("%lu %lu",&a,&b) != EOF)
            {
              int i;
              int count=0;
              sum = a+b;
              while(sum>0){
                                    sum /= 10;
                                    count ++;
              }
              printf("%d\n",count);
}
return 0;
}

   

Measured memory_bytes: 604
#include <iostream>
#include <stdio.h>
#include <vector>
using namespace std;

int main(){

  float x,y;
  int n,count=1,i;
  float size;
  cin >> n;
  while(n!=0){
    size=0;
    vector <float> xs,ys;
    for(i=0;i<n;i++){
      cin >> x >> y;
      xs.push_back(x);
      ys.push_back(y);
    }

    for(i=0;i<n;i++){
      size+=((xs[i]-xs[(i+1)%n])*(ys[i]+ys[(i+1)%n]))/2;
    }
    if(size<0) size*=-1;
    printf("%d %.1f\n",count,size);
    count++;
    cin >> n;
  }
  
  return 0;
}

Measured memory_bytes: 1264
def solve(n,k) :
    if n <= 9 and k == 1 :
        return n
    elif n <= 9 and k >= 2 :
        return 0
    elif k == 0:
        return 1
    else :
        m = n //10
        r = n % 10
        return  r * solve(m,k-1) + (9 - r) * solve(m-1,k-1) + solve(m,k)

n = int(input())
k = int(input())
print(solve(n,k))

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

using namespace std;

int main(){
    int N;
    cin >> N;
    vector<int> A(N);
    for(int i=0;i<N;i++){
        cin >> A.at(i);
    }

    int M = *max_element(A.begin(),A.end());
    int m = *min_element(A.begin(),A.end());

    cout << M-m << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <set>
#include <map>
#include <string>
#include <stack>
#include <queue>
#include <cmath>
#include <cstdio>
#include <istream>
#include <sstream>
#include <iomanip>
using namespace std;

typedef ostringstream oss;
typedef istringstream iss;

struct Member{
	Member() : isCrim(true) {}
	bool isCrim;
	vector<int> inf;
};

int main(void) {
	int N;
	while (cin >> N, N) {
		vector<Member> mem(N);
		for (int i = 0; i < N; i++) {
			int M;
			cin >> M;
			for (int j = 0; j < M; j++) {
				int t;
				cin >> t;
				mem[i].inf.push_back(t);
			}
		}
		vector<int> outInf;
		int K;
		cin >> K;
		for (int i = 0; i < K; i++) {
			int t;
			cin >> t;
			outInf.push_back(t);;
		}

		for (int ci = 0; ci < K; ci++) {
			for (int mi = 0; mi < N; mi++) {
				if (!mem[mi].isCrim) {
					continue;
				}
				if (find(mem[mi].inf.begin(), mem[mi].inf.end(), outInf[ci]) == mem[mi].inf.end()) {
					mem[mi].isCrim = false;
				}
			}
		}

		int crimNum = 0, crimIndex;
		for (int mi = 0; mi < N; mi++) {
			if (mem[mi].isCrim) {
				crimNum++;
				crimIndex = mi;
			}
		}

		//cout << "--- ";
		if (crimNum == 1) {
			cout << crimIndex + 1 << endl;
		}else {
			cout << -1 << endl;
		}
	}

	return 0;
}

Measured memory_bytes: 1272
using System;
using System.Collections.Generic;
using System.Linq;
public class GFG
{
    
    public static void Main()
    {

        var input = Console.ReadLine().Split(' ');

        var tot = int.Parse(input[0]);
        var legs = int.Parse(input[1]);

        for(int i=0;i<=100;i++)
        {
            for(int j=0;j<=100;j++)
            {
                if((i*2+j*4)==legs)
                {
                    if(i+j==tot)
                    {
                        Console.Write("Yes");
                        return;
                    }
                }
            }
        }
        Console.Write("No");
    }

   
}


Measured memory_bytes: 17876
#include<iostream>
#include<cstring>
#include<string>
#include<cmath>
#include<vector>
#include<algorithm>
#include<iterator>
#include<sstream>
#include<iomanip>
#include<map>

#define rep(i, n) for (ll i = 0; i < n; i++) 
#define rrep(i, n) for(ll i = n-1; i>=0; i--)
#define range(i, n, m) for (ll i = n; i < m; i++) 
#define rrange(i, n, m) for (ll i = n - 1; i => m; i--) 
#define MOD 1000000007

typedef long long int ll;
typedef unsigned long long int ull;

using namespace std;

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

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

	ll N, M, K;
	string S;

	cin >> N >> S >> K;



	rep(i, N) {
		if (S[i] != S[K - 1]) {
			S[i] = '*';
		}
	}


	cout << S << endl;



	
	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define max(p,q)((p)>(q)?(p):(q))

int downll(const void*a, const void*b){return*(ll*)a<*(ll*)b?1:*(ll*)a>*(ll*)b?-1:0;}
void sortdown(ll*a,int n){qsort(a,n,sizeof(ll),downll);}


ll a[100010],b[100010];
ll n,h;
int main(){
	scanf("%lld%lld",&n,&h);
	rep(i,0,n)scanf("%lld%lld",a+i,b+i);
	sortdown(a,n);
	sortdown(b,n);
	ll ans=0;
	rep(i,0,n){
		if(b[i]<a[0])break;
		h-=b[i];
		ans++;
		if(h<=0)break;
	}
	if(h>0)ans+=(h+a[0]-1)/a[0];
	printf("%lld",ans);
	return 0;
}

Measured memory_bytes: 2556
#include <bits/stdc++.h>
using namespace std;
using pi = pair<int, int>;
using lint = long long;
const int MAXN = 1005;

int n; 
pi a[MAXN];
int r[MAXN];
bool vis[MAXN];
double dis[MAXN];

double cost(int x, int y){
	return max(hypot(a[x].second - a[y].second, a[x].first - a[y].first) - r[x] - r[y], 0.0);
}

int main(){
	scanf("%d %d %d %d",&a[0].first,&a[0].second,&a[1].first,&a[1].second);
	scanf("%d",&n);
	for(int i=2; i<=n+1; i++){
		scanf("%d %d %d",&a[i].first,&a[i].second,&r[i]);
	}
	fill(dis, dis + n + 2, 1e18);
	dis[0] = 0;
	while(true){
		int x = -1;
		double k = 1e18;
		for(int j=0; j<n+2; j++){
			if(!vis[j] && k > dis[j]){
				k = dis[x = j];
			}
		}
		vis[x] = 1;
		if(x == 1){
			printf("%.10f\n", dis[1]);
			return 0;
		}
		for(int j=0; j<n+2; j++) dis[j] = min(dis[j], dis[x] + cost(x, j));
	}
}


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

int main(){
	int n;
	cin>>n;
	int nx=0;
	int ny=0;
	int nt=0;
	
	int t,x,y;
	
	for(int i=0;i<n;i++){
		cin>>t>>x>>y;
		if(t<x+y||abs(nx-x)+abs(ny-y)<nt-t){
			cout<<"No"<<endl;
			return 0;
		}
		
		if((abs(nx-x)+abs(ny-y))%2!=abs(nt-t)%2){
			cout<<"No"<<endl;
			return 0;
		}
		
		nt=t;
		nx=x;
		ny=y;
	}
	
	cout<<"Yes"<<endl;
	
	
}

Measured memory_bytes: 256
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
typedef int64_t lint;
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using lb = long double;
//マクロ
//forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
//xにはvectorなどのコンテナ
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SI(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x)) //最大値を求める
#define MIN(x) *min_element(ALL(x)) //最小値を求める
#define debug(x) cerr << #x << ": " << x << "\n"//手動デバッグ
#define debugV(x) for(int i=0;i<((ll)(x).size());i++)cerr << #x <<"at:"<<i<< ": " << x[i] << "\n"//手動デバッグ 
#define YES(c) cout<<((c)?"YES\n":"NO\n"),0
#define Yes(c) cout<<((c)?"Yes\n":"No\n"),0
#define O(p) cout<<p<<"\n",0
#define OS(p) cout<<p<<" ",0
#define ON(p) cout<<p,0
//定数
#define INF 1000000000000 //10^12:極めて大きい値,∞
#define inf 2147483647 //int値の最大値
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange(素数列挙などで使用)
#define endl "\n"//endlを置き換える
//略記
#define PB emplace_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素
#define CST(x) cout<<fixed<<setprecision(x)//小数点以下の桁数指定

const int dy[4]={1,0,-1,0};
const int dx[4]={0,1,0,-1};//^>v<

template<class T=int> T in(){
    T x;
    cin>>x;
    return (x);
}
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;
}
int gcd(int a, int b) {
    if (b==0) return a;
    else return gcd(b, a%b);
}
int lcm(int a, int b) {
    return a * b / gcd(a, b);
}
int two(int n){
	ll ans=1;
	rep(i,n){
		ans*=2;
	}
	return ans;
}
//------------------------------------------------------------





//------------------------------------------------------------
int main() {
	ios::sync_with_stdio(false);
	std::cin.tie(nullptr);
//------------------------------------------------------------
    string a,b,c;cin>>a>>b>>c;
    char nowword=a[0];
    a.erase(0,1);
    int win=0;
    while(1){
        if(nowword=='a'){
            if(a.size()==0){
                win++;
                break;
            }
            nowword=a[0];
            a.erase(0,1);
        }else if(nowword=='b'){
            if(b.size()==0){
                break;
            }
            nowword=b[0];
            b.erase(0,1);
        }else{
            if(c.size()==0){
                win--;
                break;
            }
            nowword=c[0];
            c.erase(0,1);
        }
    }
    if(win==1)O("A");
    else if(win==0)O("B");
    else O("C");
    
    
    
    
    
    
    
//------------------------------------------------------------
	return 0;
}


Measured memory_bytes: 3664
n=int(input())
a=map(int,input().split())

b = [ (a,i) for i,a in enumerate(a)]

b.sort(reverse=True)

dp=[ [0] * (n+1) for i in range(n+1) ]

ans=0

for l in range(n):
  for r in range(n):
    if l + r == n:
      ans = max( ans, dp[l][r] )
      break
    act , i = b[l+r]
    dp[l+1][r] = max( dp[l+1][r] , dp[l][r] +act*abs(i-l))
    dp[l][r+1] = max( dp[l][r+1] , dp[l][r] +act*abs(n-i-1-r))
print(ans)

Measured memory_bytes: 100692
#include <iostream>
#include <cmath>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <algorithm>
#include <iomanip>
#include <string.h>

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

typedef long long lint;

using namespace std;

int main(){
  lint N,M;
  cin>>N>>M;
  map<lint,lint> m;
  REP(i,N){
    lint A;
    cin>>A;
    m[A]++;
  }
  REP(i,M){
    lint B,C;
    cin>>B>>C;
    m[C]+=B;
  }
  lint ans=0;
  lint n=0;
  for(auto itr=m.rbegin();itr!=m.rend();itr++){
    lint k=min(N-n,itr->second);
    ans+=k*(itr->first);
    n+=k;
    if(n==N)break;
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 12800