akhauriyash/Code-Regression huggingface dataset:
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Scanner;

public class Main {
    public static long process(TestCase testCase) {
        int N = testCase.N;
        List<Integer> A = testCase.A;

        List<Integer> differences = new ArrayList<>();

        for (int i = 0; i < N; ++i) {
            int target = (i + 1);
            final int diff = target - A.get(i);
            differences.add(diff);
        }

        differences.sort(Integer::compareTo);

        int mid = N / 2;

        final int midDiff = differences.get(mid);

        return sadness(differences, midDiff);
    }

    private static long sadness(Collection<Integer> differences, int midDiff) {
        return differences.stream()
                .mapToLong(i -> Math.abs(i - midDiff))
                .sum();
    }

    // Util func

    public static void main(String[] args) {
        TestCase testCase = readFromInput();

        final long result = process(testCase);

        output(result);
    }

    private static TestCase readFromInput() {
        Scanner sc = new Scanner(System.in);

        int N = sc.nextInt();

        List<Integer> A = new ArrayList<>();
        for (int i = 0; i < N; ++i) {
            A.add(sc.nextInt());
        }

        sc.close();
        return new TestCase(N, A);
    }

    private static void output(long result) {
        System.out.println(result);
    }

    public static class TestCase {
        final int N;
        final List<Integer> A;

        public TestCase(int N, List<Integer> A) {
            this.N = N;
            this.A = A;
        }
    }

}


Measured memory_bytes: 95484
/*Made by Shivam Solanki*/
#include<bits/stdc++.h>
#pragma GCC optimize ("Ofast")
using namespace std;
#define DEBUG(x) cerr << '>' << #x << ':' << x << endl;
#define ll long long int
#define endl '\n'
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vll> vvl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<vi> vvi;
typedef vector<bool> vb;
typedef vector<pii> vp;
typedef vector<pll> vpll;
typedef map<int,int> mii;
typedef map<ll,ll> mll;
typedef set<int> sii;
typedef set<ll> sll;
typedef queue<int> qii;
typedef priority_queue<int> pq;
typedef unordered_map<int,int> umii;
typedef unordered_map<ll,ll> umll;
#define all(x) x.begin(),x.end()
#define rep(i,k,n) for (int i = k; i < n; ++i) 
#define repr(i,k,n) for (int i = n; i>=k; --i)
#define repll(i,k,n) for (ll i = k; i < n; ++i) 
#define pb push_back
#define mp make_pair
#define gcd __gcd
#define F first
#define S second
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
const int INF = 1e9+5;
const int MOD = 1e9+7;
const ll inf = 2e18+11;
double pi = 2 * acos(0.0); 
 
void solve(){
    int n,k;
    cin>>n>>k;
    int a[n];
    rep(i,0,n) cin>>a[i];
    sort(a,a+n);
    int s=0;
    rep(i,0,min(n,k)) s+=a[i];
    cout<<s;
}
 
int main(){ 
    // #ifndef ONLINE_JUDGE  
        // freopen("input.txt", "r", stdin); 
        // freopen("output.txt", "w", stdout); 
    // #endif 
    fastio;
    int t=1;
    // cin>>t;
    while(t--)
        solve();
    return 0;
}

Measured memory_bytes: 3664
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int k = sc.nextInt();
		if(n % k == 0) {
			System.out.println(0);
		} else {
			System.out.println(1);
		}
	}

}


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

int n, m, a, b;
 
int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	cin >> n >> m;
	int ans[n];
	for (int i = 0; i < n; i++)
		ans[i] = 0;
	
	while (m--) {
		cin >> a >> b;
		ans[a - 1]++;
		ans[b - 1]++;
	}
	for (int i = 0; i < n; i++) {
		cout << ans[i] << '\n';
	}
}

Measured memory_bytes: 256
#pragma warning(disable:4996)

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <float.h>

#pragma region 定義
#define i_cin(X) scanf("%d", &X)
#define i_cin2(X,Y) scanf("%d %d",&X,&Y)
#define i_cin4(X,Y,Z,W) scanf("%d %d %d %d",&X,&Y,&Z,&W)
#define i_cin3(X,Y,Z) scanf("%d %d %d",&X,&Y,&Z)
#define l_cin(X) scanf("%ld",&X)
#define f_cin(X) scanf("%f",&X)
#define l_cin2(X,Y) scanf("%ld %ld",&X,&Y)
#define s_cin(X) scanf("%s",&X)

#define  i_cout(X) printf("%d\n",X)
#define  f_cout(X) printf("%g\n",X)
#define  i_cout2(X,Y) printf("%d %d\n",X,Y)
#define  l_cout(X) printf("%ld\n",X)
#define  s_cout(X) printf("%s\n",X)
#define  ll_cout(X) printf("%lld\n",X)

typedef long long  ll;
#define rept(x, s, n) for (int x = s; x < n; x++)

#define S_RTN(S)  s_cout(S);return 0


#define _itoa(A,N) sprintf(A, "%d", N);

int i_cins(int n, int* A);
int l_cins2(int n, long* A, long* B);
int s_dsort(const void* a, const void* b);
int s_asort(const void* a, const void* b);

int  _gcd(int a, int b);
int  _swp(int* a, int* b);
int _cknum(char* a, int n);
int _atoi(char* s, int len);


int s_asorts(const void* a, const void* b);

//昇順
int s_asorts(const void* a, const void* b) {
	return(strcmp((char*)a, (char*)b));
}
int s_dsort(const void* a, const void* b) {
	return(*(int*)b - *(int*)a);
}
int s_asort(const void* a, const void* b) {
	return(*(int*)a - *(int*)b);
}
int l_cins2(int n, long* a, long* b) {
	int i;
	rept(i, 0, n) {
		l_cin2(*(a + i), *(b + i));
	}
	return 0;
}
int i_cins(int n, int* a) {
	int i;
	for (i = 0; i < n; i++) {
		i_cin(*(a + i));
	}

	return 0;
}
int _gcd(int a, int b) {
	int r, tmp;
	if (a < b) { tmp = a; a = b; b = tmp; }
	r = a % b;
	while (r) {
		if (!r) break;
		a = b; b = r;
		r = a % b;
	}
	return(b);
}

long _max(long a, long b) {
	return a > b ? a : b;
}
long _min(long a, long b) {
	return a < b ? a : b;
}
int _swp(int* a, int* b)
{
	int tmp;
	tmp = *b; *b = *a; *a = tmp;
	return 0;
}

