akhauriyash/Code-Regression huggingface dataset:
import java.io.*;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.Deque;
import java.util.HashMap;
import java.util.List;
import java.util.NoSuchElementException;
import java.util.PriorityQueue;
import java.util.Scanner;
public class Main {
	static int[][] list;
	public static void main(String[] args) {
		
		FastScanner sc = new FastScanner();
		PrintWriter out = new PrintWriter(System.out);
		while(true) {
			int n = sc.nextInt();
			if(n == 0) break;
			int[] list = new int[n];
			for(int i = 0; i < n; i++) {
				list[i] = sc.nextInt();
			}
			Arrays.sort(list);
			long sum = 0;
			long time = 0;
			for(int i = 0; i < n; i++) {
				time += sum;
				sum += list[i];
			}
			
			out.println(time);
		}
		out.flush();
	}
	static void solv(int a, int b, boolean[] c) {
		list[a][b]++;
		if(a == 9) return;
		if(b > 1000) return;
		
		for(int i = 0; i < 101; i++) {
			if(a == 8) {
				if(!c[i]) {
					list[a+1][b+i]++;
				}
			}
			
			else if(!c[i]) {
				c[i] = true;
				solv(a+1,b+i,c);
				c[i] = false;
			}
		}
	}
}
//------------------------------//
//-----------//
class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        }else{
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }
    private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
    private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
    private void skipUnprintable() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;}
    public boolean hasNext() { skipUnprintable(); return hasNextByte();}
    public String next() {
        if (!hasNext()) throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while(isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }
    public long nextLong() {
        if (!hasNext()) throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while(true){
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            }else if(b == -1 || !isPrintableChar(b)){
                return minus ? -n : n;
            }else{
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }
    
    public int nextInt() {
    	return (int)nextLong();
    }
    

}

Measured memory_bytes: 20852
#include <stdio.h>

int main()
{
	int n, h, m ,s;
	
	scanf("%d", &n);
	h = n / 3600;
	m =(n - h * 3600) / 60;
	s = n - h * 3600 - m * 60;
	printf("%d:%d:%d\n", h, m, s);
		
	return 0;
	
} 


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

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

   printf("%.6lf", pow(l, 3) / 27);
}

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

using namespace std;

int deg[5];

int main() {
    for (int i = 1; i <= 3; i++) {
        int x, y;
        cin >> x >> y;
        deg[x]++; deg[y]++;
    }
    
    for (int i = 1; i <= 4; i++) if (deg[i] == 3) return cout << "NO", 0;
    cout << "YES";
    return 0;
}

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

typedef long long ll;