int _cknum(char* a, int n) {
	int i;
	char t = '0';

	for (i = 0; i < n; i++) {
		if (a[i] < '0' || a[i]>'9') return 1;
	}
	return 0;
}


int _atoi(char* s, int len) {
	char tmp[20];
	memcpy(tmp, s, len);
	tmp[len] = 0x00;
	return (atoi(tmp));
}
#pragma endregion


#include <stdio.h>

#include<stdio.h>

int main(void)
{
	int  i, cnt = 0;
	int  x,a[101],n;

	i_cin2(n,x);
	i_cins(n, a);
	qsort(a,n,sizeof(int),s_asort);
	
	for (i = 0; i < n; i++) {
		cnt++;
		x -= a[i];
		if (x <= 0)break;
	}

	(x) ? printf("%d\n",cnt-1) : printf("%d\n",cnt);
	
	return 0;
}



Measured memory_bytes: 1724
#include<bits/stdc++.h>
using namespace std;
typedef long long int llint;
typedef long int lint;
typedef vector<char> vchar;
typedef vector<int> vint;
typedef vector<vector<int>> vvint;
typedef vector<vector<char>> vvchar;
#define vsort(v) sort((v).begin(), (v).end())
#define vreverse(v) reverse((v).begin(), (v).end())
#define pb(a) push_back(a)
#define INF 1000000007
#define MOD 1e9+7#include<bits/stdc++.h>
using namespace std;
typedef long long int llint;
typedef long int lint;
typedef vector<char> vchar;
typedef vector<int> vint;
typedef vector<vector<int>> vvint;
typedef vector<vector<char>> vvchar;
#define vsort(v) sort((v).begin(), (v).end())
#define vreverse(v) reverse((v).begin(), (v).end())
#define pb(a) push_back(a)
#define INF 1000000007
int main(){
  //input
  lint n,m,i,pa;cin>>n>>m;lint b,c;
  priority_queue<lint,vint,greater<lint>> a;
  pair<int,int> cb[m]={};
  for(i=0;i<n;i++){
    cin>>pa;
    a.push(pa);
  }
  for(i=0;i<m;i++){
    cin>>b>>c;
    cb[i]=make_pair(c,b);
  }
  //caricurate
  i=0;lint j;
  sort(cb,cb+m);reverse(cb,cb+m);
  while(cb[i].first>a.top()){
    j=0;
    while((cb[i].first>a.top())&&(j<cb[i].second)){
      a.pop();
      a.push(cb[i].first);
      j++;
    }  
    i++;
  }
  //output
  llint ans=0;
  while(!a.empty()){
   ans+=a.top();
    a.pop(); 
  }
 cout<<ans<<endl; 
}

Measured memory_bytes: 1660
#include<math.h>
#include<cmath>
#include<bitset>
#include<stdio.h>
#include<string>
#include<map>
#include<algorithm>
#include<vector>
#include<iostream>
#include<utility>
using namespace std;
int main(){
  long long int ans=0,n,i=100;
  double a;
  scanf("%lld\n",&n);
  while(i<n){
    a=i;
    a=a*1.01;
    i=a;
    ans++;
  }
  printf("%lld\n",ans);
  return 0;
}

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

int main(){
    int N, frag=1;
    cin >> N;
    int A[N];
    for(int i = 0;i<N;i++){
        cin >> A[i];
    }
    for(int i = 0;i<N;i++){
        if(A[i]%2 ==0){
            if(A[i]%3==0 or A[i]%5==0){
                frag = frag*1;
            }else{
                frag = frag*0;
            }
        }else{
            frag = frag*1;
        }
    }
    if(frag == 1){
        cout << "APPROVED"<<endl;
    }else{
        cout << "DENIED"<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;

typedef pair<int, int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<cd> vcd;
typedef vector<vector<int>> vvi;
typedef vector<vector<ll>> vvl;
typedef unordered_map<int, int> umpii;
typedef unordered_map<ll, ll> umpll;
template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;

#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)

#define sz(x) (int)(x).size()
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()

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

const int MOD = 1000000007;
const ll INF = 1e18;
const int inf = 1e9;
const int MX = 100001; //check the limits, dummy

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

    int n, m; cin >> n >> m;
    vvi v(m, vi());
    vi c(m, 0);
    int t = 0;
    F0R(i, m){
        int a, b; cin >> a >> b;
        c[i] = a;
        F0R(j, b) {
            int x; cin >> x; x--;
            t = t | (1 << x);
            v[i].pb(x);    
        }
    }

    int q = 1 << n;
    if(t != q - 1) {
        cout << -1 << endl;
        return 0;
    }

    vvi dp(m + 1, vi(q, inf));
    F0R(i, m) dp[i][0] = 0;
    FOR(i, 1, m + 1) {
        F0R(j, q) {
            int r = j;
            for(int x : v[i - 1]) {
                r = r | (1 << x);
            }
            dp[i][j] = min(dp[i][j], dp[i - 1][j]);
            dp[i][r] = min(dp[i][r], dp[i][j] + c[i - 1]);
        }
    }

    cout << dp[m][q - 1] << endl;
}

Measured memory_bytes: 16384
H, W, M = map(int, input().split())
countH = [[h, 0] for h in range(H)]
countW = [[w, 0] for w in range(W)]
Bh = {}

for i in range(M):
  h, w = map(int, input().split())
  h, w = h-1, w-1
  if h in Bh:
    Bh[h].add(w)
  else:
    Bh[h] = {w}
  countH[h][1] += 1
  countW[w][1] += 1

countH.sort(reverse=True, key=lambda x: x[1])
countW.sort(reverse=True, key=lambda x: x[1])
#print(countH)
#print(countW)
#rint(Bh)

maxh = countH[0][1]
maxw = countW[0][1]
ans = maxh + maxw
ch = [countH[0][0]]
i = 1
while i < H and countH[i][1]==maxh:
  ch.append(countH[i][0])
  i += 1
cw = [countW[0][0]]
i = 1
while i < W and countW[i][1]==maxw:
  cw.append(countW[i][0])
  i += 1
flag = False
for h in ch:
  for w in cw:
    #print(h,w)
    if w not in Bh[h]:
      flag = True
      break
if flag:
  print(ans)
else:
  print(ans-1)

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

using namespace std;

#define int long long
#define FOR(i, a, b) for(ll i = (a); i < (b); ++i)
#define FORR(i, a, b) for(ll i = (a); i > (b); --i)
#define REP(i, n) for(ll i = 0; i < (n); ++i)
#define REPR(i, n) for(ll i = n; i >= 0; i--)
#define FOREACH(x, a) for(auto &(x) : (a))
#define VECCIN(x)                                                              \
    for(auto &youso_ : (x)) cin >> youso_
#define bitcnt __builtin_popcount
#define SZ(x) ((ll)(x).size())
#define fi first
#define se second
#define All(a) (a).begin(), (a).end()
template <typename T = long long> inline T IN() {
    T x;
    cin >> x;
    return (x);
}
inline void CIN() {}
template <class Head, class... Tail>
inline void CIN(Head &&head, Tail &&... tail) {
    cin >> head;
    CIN(move(tail)...);
}
#define CINT(...)                                                              \
    int __VA_ARGS__;                                                           \
    CIN(__VA_ARGS__)
#define LCIN(...)                                                              \
    ll __VA_ARGS__;                                                            \
    CIN(__VA_ARGS__)
#define SCIN(...)                                                              \
    string __VA_ARGS__;                                                        \
    CIN(__VA_ARGS__)
#define Yes(a) cout << (a ? "Yes" : "No") << "\n"
#define YES(a) cout << (a ? "YES" : "NO") << "\n"
#define Printv(v)                                                              \
    {                                                                          \
        FOREACH(x, v) { cout << x << " "; }                                    \
        cout << "\n";                                                          \
    }
template <typename T = string> inline void eputs(T s) {
    cout << s << "\n";
    exit(0);
}
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {
    std::fill((T *)array, (T *)(array + N), val);
}
template <typename T> using PQG = priority_queue<T, vector<T>, greater<T>>;
template <typename T> using PQ = priority_queue<T>;

typedef long long ll;
typedef unsigned long long ul;
typedef vector<ll> VL;
typedef pair<ll, ll> PL;

const int INF = 1e9;
const int MOD = 1e9 + 7;
const double PI = atan(1.0) * 4.0;
// const int MOD = 998244353;
const ll LINF = 9e18;
const ll dx[] = {1, 0, -1, 0};
const ll dy[] = {0, 1, 0, -1};

ll N;
VL p;

signed main() {
    cin >> N;
    REP(i, N) p.emplace_back(IN());
    ll ans = 0;
    FOR(i, 1, N - 1) {
        if(p[i - 1] < p[i] && p[i] < p[i + 1]) {
            ans++;
        }
        if(p[i - 1] > p[i] && p[i] > p[i + 1]) {
            ans++;
        }
    }
    cout << ans << "\n";
}


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

int main() {
  int n,m,osum = 0;
  cin >> n;
  vector<int>data(n);
  for(int i = 0;i < n;i++){
    cin >> data.at(i);
  }
  sort(data.begin(),data.end());
  m = data.at(n-1);
  for(int i = 0;i < n-1;i++){
    osum += data.at(i);
  }
  if(osum > m){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
}


Measured memory_bytes: 256
N = gets.to_i
D = gets.chomp.split(" ").map(&:to_i)
M = gets.to_i
T = gets.chomp.split(" ").map(&:to_i)
has = Hash.new(0)
req = Hash.new(0)
D.each do |x|
  has[x] += 1
end
T.each do |x|
  req[x] += 1
end
judge = "YES"
req.each do |k,v|
  if has[k] < v
    judge = "NO"
  end
end
puts judge


Measured memory_bytes: 63112
#include <iostream>
#include <string.h>
using namespace std;

#define M 1046527
#define NIL (-1)
#define L 14

char H[M][L];

int get_char(char ch) {
  switch(ch) {
    case 'A': return 1;
    case 'C': return 2;
    case 'G': return 3;
    case 'T': return 4;
    default: return 0;
  }
}

long long get_key(char str[]) {
  long long sum = 0, p = 1;
  for (int i = 0; i < (int)strlen(str); i++) {
    sum += p * get_char(str[i]);
    p *= 5;
  }
  return sum;
}

int h1(long long key) {
  return key % M;
}

int h2(long long key) {
  return key % (M - 1);
}

int myhash(long long key, int i) {
  return (h1(key) + i * h2(key)) % M;
}

bool find(char str[]) {
  long long key = get_key(str);
  long long h;
  for (int i = 0; ; i++) {
    h = myhash(key, i);
    if (strcmp(H[h], str) == 0) {
      return true;
    } else if (strlen(H[h]) == 0) {
      return false;
    }
  }
}

bool insert(char str[]) {
  long long key = get_key(str);
  long long h;
  for (int i = 0; ; i++) {
    h = myhash(key, i);
    if (strcmp(H[h], str) == 0) {
      return false;
    } else if (strlen(H[h]) == 0) {
      strcpy(H[h], str);
      return true;
    }
  }
  return false;
}

int main() {
  int n;
  char str[L], cmd[9];
  for (int i = 0; i < M; i++) {
    H[i][0] = '\0';
  }
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> cmd >> str;
    if (cmd[0] == 'i') {
      insert(str);
    } else {
      if (find(str)) {
        cout << "yes" << endl;
      } else {
        cout << "no" << endl;
      }
    }
  }
  return 0;
}



Measured memory_bytes: 17412
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <time.h>
#include <list>

using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<(n);++i)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define reps(x,c) for(auto x:c)
#define all(x) begin(x), end(x)
#define pb(a) emplace_back(a) 
#define mp(a,b) make_pair((a),(b))
#define pl pair<ll,ll>
#define INF 2147483600
#define MOD 1000000007
#define fi first
#define se second
#define dbg(x) cout << #x"="<< (x) << endl
#define dbgv(x) cout<<#x<<endl;reps(y,x){cout<<y<<" ";}cout<<endl

int main(){
  ll a,b;cin>>a>>b;
  string temp;
  ll ans=0;
  FOR(i,a,b+1){
    temp=to_string(i);
    if(temp[0]==temp[4]&&temp[1]==temp[3]){
      ans++;
    }
  }
  cout<<ans<<endl;
  return 0;
}

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

m = 0
now = 0
for i in range(n):
    x,y = map(int, input().split())
    if x == y:
        now += 1
        m = max(m, now)
    else:
        now = 0

if m >= 3:
    print("Yes")
else:
    print("No")

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