int main() 
{
    ll L,R;
    cin >> L >> R;

    if((L)/2019 != R/2019) {
       cout << 0 << endl; 
    }
    else {
        ll ans = INT_MAX;
        for(ll i=L;i<R+1;i++) {
            for(ll j=i+1;j<R+1;j++) {
                ans = min((i*j)%2019,ans);
            }
        }
        cout << ans << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef vector<ll> vl;
typedef vector<string> vs;
typedef vector<char> vc;
typedef queue<ll> ql;
typedef deque<ll> dql;
typedef priority_queue<ll, vl/*, greater<ll>*/> pql; //降順(/*昇順*/)
typedef set<ll> sl;
#define rep(i, n) for(ll i = 0; i < ll(n); ++i)
//#define rep2(i, n) for(ll i = 1; i <= ll(n); ++i)
//#define rep(i, k, n) for(ll i = k-1; i < ll(n); ++i)
#define rep2(i, k, n) for(ll i = k; i <= ll(n); ++i)
#define all(v) (v).begin(), (v).end()
bool chmin(ll &a, ll b) {if(b < a) {a = b; return 1;} return 0;}
bool chmax(ll &a, ll b) {if(b > a) {a = b; return 1;} return 0;}
const ll INF = 1LL << 60;
const ll MOD = 1e9 + 7;
//const ll MOD = 998244353;
const ll MAX = 1e6;
const char newl = '\n';

vl get_Prime_Fac(ll p) {
  vl vec(MAX+1);
  for(ll i=2; i<=MAX && p>=2; i++) {
    while(p%i==0) {p/=i; vec[i]++;}
  }
  return vec;
}

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

  ll n, p;
  cin >> n >> p;
  
  if(n==1) {cout << p << newl; return 0;}
  
  vl Prime_Fac = get_Prime_Fac(p);
  
  rep2(i, 2, MAX+1) if(Prime_Fac[i]) Prime_Fac[i]/=n;
  ll ans=1;
  rep2(i, 2, MAX+1) if(Prime_Fac[i]) ans *= (ll)pow(i, Prime_Fac[i]);
  cout << ans << newl;
  return 0;
}

Measured memory_bytes: 8064
N = int(input())
A = [int(x) for x in input().split()]

reg = A[0]
flg=True
if 0 in A:
    print(0)
    flg=False
    reg=0
for i in range(1, N):
    reg *= A[i]
    if reg>10**18:
        print(-1)
        flg=False
        break
if flg:
    print(reg)

Measured memory_bytes: 21604
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;
typedef tuple<ll, ll, ll> tll;

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    string S, T;
    cin >> S >> T;
    for (int i = 0; i < S.size(); i++)
    {
        bool canSame = true;
        for (int j = 0; j < S.size(); j++)
        {
            if (S.at((i + j) % S.size()) != T.at(j % S.size()))
            {
                canSame = false;
                break;
            }
        }
        if (canSame)
        {
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<sstream>
using namespace std;
typedef long long ll;
string i2s(ll x){
  if(x==0) return "0";
  string y;
  ll k=1;
  while(x>=k) k*=10;
  k/=10;
  for(ll i=k;i>0;i/=10){
    y+=(x/i)%10+'0';
  }
  return y;
}
ll s2i(string x){
  for(ll i=0;i<x.size();i++) if(x[i]=='.') x[i]=' ';
  stringstream ss(x);
  ll y;
  ss >> y;
  return y;
}
int main(){
  //cout << i2s(100) << endl;
  ll n;

  while(cin>>n,n){
    string buf;
    vector<string> v;
    vector<ll> d;
    ll i,j,k;
    for(i=0;i<n;i++){
      cin >> buf;
      j=0;
      while(buf[j]=='.') j++;
      v.push_back(buf);
      d.push_back(j);
    }
    while(v.size()!=1){
      //for(i=0;i<v.size();i++) cout << v[i] << endl;
      //cout << endl;
      //cout << v.size() << endl;
      k=1;
      for(i=0;i<v.size();i++){
        if(d[k]<d[i]) k=i;
      }
      //cout << k << ":" << v[k-1][v[k-1].size()-1] << endl;
      if(v[k-1][v[k-1].size()-1]=='+'){
        i=0;j=0;
        while(1) {
          if(d[k]!=d[k+i]) break;
          //j*=(v[k+i][v[k+i].size()-1]-'0');
          j+=s2i(v[k+i]);
          i++;
          if(k+i==d.size()) break;
        }
        //cout << i << ":" << j << endl;
        v[k-1]=v[k-1].substr(0,v[k-1].size()-1);
        v[k-1]+=i2s(j);
        v.erase(v.begin()+k,v.begin()+k+i);
        d.erase(d.begin()+k,d.begin()+k+i);
      }
      if(v[k-1][v[k-1].size()-1]=='*'){
        i=0;j=1;
        while(1) {
          if(d[k]!=d[k+i]) break;
          //j*=(v[k+i][v[k+i].size()-1]-'0');
          j*=s2i(v[k+i]);
          i++;
          if(k+i==d.size()) break;
        }
        //cout << i << endl;
        v[k-1]=v[k-1].substr(0,v[k-1].size()-1);
        v[k-1]+=i2s(j);
        v.erase(v.begin()+k,v.begin()+k+i);
        d.erase(d.begin()+k,d.begin()+k+i);
      }
      
    }
    cout << v[0] << endl;
  }
  return 0;
}

Measured memory_bytes: 1244
#include <iostream>
#include <string>
#include <cmath>
#include <vector>
using namespace std;
int gcd(int a, int b) {
  if (a == 0) return b;
  if (b == 0) return a;
  if(a < b) gcd(b, a);
  int r;
  while ((r = a % b)) { a = b; b = r; }
  return b;
}

int main() {
  int N, X, r = 0; cin >> N >> X; vector<int> s;
  while (N--) { int i; cin >> i; s.push_back(i); }
  for (auto i : s) r = gcd(r, abs(i - X));
  cout << r << endl;
}


Measured memory_bytes: 892
#include<stdio.h>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
 
using namespace std;
 
//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
 
//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}
 
//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
 
//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
 
//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
 
//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
 
//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))
 
//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
 
int main(void){
	string s;
	cin >> s;
	int cnt;
	for (int i = 0; i < 3; i++)
	{
		if(s[i] =='1')
			cnt++;
	}
	cout << cnt;
	return 0;
}



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

int main(){
	string inp;
	getline(cin, inp);
	for (int i = 0; i < 1200; i++){
		if (inp[i] == '\0'){
			break;
		}
		if (inp[i] >= 'A' && inp[i] <= 'Z'){
			inp[i] = inp[i]+ 'a' - 'A' ;
		} else if (inp[i] >= 'a' && inp[i] <= 'z'){
				inp[i] = inp[i]+ 'A' - 'a' ;
			}
	}
	cout << inp << endl;
}

Measured memory_bytes: 3192
#include <iostream>
#include <vector>
#include <string>
#define REP(i, start, n) for(int i = start; i < n; ++i)
#define debug(var)  do{std::cout << #var << " : ";view(var);}while(0)
#define debug2d(var)  do{std::cout << #var << " : \n";view(var);}while(0)
template<typename T> void view(T e){std::cout << e << std::endl;}
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ view(v); } }

using namespace std;
using ll = long long;


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

    vector<vector<int> > dp(s.size()+1, vector<int>(t.size()+1, 0));

    REP(i, 1, s.size()+1) REP(j, 1, t.size()+1) {
        if (s[i-1] != t[j-1]) {
            dp[i][j] = max({ dp[i-1][j], dp[i][j-1] });
        } else {
            dp[i][j] = dp[i-1][j-1] + 1;
        }
    }

    int i = s.size(), j = t.size();
    string lcs = "";
    while (true) {
        if (i == 0 || j == 0) break;

        if(s[i-1] == t[j-1]) {
            lcs = lcs + s[i-1];
            i--;
            j--;
        } else if (dp[i-1][j] > dp[i][j-1]) {
            i--;
        }  else {
            j--;
        }
    }

    reverse(lcs.begin(), lcs.end());

    cout << lcs << endl;;
    
    return 0;
}

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

long long n,maxn;

int main(){
	cin>>n;
	for(int i=0;i<=16;i++){
		for(int j=0;j<=9;j++){
			long long ret=0,v=1;
			for(int k=0;k<i;k++) {ret+=v*9LL;v*=10LL;}
			ret+=1LL*j*v;
			if(ret<=n){
				maxn=max(maxn,(long long)(i*9+j));
			}
		}
	}
	cout<<maxn<<endl;
	return 0;
}


Measured memory_bytes: 256
while 1:
 a=[list(map(int,input()))for _ in[0]*8]
 y=[sum(r)for r in a]
 x=[sum(c)for c in zip(*a)]
 if 4 in x:print('B')
 elif 4 in y:print('C')
 elif 1 in y:print('DF'[a[y.index(1)][x.index(2)]])
 elif 1 in x:print('GE'[a[y.index(2)][x.index(1)]])
 else:print('A')
 try:input()
 except:break


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

int main() {
  int n, x, m, s = 0, a = 1001;
  cin >> n >> x;
  rep(i, n) {
    cin >> m;
    s += m;
    a = min(a, m);
  }
  cout << n + (x - s) / a << endl;
}

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

using namespace std;

using int64 = long long;
const int mod = 1000003;

const int64 infll = (1LL << 62) - 1;
const int inf = (1 << 30) - 1;

struct IoSetup {
  IoSetup() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    cerr << fixed << setprecision(10);
  }
} iosetup;