double PI = acos(-1);
int main(){
  cout << setprecision(10) << fixed;
  int n;
  cin >> n;
  vector<int>a(n), b(n);
  for(int i = 0; i < n; i++)cin >> a[i];
  for(int i = 0; i < n; i++)cin >> b[i];
  for(int i = 1; i < 4; i++){
    double sum = 0;
    for(int j = 0; j < n; j++)sum += pow(abs(a[j] - b[j]), i);
    cout << pow(sum, double(1) / i) << endl;
  }
  int mx = 0;
  for(int i = 0; i < n; i++){
    int d = abs(a[i] - b[i]);
    if(d > mx)mx = d;
  }
  cout << mx << endl;
}


Measured memory_bytes: 3436
#include<bits/stdc++.h>
using namespace std;
#define ll long long                                    // long long省略
#define pb push_back                                    // push_back省略
#define mp make_pair                                    // make_pair省略
#define fi first                                        // first省略
#define se second                                       // second省略
#define itn int                                         // int誤字保険
#define count cout                                      // cout誤字保険
#define vecotr vector                                   // vector誤字保険
#define ednl endl                                       // endl誤字保険
#define opt() cin.tie(0); ios::sync_with_stdio(false)   // 入出力速度改善

#define rep(i,l,r) for(ll i=(l);i<(r);i++)               // 範囲[l, r)で刻み1のfor文(順方向)
#define repp(i,l,r,k) for(ll i=(l);i<(r);i+=(k))         // 範囲[l, r)で刻みkのfor文(順方向)
#define rrep(i,l,r) for(ll i=(r-1);i>=(l);i--)           // 範囲[l, r)で刻み1のfor文(逆方向)
#define rrepp(i,l,r,k) for(ll i=(r-1);i>=(l);i-=(k))     // 範囲[l, r)で刻みkのfor文(逆方向)
#define all(x) (x).begin(), (x).end()                   // vectorのポインタ位置指定用
#define max(p,q)((p)>(q)?(p):(q))                       // max拡張
#define min(p,q)((p)<(q)?(p):(q))                       // min拡張
#define bit(n,m)(((n)>>(m))&1)                          // 変数nのm番目のbitを取り出す

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; }

int dy[]={0, 1, 0, -1};                                 // 4方向近傍
int dx[]={1, 0, -1, 0};                                 // 4方向近傍

#define INF ((1LL<<62)-(1LL<<31))
//#define MOD 998244353
#define MOD 1000000007
#define invp(a,p) pom(a,p-2,p)

////////////////////////////////////////////////////////////////////////////////////////
int main(){
    int a1, a2, a3; cin >> a1 >> a2 >> a3;
    if(a1 + a2 + a3 >= 22) cout << "bust" << ednl;
    else cout << "win" << ednl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long int
#define cases int t; cin >> t; while (t--)
using namespace std;

int n;

int prime(int x)
{
    for (int i = 2; i*i <=x; i++) if (x%i==0) return 0;
    return 1;
}

int main()
{
    cin >> n;
    int count  = 0, x = 3;
    while (count < n)
    {
        if (prime(x)) 
        {
            cout << x << " ";
            count++;
        }
        x += 10;
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main() {
	int c;
	
	while((c = getchar()) != EOF) {
		if(c >= 'A' && c <= 'Z') {
			c = c - 'A' + 'a';
		}else if(c >= 'a' && c <= 'z') {
			c = c - 'a' + 'A';
		}
		putchar(c);
	}
	return 0;
}

Measured memory_bytes: 524
# -*- coding: utf-8 -*-


def main():
    raw_input()  # pass length
    candidate_number_list = [int(x) for x in raw_input().strip().split(' ')]
    raw_input()  # pass length
    target_number_list = [int(x) for x in raw_input().strip().split(' ')]

    representable_number_set = {0}
    for candidate_number in candidate_number_list:
        for num in representable_number_set.copy():
            representable_number_set.add(num + candidate_number)

    for target_number in target_number_list:
        if target_number in representable_number_set:
            print "yes"
        else:
            print "no"

if __name__ == "__main__":
    main()

Measured memory_bytes: 6424
// https://atcoder.jp/contests/

#include <iostream>
using namespace std;

int main()
{
  /* Magic word */
  cin.tie(0);
  ios::sync_with_stdio(false);
  /* ---------- */

  string s;

  cin >> s;

  for (size_t i = 0; i < s.length(); i++)
  {
    if (s[i] == ',')
      s[i] = ' ';
  }

  cout << s << "\n";

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int i,j,x;
    float m;
    cin>>x;
    m=round(x/1.08);
   // cout<<m<<"\n";
    if(x==floor(m*1.08))
    cout<<m;
    else if (x==floor((m+1)*1.08))
    cout<<m+1;
    else
    cout<<":(";
    return 0;
}

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

namespace MyProgram
{
    public class Program
    {	
        public static void Main(string[] args)
        {
            int[] n = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();
            int N = n[0];
            int T = n[1];
            int min = 99999999;
            
            int cost,time;
            for(int i = 0 ; i < N ;i++)
            {
                n = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();
                cost = n[0];
                time = n[1];
                
                if(time <= T)
                {
                    min = Math.Min(min, cost);
                }
            }
            
            if(min == 99999999)
            {
                Console.WriteLine("TLE");
            }
            else
            {
                Console.WriteLine(min);
            }
        }
    }
}

Measured memory_bytes: 13268
#include <stdio.h>

int main(void) {
	int a, b, c, temp;

	scanf("%d %d", &a, &b);

	if (a < b) {
		temp = a;
		a = b;
		b = temp;
	}

	c = a % b;

	while (c != 0) {
		a = b;
		b = c;
		c = a % b;
	}
	printf("%d\n", b);

	return 0;
}



Measured memory_bytes: 2080
from fractions import gcd
N, K = map(int, input().split())
A = sorted(list(map(int, input().split())), reverse=True)
gcm = 10**9+7
for i in range(N-1):
    gcm = min(gcm, gcd(A[i], A[i+1]))
if N == 1:
    print('IMPOSSIBLE' if K != A[0] else 'POSSIBLE')
    exit()

print('POSSIBLE' if K % gcm == 0 and K <= A[0] else 'IMPOSSIBLE')

Measured memory_bytes: 16208
#include<stdio.h>
int main()
{
    int i=0, j, k=0, n;
    scanf("%d", &n);
    int A[n], B[n], C[2000001];
    for(i = 0; i < n; i++) scanf("%d", &A[i]);
    for(i = 0; i < 2000001; i++) C[i] = 0;

    for(i = 0; i < n; i++) C[A[i]]++;
    i = 0;
    k = 0;
    while(i < n) {
    for(j = 0; j < C[k]; j++) {
        B[i] = k;
        i++;
    }
    k++;
    }

    for(i = 0; i < n - 1; i++) printf("%d ", B[i]);
    printf("%d\n", B[n-1]);
    return 0;
}



Measured memory_bytes: 25204
#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 (int 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;
typedef unsigned long long ull;
typedef long double ld;
const ll mod = 1000000007;
//const ll mod = 998244353;
const int inf = 1e9 + 10;
const ll INF = 1e18;
const ld EPS = 1e-10;
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
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 (a>b) { a=b; return 1; } return 0; }

int n, m;
string s;
vector<int> G[200200];

int cnt[200200][2];
bool visited[200200];

void deg(int v) {
  for (int u: G[v]) {
    cnt[v][s[u] - 'A']++;
  }
}

void solve() {
  queue<int> q;
  rep(i, n) {
    if (cnt[i][0] == 0 || cnt[i][1] == 0) {
      q.push(i);
    }
  }
  while (q.size()) {
    int v = q.front();
    q.pop();
    if (visited[v]) continue;
    visited[v] = true;
    cnt[v][0] = 0;
    cnt[v][1] = 0;
    for (int u: G[v]) {
      if (u == v) continue;
      if (visited[u]) continue;
      if (--cnt[u][s[v] - 'A'] == 0) q.push(u);
    }
  }
  rep(v, n) {
    if (cnt[v][0] || cnt[v][1]) {
      cout << "Yes\n";
      return;
    }
  }
  cout << "No\n";
}

int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout << fixed << setprecision(25);

  cin >> n >> m;
  cin >> s;
  rep(i, m) {
    int a, b;
    cin >> a >> b;
    a--, b--;
    G[a].push_back(b);
    if (a != b) G[b].push_back(a);
  }

  rep(i, n) deg(i);
  solve();




  
  return 0;
}

Measured memory_bytes: 15528
// https://atcoder.jp/contests/abc093/tasks/abc093_b

#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 (int(i) = (m); (i) < (n); i++)
#define INF 1e9
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;

int main()
{
  /* Magic word */
  // cin.tie(0);
  // ios::sync_with_stdio(false);
  /* ---------- */

  int a, b, k;
  set<int> r;

  cin >> a >> b >> k;

  FOR(i, a, min(a + k, b + 1))
  {
    r.insert(i);
  }
  FOR(i, max(a, b - k + 1), b + 1)
  {
    r.insert(i);
  }

  for (auto &rr : r)
  {
    cout << rr << '\n';
  }

  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main()
{
	int x,n,p[101],f=0,t=101,a=0,i,j;

	scanf("%d%d",&x,&n);
	for(i=0;i<n;i++)
		scanf("%d",&p[i]);

	for(i=0;i<=101;i++){
		for(j=0;j<n;j++)
			if(i==p[j])
				f=1;
		if(f==0&&abs(x-i)<t){
			t=abs(x-i);
			a=i;
		}
		f=0;
	}
	printf("%d",a);
	return 0;
}

Measured memory_bytes: 1732
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<sstream>
#include<unordered_map>
#include<unordered_set>
#include<vector>
using namespace std;
using uint = unsigned int;
using ll = long long;
const int M = 1e9 + 7;
const ll MLL = 1e18L + 9;
#pragma unused(M)
#pragma unused(MLL)
#ifdef LOCAL
#include"rprint.hpp"
#else
template <ostream& out = cout, class... T> void prints(T&&...){ }
template <ostream& out = cout, class... T> void printd(T&&...){ }
template <ostream& out = cout, class... T> void printb(T&&...){ }
template <ostream& out = cout, class... T> void printArr(T&&...){ }
#endif

int main(){
    ll n, a, b;
    cin >> n >> a >> b;
    vector<int> hs(n);
    for(int i = 0; i < n; i++){
        cin >> hs[i];
        // scanf("%d", &hs[i]);
    }
    sort(hs.rbegin(), hs.rend());
    auto solve = [&](int num){
        int cnt = num;
        for(int i = 0; i < n; i++){
            ll hp = hs[i] - b * num;
            if(hp <= 0){ break; }
            cnt -= (hp + a - b - 1) / (a - b);
            if(cnt < 0){
                break;
            }
        }
        return cnt >= 0;
    };
    int l = 0, r = 1e9;
    while(l < r){
        int piv = (l + r) / 2;
        if(solve(piv)){
            r = piv;
        }else{
            l = piv + 1;
        }
        prints(l, r);
    }
    cout << l << '\n';
    return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main(void){
    int N;
    long ans = 0;
    cin >> N;
    vector<int> V(N);
    for(int i=0;i<N;i++) {
        cin >> V[i];
        ans += V[i];
    }
    sort(V.begin(),V.end());
    cout<<ans - V[V.size()-1] +V[V.size()-1]/2;
}



Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(void){
    // Your code here!
    int N;
    cin >> N;
    vector<int> A(N);
    int mmax=0;
    int smax = 0;
    for(int i=0;i<N;i++){
        cin >> A.at(i);
    }
    
    vector<int> B(N); B = A;
    sort(B.begin(),B.end());
    mmax = B.at(N-1);
    smax = B.at(N-2);
    
    for(int i=0;i<N;i++){
        if(A.at(i)==mmax){
            cout <<  smax << endl;
        }else{
            cout << mmax << endl;
        }
    }
   
}

Measured memory_bytes: 3200
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int r = sc.nextInt();

        if(n<10){
            int innerRating = 100*(10-n);
            System.out.println(r+innerRating);
        } else{
            System.out.println(r);
        }

    }

}


Measured memory_bytes: 21844
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
	ll n,k;
	cin>>n>>k;
	ll arr[n];
	for(int i=0;i<n;i++)
		cin>>arr[i];
	vector<ll> dp(n,1000000000);
	dp[0] = 0;
	for(int i=1;i<n;i++)
	{
		for(int j=1;j<=k;j++)
			dp[i] = min(dp[i],(i-j>=0)?dp[i-j]+abs(arr[i-j]-arr[i]):1000000000);
	}
	cout<<dp[n-1]<<endl;
}

Measured memory_bytes: 1792
#include <algorithm>
#include <climits>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
// const int INF = (1 << 30) - 1;
// const ll LL_INF = (1LL << 62) - 1;
// const ll MOD = 1e9 + 7;

int N, A, B, C, D;
string S;