template <typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p) {
  os << p.first << " " << p.second;
  return os;
}

template <typename T1, typename T2>
istream &operator>>(istream &is, pair<T1, T2> &p) {
  is >> p.first >> p.second;
  return is;
}

template <typename T>
ostream &operator<<(ostream &os, const vector<T> &v) {
  for (int i = 0; i < (int)v.size(); i++) {
    os << v[i] << (i + 1 != v.size() ? " " : "");
  }
  return os;
}

template <typename T>
istream &operator>>(istream &is, vector<T> &v) {
  for (T &in : v) is >> in;
  return is;
}

template <typename T1, typename T2>
inline bool chmax(T1 &a, T2 b) {
  return a < b && (a = b, true);
}

template <typename T1, typename T2>
inline bool chmin(T1 &a, T2 b) {
  return a > b && (a = b, true);
}

template <typename T = int64>
vector<T> make_v(size_t a) {
  return vector<T>(a);
}

template <typename T, typename... Ts>
auto make_v(size_t a, Ts... ts) {
  return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...));
}

template <typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type fill_v(T &t, const V &v) {
  t = v;
}

template <typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type fill_v(T &t, const V &v) {
  for (auto &e : t) fill_v(e, v);
}

template <typename F>
struct FixPoint : F {
  FixPoint(F &&f) : F(forward<F>(f)) {}

  template <typename... Args>
  decltype(auto) operator()(Args &&... args) const {
    return F::operator()(*this, forward<Args>(args)...);
  }
};

template <typename F>
inline decltype(auto) MFP(F &&f) {
  return FixPoint<F>{forward<F>(f)};
}

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

  string t = "";
  set<string> u = {"maerd", "remaerd", "esare", "resare"};
  for (int i = S.size() - 1; i >= 0; i--) {
    t += S[i];
    if (u.find(t) != u.end()) {
      t = "";
    }
  }

  if (t == "") {
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }
}