bool solve() {
  int s_num = 0;
  for (int i = A + 1; i < D; i++) {
    if (S[i] == '#') {
      s_num++;
      if (s_num == 2) {
        return false;
      }
    } else {
      s_num = 0;
    }
  }

  if (C > D) {
    bool ok = false;
    int d_num = 0;
    for (int i = B - 1; i < D + 2; i++) {
      if (S[i] == '.') {
        d_num++;
        if (d_num == 3) {
          ok = true;
          break;
        }
      } else {
        d_num = 0;
      }
    }
    if (!ok) {
      return false;
    }
  }

  return true;
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> N >> A >> B >> C >> D;
  cin >> S;
  A--;
  B--;
  C--;
  D--;

  if (solve()) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}

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

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

LL N,A,B;

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

    if (A>B || (N==1 && A<B)){
        cout << 0 << "\n";
        return 0;
    }

    if (N==1) cout << 1 << "\n";
    else cout << ((N-1)*B+A)-((N-1)*A+B)+1 << "\n";
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
using namespace std;
#define rg register
#define il inline
int read(){
	int x=0, p=1; char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-') p=0; ch=getchar();}
	while(ch>='0'&&ch<='9') x=(x<<1)+(x<<3)+(ch^48), ch=getchar();
	return p?x: -x;
}
const int mod=1e9+7;
int qpow(int x, int y){
	int ans=1;
	while(y){
		if(y&1) ans=1ll*ans*x%mod;
		x=1ll*x*x%mod, y>>=1;
	} return ans;
}
const int o=2001;
const int inv2=500000004;
#define _ 4010
#define __ 200010
int n, a[__], b[__], f[_][_], sum[__], inv[__], ans;
int main(){
	sum[0]=sum[1]=1, inv[1]=1;
	for(int i=2; i<=16000; ++i)
		sum[i]=1ll*sum[i-1]*i%mod, inv[i]=qpow(sum[i], mod-2);
	
	n=read();
	for(rg int i=1; i<=n; ++i){
		a[i]=read(), b[i]=read();
		++f[o-a[i]][o-b[i]];
	}
	
	for(int i=1; i<=4001; ++i)
		for(int j=1; j<=4001; ++j)
			f[i][j]+=(f[i-1][j]+f[i][j-1])%mod;
	
	for(int i=1; i<=n; ++i){
		int ex=1ll*sum[(a[i]+b[i])<<1]*inv[a[i]<<1]%mod*inv[b[i]<<1]%mod;
		(ans+=f[a[i]+o][b[i]+o]-ex)%=mod;
	}
	
	(ans+=mod)%=mod, ans=1ll*inv2*ans%mod;
	printf("%d\n", ans);
	return 0;
}


Measured memory_bytes: 64768
#pragma GCC optimize ("Ofast")
#pragma GCC optimize ("unroll-loops")
#include <bits/stdc++.h>
#define DAU  ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define PLEC exit(0);
using namespace std;
int res, n;
string s;
int main() {
    DAU
    cin >> s;
    n = static_cast<int>(s.size());
    s = '$' + s;
    for (size_t i = 1; i <= n / 2; ++i)
        res += (s[i] != s[n - i + 1]);
    cout << res;
    PLEC
}


Measured memory_bytes: 3628
#include <iostream>
#include <algorithm>
#include <climits>
#include <numeric>
#include <iomanip>
#include <cmath>
#include <vector>
#include <set>
#include <unordered_set>
#include <string>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <unordered_map>

#define barsik ios::sync_with_stdio(false)
#define all(x) begin(x), end(x)
#define rall(x) rbegin(x), rend(x)

typedef long long ll;
typedef std::vector<int> vi;
typedef std::pair <int, int> pii;
typedef std::unordered_set <int> u_si;

using namespace std;

void solve(){
    ll n, m;
    cin >> n >> m;
    ll ans = min(n, m / 2);
    n -= ans;
    m -= ans * 2;
    //cout << n << " " << m << endl;
    if(m > 0){
        ans += (m / 4);
    }
    cout << ans;
}

int main(){
    barsik;
    int q = 1;
    //cin >> q;
    while(q--) solve();
}



Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <cmath>
#include <cstring>
#include <sstream>
#include <algorithm>
#include <cstdlib>
#include <map>
#include <queue>
#include <utility>
#include <vector>
#include <set>
#include <memory.h>
#include <iomanip>
#include <bitset>
#include <list>
#include <stack>

using namespace std;

#define mod 1000000007

int n;
string s;

vector<int> solve(int s0, int s1)
{
	// 0 -> 羊　1 -> 狼
	vector<int> ans;
	ans.push_back(s0);
	ans.push_back(s1);
	// cout << ans[0];
	for(int i = 1; i < n - 1; i++){
		if(ans[i] == 0){
			if(s[i] == 'o') ans.push_back(ans[i - 1]);
			else ans.push_back((ans[i - 1] + 1) % 2);
		} else {
			if(s[i] == 'o') ans.push_back((ans[i - 1] + 1) % 2);
			else ans.push_back(ans[i - 1]);
		}
		// cout << ans[i];
	}
	// cout << endl;
	if(ans[0] == 0){
		if((s[0] == 'o' && ans[n - 1] != ans[1]) || (s[0] == 'x' && ans[n - 1] == ans[1])) return vector<int>();
	} else {
		if((s[0] == 'o' && ans[n - 1] == ans[1]) || (s[0] == 'x' && ans[n - 1] != ans[1])) return vector<int>();
	}
	if(ans[n - 1] == 0){
		if((s[n - 1] == 'o' && ans[n - 2] != ans[0]) || (s[n - 1] == 'x' && ans[n - 2] == ans[0])) return vector<int>();
	} else {
		if((s[n - 1] == 'o' && ans[n - 2] == ans[0]) || (s[n - 1] == 'x' && ans[n - 2] != ans[0])) return vector<int>();
	}
	return ans;
}

int main()
{
	cin >> n >> s;
	for(int i = 0; i < 2; i++){
		for(int j = 0; j < 2; j++){
			vector<int> tmp = solve(i, j);
			if(tmp.size() == n){
				for(int k = 0; k < n; k++){
					if(tmp[k] == 0) cout << "S";
					else cout << "W";
				}
				cout << endl;
				return 0;
			}
		}
	}
	cout << -1 << endl;
	return 0;
}

Measured memory_bytes: 1444
//FIRST THINK THEN CODE.

#include <bits/stdc++.h>
 
 
using namespace std;
 
typedef long long ll;
 
//#define MOD 998244353
#define rep(i,a,b) for(ll i=a;i<b;++i)
#define rrep(i,a,b) for(ll i=a;i>b;--i)
#define FOR(i,n)  for(ll i=0;i<n;i++)
#define vi vector<int>
#define vl vector<ll>
#define ld long double
#define vvi vector<vector<int>>
#define vvl vector<vector<long long>>
#define pii pair<int,int>
#define pll pair<long,long>
#define vpii vector<pii>
#define vpll vector<pll>
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define bs binary_search
#define d1(x) cout<<(x)<<endl
#define d2(x,y) cout<<(x)<<" "<<(y)<<endl
#define d3(x,y,z) cout<<(x)<<" "<<(y)<<" "<<(z)<<endl
#define d4(a,b,c,d) cout<<(a)<<" "<<(b)<<" "<<(c)<<" "<<(d)<<endl
#define PI 3.1415926535897932384626433832795
#define fix(f,n) fixed<<setprecision(n)<<f
#define all(x) x.begin(),x.end()
#define rev(p) reverse(p.begin(),p.end());
#define endl "\n"
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define popcount(x) __builtin_popcountll(x)
#define sz(x) ((ll)x.size())
const ll M=1000000007;
const ll MM=998244353;
int begtime = clock();
#define end_routine() cout << "\n\nTime elapsed: " << (clock() - begtime)*1000/CLOCKS_PER_SEC << " ms\n\n";

 
ll newmod(ll a,ll b)
 {
  return ((a%b)+b)%b;
}
 
 
ll powM(ll a,ll b,ll m )
{ 
  if(a<=0)return 0;
  a%=m;
  if(!b)return 1;
  ll ans=1LL;
  while(b)
  {
    if(b&1)ans=ans*a%m;
    a=a*a%m;
    b>>=1;
  }
 
return ans;
}


 
ll poww(ll a,ll b)
{ 
  
  ll ans=1;
  while(b)
  {
    if(b&1)ans=ans*a;
    a=a*a;
    b>>=1;
  }
 
return ans;

}

template<typename T,typename F>
void chmax( T &a,F b){
  if(b>a)a=b;
}

template<typename T,typename F>
void chmin( T &a,F b){
  if(b<a)a=b;
}

const ll N=1e5+5;



int main()
{ 

IOS;

ll x;cin>>x;

vl f(N);

f[0]=1;

vl v={100,101,102,103,104,105};

for(auto p:v)
for(int i=0;i<N;i++){
  if(f[i]){
    if(i+p<N)f[i+p]=1;
  }
}

cout<<f[x];

//end_routine();

return 0;
 
}


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

int main(void) {
    int n, a[101], m, ans, total = 0, count = 0;
    double per;
    scanf("%d %d", &n, &m);
    for (int i = 0; i < n; i++) {
        scanf("%d", &a[i]);
    }
    per = 1.0 / ((double)m * 4.0);
    for (int i = 0; i < n; i++) {
        total = total + a[i];
    }
    for (int i = 0; i < n; i++) {
        if ((double)a[i] / total >= per) {
            count = count + 1;
        }
    }
    if (count >= m) {
        printf("Yes\n");
    } else {
        printf("No\n");
    }
}

Measured memory_bytes: 1628
#include "bits/stdc++.h"

using namespace std;
using ll = long long int;

constexpr ll Mod = 1000000000 + 7;

// a^n MOD mod
template<typename T>
T ModPow(T a, T n, T mod)
{
	T res = 1;

	while (n > 0)
	{
		if (n & 1)
			res = res * a % mod;
		a = a * a % mod;
		n >>= 1;
	}

	return res;
}

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

	vector<ll> G(k + 10);

	for (int i = k; i >= 1; i--)
	{
		G[i] = ModPow<ll>(k / i, n, Mod);

		for (int j = i + i; j <= k; j += i)
		{
			G[i] = (G[i] - G[j] + Mod) % Mod;
		}
	}

	ll ans = 0;
	for (int i = 0; i < G.size(); i++)
	{
		ans = (ans + G[i] * i) % Mod;
	}

	cout << ans << endl;
}

Measured memory_bytes: 3956
N,_=gets.chomp.split(' ').map{|n| n.to_i}
A = Array.new(N)
0.upto(N-1){|d|
	A[d]=gets.chomp.split(' ').map{|n| n.to_i}
}
Asort = A.sort{|a,b|a[1]<=>b[1]}
# p Asort
sum = 0
for i in 0..(N-1)
	t = Asort[i][0]
	d = Asort[i][1]
	sum += t
	if(sum > d)
		puts "No"
		exit(0)
	end
end
puts "Yes"

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