Measured memory_bytes: 592
import math
def anss(n):
    div = []
    for i in range(1, int(math.sqrt(n)) + 1):
        if n % i == 0:
            if n == i * i:
                div.append(i)
            else:
                div.append(i)
                div.append(n // i)
    div.sort()
    if len(div) % 2:
        return 2 * (div[len(div)// 2] - 1)
    else:
        return div[len(div) // 2] - 1 + div[(len(div) // 2) - 1] - 1
n = int(input())
print(anss(n))

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

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

#include <complex>

#include <functional>
#include <cassert>

typedef long long ll;
using namespace std;

#define debug(x) cerr << __LINE__ << " : " << #x << " = " << (x) << endl;


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


ll dp[110][10];

int main(){
  int h, w, g;
  
  cin >> h >> w >> g;
  
  dp[0][0] = 1;

  for(int i=0;i<h;i++){
    for(int p=0;p<w;p++){
      for(int j=0;j<(1<<(w-1));j++){
        bool f = false;
        int q = p; 
        for(int k=0;k<w-1;k++){
          if(((j>>k)&1) && ((j>>(k+1))&1)){
            f = true;
          }
        }
        if(f) continue;
        
        if((j>>p)&1){
          q = p+1;
        }else if(p>0 &&((j>>(p-1))&1)){
          q = p-1;
        }
        
        dp[i+1][q] = (dp[i+1][q] + dp[i][p])%mod;
      }
    }
  }

  cout << dp[h][g-1] << endl;
  
  return 0;
}



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

#define NREP() for(ll i = 0; i < n; i++)
#define MREP() for(ll j = 0; j < m; j++)
#define REP(i, x, y) for(ll i = x; i < y; i++)
#define ALL(x) (x).begin(), (x).end()
#define MSG(x) cout << x << endl;
#define MSGF(x, n) MSG(fixed << setprecision(n) << x)
#define END(x) cout << x << endl; return(0);
#define IPT(v, n) REP(i, 0, n){ cin >> v[i]; }
#define YN(x) x ? cout << "YES" << endl : cout << "NO" << endl;
#define Yn(x) x ? cout << "Yes" << endl : cout << "No" << endl;
#define yn(x) x ? cout << "yes" << endl : cout << "no" << endl;

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<double> vd;
typedef vector<vector<double>> vvd;
typedef vector<char> vc;
typedef vector<vector<char>> vvc;
typedef vector<string> vs;
typedef vector<vector<string>> vvs;

const static ll MOD = 1e9 + 7;
const static ll INF = 1LL << 30;

ll a, b, c, d, k, l, m, n, h, w, q, x, y;
string s, t;

ll ans = 0;
ll sum = 0;
ll cnt = 0;
ll cur = 0;
ll tmp = 0;
ll mini = INF;
ll maxi = 0;

double ave = 0.0;

ll mod_pow(ll base, ll power) {
    if (power == 0) return 1;
    if (power == 1) return base % MOD;
    if (power % 2 == 0) return ((mod_pow(base % MOD, (power / 2)) % MOD) * (mod_pow(base, (power / 2)) % MOD)) % MOD;
    return (base % MOD * (mod_pow(base % MOD, power - 1) % MOD)) % MOD;
}

ll mod_fact(ll number) {
    ll ret = 1;
    ll count = 1;
    while (count <= number) {
        ret *= (count % MOD);
        ret %= MOD;
        count++;
    }
    return ret % MOD;
}

ll gcd(ll a, ll b) {
    if (a < b) {
        return gcd(b, a);
    }
    ll c = a % b;
    while (c != 0) {
        a = b;
        b = c;
        c = a % b;
    }
    return b;
}

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

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

int main() {
    cin >> n >> k;
    vl p(n);
    IPT(p, n)
    sort(ALL(p));

    ll idx = 0;
    ans = 0;
    NREP() {
        ans += p[i];
        idx++;
        if (idx >= k) break;
    }
    MSG(ans)
}


Measured memory_bytes: 3604
n = gets.to_i
x = 0
bxor = Array.new(30,0)
ans = 0
n.times do
  a = gets.to_i
  x ^= a
  a ^= a-1
  30.downto(0) do |i|
    if a[i] == 1
      bxor[i] = 1
      break
    end
  end
end

29.downto(0) do |i|
  if x[i] == 1
    if bxor[i] == 1
      x ^= (1 << i+1)-1
      ans += 1
    else
      ans = -1
      break
    end
  end
end
p ans

Measured memory_bytes: 2044
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.util.StringTokenizer;

public class Main {

	public static void main(String[] args) throws IOException {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskX solver = new TaskX();
		solver.solve(1, in, out);
		out.close();
	}

	static int INF = 1 << 30;
	static int MOD = 1000000007;
	static int[] mh4 = { 0, -1, 1, 0 };
	static int[] mw4 = { -1, 0, 0, 1 };
	static int[] mh8 = { -1, -1, -1, 0, 0, 1, 1, 1 };
	static int[] mw8 = { -1, 0, 1, -1, 1, -1, 0, 1 };

	static class TaskX {
		public void solve(int testNumber, InputReader in, PrintWriter out) {

			int x = in.nextInt();
			if (x < 1200) {
				out.println("ABC");
			} else {
				out.println("ARC");
			}

		}
	}

	static class InputReader {
		BufferedReader in;
		StringTokenizer tok;

		public String nextString() {
			while (!tok.hasMoreTokens()) {
				try {
					tok = new StringTokenizer(in.readLine(), " ");
				} catch (IOException e) {
					throw new InputMismatchException();
				}
			}
			return tok.nextToken();
		}

		public int nextInt() {
			return Integer.parseInt(nextString());
		}

		public long nextLong() {
			return Long.parseLong(nextString());
		}

		public double nextDouble() {
			return Double.parseDouble(nextString());
		}

		public int[] nextIntArray(int n) {
			int[] res = new int[n];
			for (int i = 0; i < n; i++) {
				res[i] = nextInt();
			}
			return res;
		}

		public long[] nextLongArray(int n) {
			long[] res = new long[n];
			for (int i = 0; i < n; i++) {
				res[i] = nextLong();
			}
			return res;
		}

		public InputReader(InputStream inputStream) {
			in = new BufferedReader(new InputStreamReader(inputStream));
			tok = new StringTokenizer("");
		}
	}

	static void print(int[][] dp) {
		int n = dp.length;
		int m = dp[0].length;

		for (int i = 0; i < n; i++) {
			for (int j = 0; j < m; j++) {
				System.out.print(dp[i][j] + " ");
			}
			System.out.print("\n");
		}
		System.out.print("\n");
	}
}

Measured memory_bytes: 21588
#include<bits/stdc++.h>
#define prArr(Arr,n) for(int _=0;_<n;_++)   cout<<(Arr)[_]<<" ";
using namespace std;
const int INF=(int)0x3f3f3f3f;
const int MOD=(int)1e9+7;

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    long long x,cur=100;
    cin>>x;
    for(int i=1;;i++)
    {
        cur+=cur/100;
        if(cur>=x)
            return cout<<i,0;
    }
    return 0;
}


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

using namespace std;
using uint = unsigned int;
using int64 = long long;
using i64 = int64;
using uint64 = unsigned long long;
using vint = vector<int>;
using vint64 = vector<int64>;
template<typename T>
using p_que = priority_queue<T>;
#define rep(i,N) for(int i=0;i<(int)(N);++i)
#define rep1(i,N) for(int i=1;i<=(int)(N);++i)
#define fs first
#define sc second
#define eb emplace_back
#define all(x) x.begin(),x.end()

template<typename T>
vector<T> make_v(size_t a, T b) { return vector<T>(a, b); }
template<typename... Ts>
auto make_v(size_t a, Ts... ts) {
	return vector<decltype(make_v(ts...))>(a, make_v(ts...));
}

template<class T> ostream& operator<<(ostream& os, const vector<T>& v) {
	os << "[";
	for (auto& e : v) os << e << ", ";
	return os << "]";
}

template<class T, class U> ostream& operator<<(ostream& os, const pair<T, U> p) {
	return os << "P(" << p.first << ", " << p.second << ")";
}

template<class T, class U> ostream& operator<<(ostream& os, const map<T, U>& mp) {
	os << "{";
	for (auto& e : mp) os << e << " ";
	return os << "}";
}

void Main();
signed main() {
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(20);
	Main();
}

/* Cut from here! */

//#define int long long

void Main() {
	int x1, x2; cin >> x1 >> x2;
	cout << abs(x1 - x2) << endl;
}


Measured memory_bytes: 3168
import java.util.Scanner;

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

        switch(N % 10){
            case 3:
                System.out.println("bon");
                break;

            case 0:
            case 1:
            case 6:
            case 8:
                System.out.println("pon");
                break;

            default:
                System.out.println("hon");
                break;
        }
    }
}


Measured memory_bytes: 35836
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>

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

using namespace std;

int intrev(int n){
	int ret = 0;
	while(n > 0){
		ret *= 10;
		ret += n%10;
		n /= 10;
	}
	return ret;
}

int main(){
	int n;
	cin >> n;
	int d = 10000, ans = -1;
	for(int i = 0; i < 10000; i++){
		if(i != intrev(i)) continue;
		if(d > abs(n-i)){
			d = abs(n-i);
			ans = i;
		}
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 1164
import sys
import os

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

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

MOD = 10 ** 9 + 7


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

    N, M = il()
    S = [il()[1:] for _ in range(M)]
    P = il()

    ans = 0
    for i in range(1 << N):
        for m in range(M):
            cnt = 0
            for j in range(N):
                if i >> j & 1 and j+1 in S[m]:
                    cnt += 1
            if cnt % 2 != P[m]:
                break
        else:
            ans += 1

    print(ans)


if __name__ == '__main__':
    main()


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

int main() {
  int n, q;
  string s;
  cin >> n >> q >> s;
  vector<int> v(s.size());
  int cnt = 0;
  for (int i = 0; i < s.size(); i++) {
    bool flag = false;
    if (s.at(i) == 'A' && i < s.size() - 1) {
      if (s.at(i + 1) == 'C') {
        flag = true;
      }
    }
    if (flag) {
      v.at(i) = cnt;
      cnt++;
      v.at(i + 1) = cnt;
      i++;
    } else {
      v.at(i) = cnt;
    }
  }
  for (int i = 0; i < q; i++) {
    int l, r;
    cin >> l >> r;
    cout << v.at(r - 1) - v.at(l - 1) << endl;
  }
}

Measured memory_bytes: 1408
import java.util.*;
public class Main{

	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();
		int C = sc.nextInt();
		int X = sc.nextInt();
		int Y = sc.nextInt();
		int price1 = 0;
		int price2 = 0;
		int price3 = 0;
		int price = 0;
		
		//個別
		price2 = (X * A) + (Y * B);
		
		if(X > Y){
			price3 = C * X * 2;
			price1 += C * Y * 2;
			X -= Y;
			price1 += X * A;
		}else{
			price3 = C * Y * 2;
			price1 += C * X * 2;
			Y -= X;
			price1 += Y * B;
		}
		
		price = Math.min(price1, price2);
		price = Math.min(price, price3);
		
		System.out.println(price);
	}
}


Measured memory_bytes: 25172
N, M, C = (int(i) for i in input().split())
B = [int(i) for i in input().split()]
ans = 0
for i in range(N):
  s = C
  A = [int(j) for j in input().split()]
  for j in range(M):
    s += A[j]*B[j]
  if s > 0:
    ans += 1
print(ans)

Measured memory_bytes: 38384
use proconio::fastout;
use proconio::input;
#[allow(unused_imports)]
use proconio::marker::*;

#[fastout]
fn main() {
    input! {
        n: isize,
        m: usize,
        a: [isize; m],
    }
    let sum_a: isize = a.iter().sum();
    println!("{}", std::cmp::max(-1, n - sum_a));
}


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

int main(){
    int A,B,C,D,E,F;
    cin >> A >> B >> C >> D;
    if(A%D==0){
        E=A/D;
    }else{
        E=A/D+1;
    }
    if(C%B==0){
        F=C/B;
    }else{
        F=C/B+1;
    }
    if(E>=F){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}

Measured memory_bytes: 3636
#include <iostream>
#include <queue>
#define rep(i, n) for (int i = 0; i < (n); ++i)

using namespace std;
using ll = long long;

int main () {
    int x, y, a, b, c;
    cin >> x >> y >> a >> b >> c;

    priority_queue<int> p, q, r;
    rep(i, a) {
        int temp;
        cin >> temp;
        p.push(temp);
    }
    rep(i, b) {
        int temp;
        cin >> temp;
        q.push(temp);
    }
    rep(i, c) {
        int temp;
        cin >> temp;
        r.push(temp);
    }

    priority_queue<int> que;
    rep(i, x) {
        int top = p.top();
        p.pop();
        que.push(top);
    }
    rep(i, y) {
        int top = q.top();
        q.pop();
        que.push(top);
    }
    rep(i, c) {
        int top = r.top();
        r.pop();
        que.push(top);
    }

    ll result = 0;
    rep(i, x + y) {
        int top = que.top();
        que.pop();
        result += top;
    }

    cout << result << endl;
    return 0;
}

Measured memory_bytes: 3572
//http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=DPL_1_B&lang=jp
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<string>
#include<vector>
#include<deque>
#include<queue>
#include<numeric>

using std::cout;
using std::cin;
using std::setw;
using std::setfill;
using std::string;
using std::pair;
using std::make_pair;
using std::vector;
using std::queue;
using std::deque;
using std::priority_queue;
using std::next_permutation;
using std::iota;
using std::sort;
using std::greater;
using std::max;
using std::min;

#define INF 999999999
#define MOD 1000000007

#define EVEL 1

#ifndef EVEL
#define dbug(X) std::cout << #X << ":" <<X<<" " ;
#define dbugf(s) std::cout << s << " ";
#define dbugln std::cout<<"\n";
#else
#define dbug(X) {}
#define dbugf(s) {}
#define dbugln {}
#endif

/*
int N, M;
vector<int> a;

bool bsearch(int left, int right, int value){
	int s = (left+right)/2;
	if(right -left == 1) return(a[left] == value);
	if(a[s] > value){
		return bsearch(left, s, value);
	}else{
		return bsearch(s, right, value);
	}
}
cout << bsearch(0, N, M);

int left = 0, right = N;
while(right -left > 1){
	int s = (left+right)/2;
	if(a[s] > value){
		right = s;
	}else{
		left = s;
	}
}
cout << (a[left] = M)
*/

int n, k, w;
vector<int> ws;
unsigned long long int Pmax;

bool judge(int p){
	int kk=1;
	unsigned long long int m = 0;
	for(int i = 0; i < n; i++){
		if(m + ws[i] <= p) m += ws[i];
		else{
			if(ws[i] > p){
				return false;
			}else{
				kk++;
				m = ws[i];
			}
		}
		dbug(kk)dbug(m)dbug(ws[i])dbugln
	}
	return (kk <= k);
}

int main(){
	cin.tie(0);
	std::ios::sync_with_stdio(false);
    cin >> n >> k;
	for(int i = 0; i < n; i++){
		cin >> w;
		Pmax += w;
		ws.push_back(w);
	}
	unsigned long long int left = 0, right = Pmax;
	dbug(Pmax)dbugln;
	while(right -left > 1){
		unsigned long long int s = (left+right)/2;
		bool J = judge(s);
		dbug(s)dbug(J)dbugln;dbugln;
		if(judge(s)){
			right = s;
		}else{
			left = s;
		}
	}

	cout << right << "\n";
	return 0;
}



Measured memory_bytes: 3540
def longest():
    seq1 = raw_input()
    seq2 = raw_input()
   
    a, b = len(seq1), len(seq2)
    x1 = [0 for i in range(b+1)]
    for i in range(a):
        e1 = seq1[i]
        x2 = x1+[]
        for j in range(b):
            if e1 == seq2[j]:
                x1[j+1] = x2[j] + 1
            elif x1[j+1] < x1[j]:
                x1[j+1] = x1[j]

    return x1[-1]
   
n = input()
for i2 in range(n):
    print longest()

Measured memory_bytes: 6424
use proconio::input;

fn main() {
    input! {
        n: usize,
        b: [i64; n - 1],
    };
    let mut ans = b[0] + b[n - 1 - 1];
    for (b_i0, b_i1) in b.windows(2).map(|w| match w {
        &[b_i0, b_i1] => (b_i0, b_i1),
        _ => unreachable!(),
    }) {
        ans += std::cmp::min(b_i0, b_i1);
    }
    println!("{}", ans);
}


Measured memory_bytes: 2116
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#pragma GCC optimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
 
using namespace __gnu_pbds;
using namespace std;
 
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
 
typedef long long ll;
typedef long double ld;

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	ll n,d;
	cin >> n >> d;
	cout << ceil(ld(n)/ld(d*2+1)) << endl;
}

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

int main()
{
    int N;
    std::cin >> N;
    std::map<char, int> s;
    s.clear();
    char c;
    for(int i=0; i<N; i++)
    {
        std::cin >> c;
        s[c]++;
    }
    if(s.size() == 4)
        std::cout << "Four" << std::endl;
    else
        std::cout << "Three" << std::endl;
    
    return 0;
}



Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
int main(void){

    int N;
    int* x;
  	scanf("%d",&N);
    x = (int *)malloc(sizeof(int)*N);
    for(int i=0;i<N;i++){
        scanf("%d",&x[i]);
    }
  	int max = x[0];
  	int min = x[0];
    for(int i=0;i<N;i++){
      if(x[i]>max){
      	max = x[i];
      }
      if(x[i]<min){
      	min = x[i];
      }
    }
  	long int *distance;
    distance = (long int *)malloc(sizeof(long int)*max);
  	long int temp=0;
  	int j=0;
    for (int i = 0; i < N; i++)
    {
        /*temp += (x[i]-x[j])*(x[i]-x[j]);  	
      		distance[i] = temp;*/
        for (int j = min+1; j < max; j++)
        {
            distance[j] += (x[i] - j) * (x[i] - j);
        }
      	
    }
    for(int i=min;i<max-1;i++){
      for(int j=max-1;j>i;j--){
        if(distance[j-1]>distance[j]){
            swap2(&distance[j-1],&distance[j]);
        }
      }
    }
    printf("%ld",distance[min+1]);
    return 0;
}
void swap(int *a,int *b){
    int tmp;
    tmp = *a;
    *a = *b;
    *b = tmp;
}

void swap2(long int *a,long int *b){
    long int tmp;
    tmp = *a;
    *a = *b;
    *b = tmp;
}

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

int main()
{
    ll a,b,c,k;
    cin>>a>>b>>c>>k;
    ll ans=0;
    if(k<=a) {
        ans+=k;
        cout<<ans<<"\n";
        return 0;
    }
    else{
        k-=a;
        ans+=a;
        if(k<=b){
            cout<<ans<<"\n";
            return 0;
        }
        else{
            k-=b;
            ans-=k;
            cout<<ans<<"\n";
            return 0;
        }
    }
    return 0;
}


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

int main(){
    int n;  cin >> n;
    vector<ll> city(n+1), brave(n);
    for(int i=0; i<n+1; i++)  cin >> city.at(i);
    for(int i=0; i<n; i++) cin >> brave.at(i);

    ll cnt=0;
    for(int i=0; i<n; i++){
        ll f1 = min(brave.at(i), city.at(i));
        cnt += min(brave.at(i)-f1, city.at(i+1)) + f1;
        city.at(i+1) = max(city.at(i+1)-brave.at(i)+f1, 0LL);
        
    }
    cout << cnt << endl;
}



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

typedef long long int ll;
ll MOD = 1000000007;
ll INFL = 1ll << 60;
ll INF = 1 << 28;

vector<bool> p(1000010);

// ====================================================================

int main() {
  int n;
  cin >> n;
  vector<int> v(n);
  for (int i = 0; i < n; i++) { cin >> v[i]; }
  sort(v.begin(), v.end());

  int ans = 0;
  for (int i = 0; i < n; i++) {
    if (p[v[i]] == false) {
      if (v[i] != v[i + 1])
        ans++;
      for (int j = 0; j < 1000010; j += v[i]) {
        p[j] = true;
      }
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 4316
#include <iostream>
using namespace std;
int main () {
  int cnt=0, i=0;
  string s;
  cin >> s;
  while(i < s.size()-2) {
    if(s[i] == s[i+1] && s[i+1] == s[i+2]) {
      cout << "Yes" << endl;
      return 0;
    }
    i++;
  }
    cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#pragma region include

#include <iostream>
#include <iomanip>
#include <stdio.h>

#include <sstream>
#include <algorithm>
#include <iterator>
#include <cmath>
#include <complex>

#include <string>
#include <cstring>
#include <vector>
#include <bitset>

#include <queue>
#include <set>
#include <map>
#include <stack>
#include <list>

#include <ctime>
////
//#include <random>//
#pragma endregion //#include
/////////

#pragma region typedef
typedef long long LL;
typedef long double LD;
typedef unsigned long long ULL;
#pragma endregion //typedef
////定数
const int INF = (int)1e9;
const LL MOD = (LL)1e9 + 7;
const LL LINF = (LL)4e18 + 20;
const LD PI = acos(-1.0);
const double EPS = 1e-9; 
/////////
using namespace::std;
//////////////

void solve() {
	int H, W;
	cin >> H >> W;
	vector<string>S(H);
	
	for (int h = 0; h < H; ++h) {
		cin >> S[h];
	}
	vector<bool> HH(H, false);
	vector<bool> WW(W, false);
	for (int h = 0; h < H; ++h) {
		bool res = true;
		for (int w = 0; w < W; ++w) {
			if ( S[h][w] == '#') {
				res = false;
			}
		}
		HH[h] = res;
	}
	for (int w = 0; w < W; ++w) {
		bool res = true;
		for (int h = 0; h < H; ++h) {
			if (S[h][w] == '#') {
				res = false;
			}
		}
		WW[w] = res;
	}

	for (int h = 0; h < H; ++h) {
		if (HH[h]) continue;
		for (int w = 0; w < W; ++w) {
			if (WW[w]) {
				
			}
			else {
				cout << S[h][w];
			}
		}
		cout << endl;
	}
}

#pragma region main
signed main(void) {
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	std::cout << std::fixed;//小数を10進数表示
	cout << setprecision(16);//小数点以下の桁数を指定//coutとcerrで別	

	solve();
}
#pragma endregion //main()


Measured memory_bytes: 256
import java.util.*;
public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		double parm =3.1415926535;
		double r = 2*n*parm;
		System.out.println(r);

	}

}

Measured memory_bytes: 35948
import java.util.*;
import javax.lang.model.util.ElementScanner6;
//import java.lang.Math;

public class Main {

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

        // 入力
        final int n = sc.nextInt();
        final int m = sc.nextInt();
        // String s = sc.next();

        // 処理
        // hight
        final Tenbo[] tenbo = new Tenbo[n];
        for (int i = 0; i < n; i++) {
            tenbo[i] = new Tenbo();
            tenbo[i].hight = sc.nextInt();
        }

        // con
        for (int i = 0; i < m; i++) {
            int a = sc.nextInt();
            int b = sc.nextInt();
            tenbo[a-1].con.add(b-1);
            tenbo[b-1].con.add(a-1);
        }

        int out = 0;

        for(int i = 0; i < n; i++){
            if(tenbo[i].con.size() == 0){
                out++;
                continue;
            }
            boolean flg = true;
            for(int j = 0; j < tenbo[i].con.size(); j++){
                if(tenbo[i].hight <= tenbo[tenbo[i].con.get(j)].hight){
                    flg = false;
                    break;
                }
            }
            if(flg == true) out++;
        }

        // 出力
        System.out.println(out);
    }

    public static class Tenbo {
        int hight;
        ArrayList<Integer> con = new ArrayList<>();
    }
}


Measured memory_bytes: 72888
from collections import deque

n = int(input())
q = deque()
for i in range(n):
    com = input().split()
    if com[0] == 'insert':
        q.appendleft(com[1])
    elif com[0] == 'delete':
        try:
            q.remove(com[1])
        except:
            pass
    elif com[0] == 'deleteFirst':
        q.popleft()
    else:
        q.pop()
print(" ".join(q))


Measured memory_bytes: 69732
N, M = map(int, input().split())
X = set()
Y = set()

ABC = []
for _ in range(N):
    # (A,C)-(B,C)
    A, B, C = map(int, input().split())
    X.add(A)
    X.add(B)
    Y.add(C)
    ABC.append((A,B,C))

DEF = []
for _ in range(M):
    # (D,E)-(D,F)
    D, E, F = map(int, input().split())
    X.add(D)
    Y.add(E)
    Y.add(F)
    DEF.append((D,E,F))

XL = sorted(list(X))
YL = sorted(list(Y))

XD = {k:v for v,k in enumerate(XL)}
YD = {k:v for v,k in enumerate(YL)}

nX = len(XL)+1
nY = len(YL)+1

S = [[False]*nY for _ in range(nX)]
T = [[15]*nY for _ in range(nX)]

for a, b, c in ABC:
    xbgn = XD[a]+1
    xend = XD[b]
    yu   = YD[c]
    yd   = yu+1
    for x in range(xbgn, xend+1):
        T[x][yu]-=4
        T[x][yd]-=8

for d, e, f in DEF:
    ybgn = YD[e]+1
    yend = YD[f]
    xl   = XD[d]
    xr   = xl+1
    for y in range(ybgn, yend+1):
        T[xl][y]-=1
        T[xr][y]-=2

x0 = 0
while XL[x0]<0 and x0<nX-2: x0+=1
y0 = 0
while YL[y0]<0 and y0<nY-2: y0+=1

queue = [(x0, y0)]

ans = 0
while queue:
    queue_new = []
    for qx, qy in queue:
        if S[qx][qy]: continue
        S[qx][qy]=True
        if qx==0 or qy==0 or qx==nX-1 or qy==nY-1:
            print('INF')
            exit()

        ans += (XL[qx]-XL[qx-1])*(YL[qy]-YL[qy-1])

        t = T[qx][qy]
        if t&1: queue_new.append((qx+1,qy))
        if t&2: queue_new.append((qx-1,qy))
        if t&4: queue_new.append((qx,qy+1))
        if t&8: queue_new.append((qx,qy-1))

    queue = queue_new


print(ans)


Measured memory_bytes: 216148
#include<stdio.h>
int main(){
  int n,a=1<<30,t,i,j;
  scanf("%d",&n);
  for(i=0;i<n;i++){scanf("%d",&t);for(j=0;!(t&1<<j);j++);a=a<j?a:j;}
  printf("%d",a);
}


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

int main()
{
    int l, r, d;
    cin >> l >> r >> d;
    int ans = 0;
    for(int i = l; i <= r; i++) {
        if(i % d == 0) ans++;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3620
from itertools import product as prod

n = int(input())
ss = list(input())

def next_anim(a_0, a_1, s):
    if s == "o":
        if a_1 == "S":
            return a_0
        else:
            return "W" if a_0 == "S" else "S"
    else:
        if a_1 == "S":
            return "W" if a_0 == "S" else "S"
        else:
            return a_0

ans = -1
anims = ["" for _ in range(n)]
for fst, snd in prod(["W", "S"], repeat=2):
    anims[:2] = [fst, snd]
    for i in range(2, n):
        anims[i] = next_anim(anims[i-2], anims[i-1], ss[i-1])
    tmp_anim = next_anim(snd, fst, ss[0])
    tmp_anim2 = next_anim(anims[-2], anims[-1], ss[-1])
    if tmp_anim == anims[-1] and tmp_anim2 == anims[0]:
        ans = "".join(anims)
        break

print(ans)


Measured memory_bytes: 4900
#include <bits/stdc++.h>
using namespace std;
int main(){
	int n,x,a[1000];
	cin>>n>>x;
	for(int i=0;i<n;i++){cin>>a[i];x-=a[i];}
	sort(a,a+n);
	cout<<x/a[0]+n<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i ++)
#define rep1(i, n) for(int i = 1; i <= (int)(n); i ++)
#define MP make_pair

using namespace std;
typedef long long LL;
typedef pair<int, int> PII;
const int MOD = 998244353;

char ch[20];

int main()
{
	cin >> ch;
	int n = strlen(ch), l = 0;
	rep(i, n) if(ch[i] == 'x') l ++;
	printf(l <= 7 ? "YES\n" : "NO\n");
	return 0;
}

Measured memory_bytes: 256
#include<queue>
#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;
typedef pair<int,int> P;
struct edge{
    int to;
    int cost;
    edge(int t, int w) : to(t), cost(w) { }
};
int main(){
  int i,V,e,r,s,t,d;
  int ds[100010],ns[100010];
  int INF=2000000000;
  priority_queue<P,vector<P>,greater<P> > que;
  vector<vector<edge> > g(100010);
  scanf("%d %d %d\n",&V,&e,&r);
  for(i=0;i<e;i++){
    scanf("%d %d %d\n",&s,&t,&d);
    g[s].push_back(edge(t,d));
  }
  for(i=0;i<V;i++){
    ds[i]=INF,ns[i]=0;
  }
  ds[r]=0,ns[r]=1;
  que.push(P(0,r));
  while(!que.empty()){
    P p=que.top();
    que.pop();
    int v=p.second;
    if(ds[v]<p.first){
      continue;
    }
    for(i=0;i<g[v].size();i++){
      edge us=g[v][i];
      if(ds[us.to]>ds[v]+us.cost && ns[us.to]==0){
        ds[us.to]=ds[v]+us.cost;
        que.push(P(ds[us.to],us.to));
      }
    }
    ns[v]=1;
  }
  for(i=0;i<V;i++){
    if(ds[i]==INF){
      printf("INF\n");
      continue;
    }
    printf("%d\n",ds[i]);
  }
  return 0;
}


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

#define int long long
const int mod = 1e9 + 7;

signed main() {
    string K;
    int D;
    cin >> K >> D;

    int N = K.length();
    
    int dp[N+1][D][2];
    for (int i = 0; i < N+1; i++) {
        for (int j = 0; j < D; j++) {
            dp[i][j][0] = 0;
            dp[i][j][1] = 0;
        }
    }
    dp[0][0][0] = 1;

    for (int i = 1; i < N+1; i++) {
        for (int j = 0; j < D; j++) {
            dp[i][(j+(K[i-1] - '0')) % D][0] += dp[i-1][j][0];
            for (int k = 0; k < K[i-1] - '0'; k++) {
                dp[i][(j+k) % D][1] += dp[i-1][j][0];
            }
            for (int k = 0; k < 10; k++) {
                dp[i][(j+k) % D][1] += dp[i-1][j][1];
            }
            
            dp[i][j][0] %= mod;
            dp[i][j][1] %= mod;
        }
    }

    int ans = (dp[N][0][0] + dp[N][0][1] - 1) % mod;
    cout << ans << endl;
}

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

using namespace std;

const int MAXN = 2e5 + 10;

int n, k;

int a[MAXN];

const int MOD = 1e9 + 7;

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

    int maxVal = -1;
    cin >> a[0];
    for (int i = 1; i < n; i++) {
        cin >> a[i];
        maxVal = max(maxVal, a[i] - a[i - 1]);
    }

    maxVal = max(maxVal, k - a[n - 1] + a[0]);

    cout << k - maxVal; 
}

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

int main() {
  int N; cin>>N;
  vector <int> vec(N);
  for(int i=0; i<N; i++) cin >> vec.at(i);
  
  int temp=0, count=1;
  for(int i=0; i<N; i++){
    if(vec.at(temp)==2){
      cout << count << endl;
      return 0;
    }
    else{
      temp=vec.at(temp)-1;
      count++;
    }
  }
  cout << -1 << endl;
}


Measured memory_bytes: 640
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
public class Main
{
	public static void main(String[] args)throws IOException
	{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
//		?????????3?¨?????????????????????????
		ArrayList<Integer> mid = new ArrayList<Integer>();
		ArrayList<Integer> fin = new ArrayList<Integer>();
		ArrayList<Integer> re = new ArrayList<Integer>();
		String[] strs = new String[3];
		int[] buf = new int[3];
		while(true)//?????????-1?????\?????????????????§?????????
		{
			strs = br.readLine().split(" ");
			for(int i=0; i<3; i++)	buf[i] = Integer.parseInt(strs[i]);
			if(buf[0]+buf[1]+buf[2]==-3) break;
			mid.add(buf[0]);
			fin.add(buf[1]);
			re.add(buf[2]);
		}
		
		int stu = mid.size();
		int m, f, r, mix;
		for(int i=0; i<stu; i++)
		{
			m = mid.get(i);
			f = fin.get(i);
			r = re.get(i);
			mix = m + f;
//		??????????¨??????????????¨????????????????????¬????????????´???????????? F??? 
			if(m==-1 || f==-1 ||(mix>=0 &&mix<30)) 
			{
				System.out.println("F");
				continue;
			}
//		??????????¨???¨??????????¨????????¨??????°??? 80 ??\???????????°????????? A ???
			else if(mix>=80)
			{
				System.out.println("A");
				continue;
			}
//		??????????¨???¨??????????¨????????¨??????°??? 65 ??\??? 80 ??????????????°????????? B???
			else if(mix>=65&&mix<80)
			{
				System.out.println("B");
				continue;
			}
//		??????????¨???¨??????????¨????????¨??????°??? 50 ??\??? 65 ??????????????°????????? C???
			else if((mix>=50&&mix<65)||(mix>=30&&mix<50&&r>=50))
			{
				System.out.println("C");
				continue;
			}
//		??????????¨???¨??????????¨????????¨??????°??? 30 ??\??? 50 ??????????????°????????? D???
			else if(mix>=30&&mix<50&&r<50)
			{
				System.out.println("D");
				continue;
			}
		}	
	}
}

Measured memory_bytes: 24324