int main() {
  int H,W,N;
  cin >> H >> W >> N;
  
  int M = max(H, W);
  int ans = 0;
  
  if (N > 0){
    for (int i = 0; M * i < N; i++){
    ans++;
    }
  }
  
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <iostream>
#include <utility>
#include <set>
#include <cctype>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
using namespace std;
#define INF 100000000

typedef long long ll;
const int dx[] = {1, 0, -1, 0};
const int dy[] = {0, 1, 0, -1};

const int MAXN = 100;
int Y[MAXN];
int N, A, B, C, X;

int main(void) {
    while (cin >> N >> A >> B >> C >> X) {
        if ((N | A | B | C | X) == 0) break;
        for (int i = 0; i < N; i++) cin >> Y[i];
        int i = 0, cur = 0;
        while (1) {
            if (X == Y[cur]) cur++;
            if (cur == N) break;
            X = (A*X+B) % C;
            i++;
            if (i > 10000) break;
        }
        if (i > 10000) cout << -1 << endl;
        else cout << i << endl;
    }
    return 0;
}

Measured memory_bytes: 1160
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<string>
#include<string.h>
#include<math.h>
#include<stdlib.h>
#include<vector>
#include<queue>
#include<map>
#include<tuple>
#include<bitset>
#include<iomanip>
#define rep(index,num) for(int index=0;index<num;index++)
#define rep1(index,num) for(int index=1;index<=num;index++)
#define scan(argument) cin>>argument
#define prin(argument) cout<<argument<<endl
#define kaigyo cout<<endl
#define eps 1e-15
#define mp(a1,a2) make_pair(a1,a2)
typedef long long ll;
using namespace std;
typedef pair<ll,ll> pll;
typedef pair<int,int> pint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<pint> vpint;
typedef vector<pll> vpll;
ll INFl=1e+18+1;
int INF=1e+9+1;
double kion(int H,int T){
	return (double)(T-0.006*H);
}
int main(){
	int N,T,A;
	int H[1001];
	double absmin=INF;
	int ans=-1;
	scan(N);scan(T);scan(A);
	rep(i,N){
		scan(H[i]);
		if(fabs(kion(H[i],T)-A)<absmin){
			absmin=fabs(kion(H[i],T)-A);
			ans=i+1;
		}
	}
	prin(ans);
	return 0;
}


Measured memory_bytes: 256
#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(int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef long double ld;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int n, k, h;
  cin >> n >> k;
  int cnt = 0;
  REP(i, n) {
    cin >> h;
    if(h >= k) cnt++;
  }
  cout << cnt << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using Edge = pair<int, int>;
using Graph = vector<vector<Edge>>;
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
const ll MOD = 1000000007;
const ll nmax = 8;
const ll INF = 1e9;
bool graph[nmax][nmax];
vector<vector<ll>> dist = vector<vector<ll>>(nmax, vector<ll>(nmax, INF));
void warshall_floyd(ll n)
{
    for (size_t i = 0; i < n; i++)
    {
        for (size_t j = 0; j < n; j++)
        {
            for (size_t k = 0; k < n; k++)
            {
                dist[j][k] = min(dist[j][k], dist[j][i] + dist[i][k]);
            }
        }
    }
}

class UnionFind
{
public:
    vector<ll> Parent;

    UnionFind(ll N)
    {
        Parent = vector<ll>(N, -1);
    }
    ll find(ll A)
    {
        if (Parent[A] < 0)
            return A;
        return Parent[A] = find(Parent[A]);
    }

    ll size(ll A)
    {
        return -Parent[find(A)];
    }

    bool Union(ll A, ll B)
    {
        A = find(A);
        B = find(B);
        if (A == B)
        {
            return false;
        }
        if (size(A) < size(B))
            swap(A, B);

        Parent[A] += Parent[B];
        Parent[B] = A;

        return true;
    }
};

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

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

ll mulMod(ll a, ll b)
{
    return (((a % MOD) * (b % MOD)) % MOD);
}

ll powMod(ll a, ll p)
{
    if (p == 0)
    {
        return 1;
    }
    else if (p % 2 == 0)
    {
        ll half = powMod(a, p / 2);
        return mulMod(half, half);
    }
    else
    {
        return mulMod(powMod(a, p - 1), a);
    }
}

ll ceil(ll a, ll b)
{
    return (a + b - 1) / b;
}

void solve(long long M, std::vector<long long> d, std::vector<long long> c)
{
    ll digit = 0;
    ll digitsum = 0;
    ll ans = 0;
    for (int i = 0; i < M; i++)
    {
        digitsum += (d[i] * c[i]);
        digit += c[i];
    }

    cout << ((digitsum -1)/ 9) + digit - 1 << endl;
}

int main()
{
    long long M;
    scanf("%lld", &M);
    std::vector<long long> d(M);
    std::vector<long long> c(M);
    for (int i = 0; i < M; i++)
    {
        scanf("%lld", &d[i]);
        scanf("%lld", &c[i]);
    }
    solve(M, std::move(d), std::move(c));
    return 0;
}


Measured memory_bytes: 3328
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for(i = 0; i < n; i++)
//2D::rep(i,j)rep(j,j)cin>>bin[i][j];
//vector<int> a(n)
#define A1 cout<<"No"<<endl
#define A2 cout<<"Yes"<<endl
#define A3 cout<<ans<<endl
#define AA(i) cout<<i<<endl
const int U=2e5+5;
const ll MOD=1000000007;
const int INF = 1001001001;

int main(){
  long double A,B; cin >> A>>B;
  ll ans = A * B;
  AA(ans);
  return 0;
}

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

int main(void){
  string s;
  long i,n;
  cin >> s;
  n=s.size();
  i=0;
  do{
    cout << s.substr(i,1);
  i+=2;
  }while(i<n);
  cout << endl;
  return 0;
}

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

int main(){
    string s;
    cin >> s;

    vector<int> alfa(26);

    for(int i = 0; i < s.length(); i++){
        alfa.at((int)s.at(i) - 97) = 1;
    }

    char ans;
    int flag = 0;

    for(int i = 0; i < 26; i++){
        if(alfa.at(i) == 0){
            int ansnum = i + 97;
            ans = (char)ansnum;
            flag = 1;
            break;
        }
    }

    if(flag == 0) cout << "None" << endl;
    else cout << ans << endl;

    return 0;
}

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

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

int main()
{
  int set;
  cin >> set;
  for(int cn = 0; cn < set; cn++)
  {
    string a;
    cin >> a;
    int n = 0;
    char c = '0';
    for(int i = 0; i < a.length(); i++)
    {
      if(a[i] != '0')
      {
        c = a[i];
        n++;
      }
      else
      {
        if(c != '0')
        {
          n--;
          int cc = c - '0';
          switch(cc)
          {
            case 0: break;
            case 1: cout << s[cc][n % 5]; break;
            case 2: case 3: case 4: case 5: case 6: case 8: cout << s[cc][n % 3]; break;
            case 7: case 9: cout << s[cc][n % 4]; break;
          }
        }
        n = 0;
        c = '0';
      }
    }
    cout << endl;
  }
}

Measured memory_bytes: 1200
import collections

N,K = map(int,(input().split()))
a = list(map(int,(input().split())))
a.insert(0,-1)

now = 1
visit = [1]
again = collections.defaultdict(lambda:-1)
again[1] = 0
c = 0

for step in range(1,N+1):
    visit.append(a[now])
    if again[ a[now] ] == -1:
        again[ a[now] ] = step
    else:
        c += 1
        if c == 1:
            loop = a[now]
            loop_step = step
    now = a[now]

re = loop_step - again[loop]

if K <= again[loop]:
    print(visit[K])
else:
    tmp = again[loop]
    for key in again.keys():
        again[key] -= tmp
    amari = (K-tmp)%re
    for key in again.keys():
        if again[key] == amari:
            print(key)

"""
print(visit)
print(again[loop])
print(loop)
print(again)
print(loop_step)
print(re)
"""

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

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

  set<int> divisors;
  
  for(int i=1;i<=sqrt(m);i++) {
    if(m % i == 0) {
      divisors.emplace(i);
      divisors.emplace(m / i);
    }
  }

  auto it = divisors.lower_bound(n);

  cout << m / (*it) << endl;
}

Measured memory_bytes: 256