akhauriyash/Code-Regression huggingface dataset:
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <unordered_map>
#include <climits>
#include <set>
#include <unordered_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>
#include <queue>
#include <random>
#include <complex>
#include <regex>
#include <locale>
#include <random>
#include <type_traits>

using namespace std;

#define SHOW_VECTOR(v) {std::cerr << #v << "\t:";for(const auto& xxx : v){std::cerr << xxx << " ";}std::cerr << "\n";}
#define SHOW_MAP(v){std::cerr << #v << endl; for(const auto& xxx: v){std::cerr << xxx.first << " " << xxx.second << "\n";}}

using LL = long long;

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


int main() {

    int M, D;
    cin >> M >> D;

    int ans = 0;

    for (int m = 1; m <= M; m++) {
        for (int d = 1; d <= D; d++) {
            int a = d / 10;
            int b = d % 10;
            if (a >= 2 && b >= 2 && a * b == m) {
                ans++;
            }
        }
    }

    cout << ans << endl;

}














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

using namespace std;
typedef long long ll;
int n;
ll h[200003],v[200003],f[200003],tree[900003];
pair<ll,pair<ll,int> >a[200003];

void Update(int node,int start,int endd,int id,ll val)
{
    if(id<start||id>endd)
    {
        return;
    }
    if(start==endd)
    {
        tree[node]=val;
        return;
    }
    int mid=(start+endd)/2;
    Update(2*node,start,mid,id,val);
    Update(2*node+1,mid+1,endd,id,val);
    tree[node]=max(tree[2*node],tree[2*node+1]);
}

ll Maxx(int node,int start,int endd,int l,int r)
{
    if(r<start||l>endd)
    {
        return 0;
    }
    if(l<=start && endd<=r)
    {
        return tree[node];
    }
    int mid=(start+endd)/2;
    return max(Maxx(2*node,start,mid,l,r),Maxx(2*node+1,mid+1,endd,l,r));
}

int main()
{
    cin>>n;
    for(int i=1;i<=n;++i)
    {
        cin>>h[i];
    }
    for(int i=1;i<=n;++i)
    {
        cin>>v[i];
        a[i]={h[i],{v[i],-i}};
    }
    sort(a+1,a+1+n);
    for(int i=1;i<=n;++i)
    {
        if(-a[i].second.second==1)
        {
            f[i]=a[i].second.first;
        }
        else
        {
            f[i]=Maxx(1,1,n,1,-a[i].second.second-1)+a[i].second.first;
        }
        Update(1,1,n,-a[i].second.second,f[i]);
    }
    ll res=0;
    for(int i=1;i<=n;++i)
    {
        res=max(res,f[i]);
    }
    cout<<res;
}


Measured memory_bytes: 16640
#include<bits/stdc++.h>
using namespace std;
typedef long long int lli;
#define pb push_back
#define mod 1000000007
#define ff first
#define ss second
#define endl "\n"
#define IOS ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
int main()
{
    IOS
    int n,k;
    cin>>n>>k;
    lli a[n];
    for(int i=0;i<n;i++)
    	cin>>a[i];
    lli ans = 1e18;
    for(int i=0;i<n-k+1;i++)
    {
    	ans = min(ans,a[i+k-1]-a[i] + min(abs(a[i+k-1]),abs(a[i])));
    }
    cout<<ans;
    return 0;
}

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

using namespace std;

typedef pair<int, int> P;
typedef long long ll;
#define rep(i, n) for(int i=0;i<(n);i++)
#define rep2(i, m, n) for(int i=m;i<(n);i++)
#define rrep(i, n, m) for(int i=n;i>=(m);i--)
using Graph = vector<vector<int>>;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const ll MOD = 1000000007;
#ifdef __DEBUG

#include "cpp-pyprint/pyprint.h"

#endif

void Main() {
    int N, T;
    cin >> N >> T;
    vector<int> t(N);
    rep(i, N) cin >> t[i];
    ll ans = 0;
    ll last = T;
    for (int i = 1; i < N; ++i) {
        int time = t[i];
        if (last > time) {
            ans += time - t[i - 1];
        } else {
            ans += T;
        }
        last = time + T;
    }
    ans += T;
    cout << ans << endl;

}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
}


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

using namespace std;

#define ll long long

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

	// Sを全て使用できる場合とSが余る場合を分けて考える
	if (m >= 2 * n) {
		ans = n + ((m - 2 * n) / 4);
	} else {
		ans = m / 2;
	}
	cout << ans << endl;

	return (0);
}

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

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

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const ll MOD=1e9+7;
const ll LINF=1e18;
const int INF=0x3f3f3f3f;
const int MAXN=100050;

int dp[MAXN];
bool cmp(int a,int b){
	return a>b;
}
void solve(int T){
	int n,tmp,siz=0;
	scanf("%d",&n);
	memset(dp,-1,sizeof(dp));
	for(int i=1;i<=n;i++){
		scanf("%d",&tmp);
		int l=1,r=n,mid;
		while(l<r){
			mid=(l+r)/2;
			if(dp[mid]<tmp){
				r=mid;
			}else{
				l=mid+1;
			}
		}
		if(dp[l]==-1){
			siz++;
		}
		dp[l]=tmp;
	}
	printf("%d",siz);
}
signed main(){
	int t=1;
	//scanf("%d",&t); 
	for(int i=1;i<=t;i++){
		solve(i);
	}
}

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

int main() {
  int H,W;
  cin >> H >> W;
  char c[H][W];
  bool h[H]={};
  bool w[W]={};
  for(int i=0;i<H;i++){
    for(int j=0;j<W;j++){
      cin >> c[i][j];
      if(c[i][j]=='#'){
        h[i]=true;
        w[j]=true;
      }
    }
  }
  for(int i=0;i<H;i++){
    for(int j=0;j<W;j++){
      if(h[i] && w[j])cout << c[i][j];
    }
    cout << endl;
  }
}






Measured memory_bytes: 256
import Data.Array (Array, listArray, (!))

dp f s e = result ! e where
  result = listArray (s,e) $ map nth [s..]
  nth i = f result i

minjumpcost :: Int -> Int -> Array Int Int -> Int
minjumpcost n k hs = dp f 1 n where
  f _ 1 = 0
  f t i =
    let costs = [(t!(i-j)) + abs ((hs!i)-(hs!(i-j))) | j <- [1..k], i-j>0]
    in
      minimum costs

main = do
  [n,k] <- map read . words <$> getLine
  hs <- listArray (1,n) . map read . words <$> getLine
  print $ minjumpcost n k hs


Measured memory_bytes: 134524
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define R cin>>
#define Z class
#define ll long long
#define ln cout<<'\n'
#define in(a) insert(a)
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define all(c) (c).begin(),(c).end()
#define iter(c) __typeof((c).begin())
#define rrep(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++)
template<Z A>void pr(A a){cout<<a;ln;}
template<Z A,Z B>void pr(A a,B b){cout<<a<<' ';pr(b);}
template<Z A,Z B,Z C>void pr(A a,B b,C c){cout<<a<<' ';pr(b,c);}
template<Z A,Z B,Z C,Z D>void pr(A a,B b,C c,D d){cout<<a<<' ';pr(b,c,d);}
template<Z A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}ln;}
ll check(ll n,ll m,ll x,ll y){return x>=0&&x<n&&y>=0&&y<m;}
const ll MAX=1e9+7,MAXL=1LL<<61,dx[4]={-1,0,1,0},dy[4]={0,1,0,-1};
typedef pair<ll,ll> P;

void Main() {
  ll n,k;
  string s;
  cin >> n >> s >> k;
  char c=s[k-1];
  rep(i,n) {
    if(s[i]!=c) s[i]='*';
  }
  pr(s);
}

int main(){ios::sync_with_stdio(0);cin.tie(0);Main();return 0;}


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

int main(){

    string s,t,u;
    int a,b;

    cin>>s>>t>>a>>b>>u;

    if(s==u) cout<<a-1<<" "<<b<<endl;
    else cout<<a<<" "<<b-1<<endl;


    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 using namespace std;
 using pii = pair<int, int>;
 using ll = long long;
 #define rep(i, j, n) for(int i = j; i < (int)(n); i++)
 const ll MOD = 1000000007;
 const ll INFL = 1LL << 60;
 const int INFI = (1 << 30);

 int main() {
     int A, B, C, D, E, F;
     cin >> A >> B >> C >> D >> E >> F;
     int pro, sug;
     double conc_max = - 0.1;

     for (int a = 0; 100 * A * a <= F; a++) {
       for (int b = 0; 100 * B * b <= F; b++) {
         int W_water = 100 * A * a + 100 * B * b;
         int max_sugar = (A * a + B * b) * E;
         for (int c = 0; C * c <= max_sugar; c++) {
           for (int d = 0; D * d <= max_sugar; d++) {
             if (F < W_water + C * c + D * d) continue;
             if (max_sugar < C * c + D * d) continue;
             if (conc_max < 100.0 * (C * c + D * d) / (W_water + C * c + D * d)) {
               pro = W_water + C * c + D * d;
               sug = C * c + D * d;
               conc_max = 100.0 * (C * c + D * d) / (W_water + C * c + D * d);
             }
           }
         }
       }
     }

     cout << pro << " " << sug << endl;
 }


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

#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
const int N = 1e5+5;
bool prime[N];

class TaskD {
public:
	void solve(std::istream& in, std::ostream& out) {
		int n; in>>n;
		memset(prime, true, sizeof(prime));
		for(int i = 2; i<N; ++i) if(prime[i]) for(int j = 2*i; j<N; j+=i) prime[j] = false;
		vector<int> res;
		for(int i = 2; i<N; ++i){
			if(i<=55555 and prime[i] and i%5==1) res.push_back(i);
		}
		for(int i = 0; i<n; ++i) out<<res.back()<<' ', res.pop_back();
	}
};


int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	TaskD solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#define REP(i, a, n) for(ll i=a; i<n; i++)
#define RREP(i, a, n) for(ll i=n-1; i>=a; i--)
typedef long long ll;
const ll mod =1e9+7;
const ll inf =1e18;
using namespace std;

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

    REP(i, 0, s.size()){
        ll idx=((s[i]-'A')+n)%26;
        cout<<char('A'+idx);
    }
    cout<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <fstream>
#include <sstream>

using namespace std;

int main(){
    int N, L;
    cin >> N >> L;

    vector<int> a(N,0);

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

    int last=0;
    for(int i=1; i<N; i++){
        if(a[i-1]+a[i]>=L){
            last=i;
            break;
        }
    }
    if(last==0){
        cout << "Impossible" << endl;
        return 0;
    }

    cout << "Possible" << endl;
    for(int i=1; i<last; i++){
        cout << i << endl;
    }
    for(int i=N-1; i>=last; i--){
        cout << i << endl;
    }
}

Measured memory_bytes: 1152
#include <bits/stdc++.h>
#define REP(i, n) for (int (i) = 0; (i) < (int)(n); i++) 
#define FOR(i, a, b) for(int (i) = a; (i) < (int)b; i++)
#define RREP(i, n) for(int (i)=((int)(n)-1); (i)>=0; i--)
#define RFOR(i, a, b) for(int (i) =((int)(b)-1); (i)>=(int)a; i--)
#define ALL(v) (v).begin(),(v).end()
#define MOD 1000000007
#define NIL -1
#define FI first
#define SE second
#define MP make_pair
#define PB push_back
#define SZ(x)  (int)x.size()
#define SP(x)  setprecision((int)x)


using namespace std ;
typedef long long ll;
typedef vector<int> vint;
typedef vector<vint> vvint;
typedef vector<string> vstr;
typedef pair<int, int> pii;
const int INF = 1e9;
const ll LINF = 1e18;
const double EPS = 1e-9;
ll gcd(ll a, ll b) {return b ? gcd(b, a % b) : a;} //最大公約数
ll lcm(ll a, ll b) {return a / gcd(a, b) * b;} //最小公倍数

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



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


int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  string s ;
  cin >> s ;
  int n = SZ(s) ;
  int cnt = 0 ;
  REP(i,n/2){
    if(s.at(i)!=s.at(n-i-1)){
      cnt++ ;
    }
  }
  cout <<cnt<<endl ;
  

    
         
         
  
  
  
  return 0 ;
}

Measured memory_bytes: 256
n=int(input());e=[[]for _ in[0]*-~n];q=[(1,0)];f=[-1]*n
while n>1:v,w,c=map(int,input().split());e[v]+=(w,c),;e[w]+=(v,c),;n-=1
while q:
 v,c=q.pop();f[v-1]=c%2
 for w,d in e[v]:
  if f[w-1]<0:q+=(w,c+d),
print(*f)

Measured memory_bytes: 40352
#include <bits/stdc++.h>
#include <cstdio>
#include <cstdlib>

#ifdef _MSC_VER
#include <Windows.h>
#else
#include <unistd.h>
#endif

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 pair<int, int> PII;
typedef pair<long, long> PLL;
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 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))



int main(){
    LL W,H;
    cin>>W>>H;
    vector<LL> p(W),q(H);
    LL wsum=0LL,hsum=0LL;
    REP(i,W){
        cin>>p[i];
        wsum+=p[i];
    }
    REP(i,H){
        cin>>q[i];
        hsum+=q[i];
    }
    SORT(p);SORT(q);
    vector<LL>imos_p(W+1),imos_q(H+1);//i+1番目にはi番目までの和
    imos_p[0]=imos_q[0]=0LL;
    REP(i,W){
        imos_p[i+1]=imos_p[i]+p[i];
    }
    REP(i,H){
        imos_q[i+1]=imos_q[i]+q[i];
    }
    LL r1=wsum*(H+1)+hsum;
    vector<LL>ht(H),wt(W);
    REP(i,W)wt[i]=H+1LL;
    REP(i,H)ht[i]=1LL;
    REP(i,H){
        auto pos=upper_bound(p.begin(),p.end(),q[i])-p.begin();
        //cout<<"H"<<W-pos<<" "<<wsum-imos_p[pos]<<endl;
        r1+=((W-pos)*q[i]-(wsum-imos_p[pos]));
    }
    LL r2=hsum*(W+1)+wsum;
    REP(i,W){
        auto pos=upper_bound(q.begin(),q.end(),p[i])-q.begin();
        //cout<<"W"<<H-pos<<" "<<hsum-imos_q[pos]<<endl;
        r2+=((H-pos)*p[i]-(hsum-imos_q[pos]));
    }
    cout<<min(r1,r2)<<endl;
    return 0;
}

Measured memory_bytes: 4992
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
typedef long long ll;
typedef pair<int,int> P;
typedef vector<int> vec;
typedef vector<vec> mat;
ll mod=1e9+7;
vector<int> Era(int n){
    vector<int> is_prime(n,1),P;
    for(int i=2;i<=n;i++){
        if(is_prime[i]){
            for(int j=2*i;j<=n;j+=i) is_prime[j]=0;
            P.push_back(i);
        }
    }
    return P;
}
ll inv(ll a){
    ll n=mod-2,ans=1;
    while(n>0){
        if(n&1) ans=ans*a%mod;
        n=n/2;
        a=a*a%mod;
    }
    return ans;
}
ll pow_(ll n,ll m){
    ll ans=1;
    while(m>0){
        if(m&1) ans=ans*n%mod;
        m=m/2;
        n=n*n%mod;
    }
    return ans;
}
int main(){
    ll n,A[200001];
    cin>>n;
    rep(i,n) cin>>A[i];
    ll g=1;
    int num[1000001]={0};
    rep(i,n){
        int p=A[i];
        for(int j=2;j<=sqrt(p);j++){
            int a=0;
            if(p%j==0){
                while(p%j==0) a++,p=p/j;
            }
            num[j]=max(a,num[j]);
        }
        num[p]=max(1,num[p]);
    }
    rep(i,1000001)if(num[i]) g=g*ll(pow(i,num[i]))%mod;
    ll ans=0;
    rep(i,n) ans=(ans+g*inv(A[i]))%mod;
    cout<<ans<<"\n";
}


Measured memory_bytes: 5760
#include <stdio.h>

int main(void)
{
    int x,y,a;
    
    scanf("%d %d",&x,&y);
    
    do{
        if(x<y){
            a=x;
            x=y;
            y=a;
        }
        
        a=x%y;
        x=a;
    }while(a != 0);
    
    printf("%d\n",y);
    
    return 0;
}


Measured memory_bytes: 2100
#include<iostream>
#include<iomanip>
#include<vector>
#include<map>
#include<stack>
#include<queue>
#include<string>
#include<utility>
#include<numeric>
#include<algorithm>
#include<cmath>
#include<climits>
using namespace std;

using ll = long long;

class Stream{
public:
    Stream(){

    }
    //配列以外の入力を受け取る
    void read(){

    }
    template<typename First, typename... Rest>
    void read(First& first, Rest&... rest){
        cin >> first;
        read(rest...);
    }
    //配列以外を出力する
    void write(){

    }
    template<typename First, typename... Rest>
    void write(First first, Rest... rest){
        cout << first << " ";
        write(rest...);
    }
    //配列を区切って出力する
    template<typename T>
    void write_vec(vector<T>& v, char divider){
        for(size_t i = 0; i < v.size(); i++){
            cout << v[i] << divider;
        }
    }
};

int main(){
    Stream io;

    int N;
    io.read(N);
    vector<int> H(N);
    for(int i = 0; i < N; i++){
        io.read(H[i]);
    }
    int m = 0;
    int ans = 0;
    for(int i = 0; i < N; i++){
        if(m <= H[i]) {
            m = H[i];
            ans++;
        }
    }
    io.write(ans);
    return 0;
}

Measured memory_bytes: 256
W,H,N=map(int, input().split())

X=[]
Y=[]
A=[]
for i in range(N):
    x,y,a=map(int, input().split())
    X.append(x)
    Y.append(y)
    A.append(a)

T=W*H
Ws=0
Hs=0
Wh=W
Hh=H
for i in range(N):
    if A[i]==1:
        if X[i]-Ws>=0:
            T-=(X[i]-Ws)*(Hh-Hs)
            Ws=X[i]
    elif A[i]==2:
        if Wh-X[i]>=0:
            T-=(Wh-X[i])*(Hh-Hs)
            Wh=X[i]
    elif A[i]==3:
        if Y[i]-Hs>=0:
            T-=(Y[i]-Hs)*(Wh-Ws)
            Hs=Y[i]
    elif A[i]==4:
        if Hh-Y[i]>=0:
            T-=(Hh-Y[i])*(Wh-Ws)
            Hh=Y[i]
    if T<=0:
        T=0
        break

print(T)


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
vector<int> dx = {1, 0, 0, 1, 1, 0, 0, 1, -1, 1, 1, 1, -1};
vector<int> dy = {0, 1, 0, 1, -1, 1, 1, 0, 0, 1, 1, -1, 1};
vector<int> dz = {0, 0, 1, 0, 0, 1, -1, 1, 1, 1, -1, 1, 1};
bool win(vector<vector<vector<int>>> &peg, int n, int m){
  for (int x = 0; x < n; x++){
    for (int y = 0; y < n; y++){
      for (int z = 0; z < n; z++){
        if (peg[x][y][z] != -1){
          for (int d = 0; d < 13; d++){
            int x2 = x + dx[d] * (m - 1);
            int y2 = y + dy[d] * (m - 1);
            int z2 = z + dz[d] * (m - 1);
            if (0 <= x2 && x2 < n && 0 <= y2 && y2 < n && 0 <= z2 && z2 < n){
              bool ok = true;
              for (int i = 1; i < m; i++){
                if (peg[x][y][z] != peg[x + dx[d] * i][y + dy[d] * i][z + dz[d] * i]){
                  ok = false;
                }
              }
              if (ok){
                return true;
              }
            }
          }
        }
      }
    }
  }
  return false;
}
int main(){
  while (1){
    int n, m, p;
    cin >> n >> m >> p;
    if (n == 0 && m == 0 && p == 0){
      break;
    }
    vector<vector<vector<int>>> peg(n, vector<vector<int>>(n, vector<int>(n, -1)));
    vector<vector<int>> sz(n, vector<int>(n, 0));
    bool draw = true;
    for (int i = 0; i < p; i++){
      int x, y;
      cin >> x >> y;
      x--;
      y--;
      peg[x][y][sz[x][y]] = i % 2;
      sz[x][y]++;
      if (win(peg, n, m) && draw){
        draw = false;
        if (i % 2 == 0){
          cout << "Black " << i + 1 << endl;
        } else {
          cout << "White " << i + 1 << endl;
        }
      }
    }
    if (draw){
      cout << "Draw" << endl;
    }
  }
}


Measured memory_bytes: 3076
using System;
using System.Linq;

namespace AizuOnlineJudge {
    class Program {
        static void Main() {
            var input = Console.ReadLine()
                .Split()
                .Select(int.Parse)
                .ToArray();

            Console.WriteLine(Math.Abs(input[0] - input[1]));
        }
    }
}



Measured memory_bytes: 18284
#include <bits/stdc++.h>
//#include <unordered_map>
#define M ((ll)1e12)
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define pi acos(-1)
typedef long long ll;
using namespace std;

void solve()
{
    string s;int n;
    cin>>n>>s;
    string t="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
    for(int i=0;i<s.size();i++)
    {
        int va=s[i]-65;
        va=(va+n)%26;
        cout<<t[va];
    }
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    /*ll t;
    cin>>t;
    while(t--)*/
    solve();
    return 0;}

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

using namespace std;


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

    return 0;
}

Measured memory_bytes: 256
import heapq as hq

n, m = map(int, input().split())
a = list(map(int, input().split()))
h = list(map(lambda x: -x, a))

hq.heapify(h)

for _ in range(m):
    M = hq.heappop(h)
    hq.heappush(h, (M + 1) // 2)

print(-sum(h))

Measured memory_bytes: 14180
#include <bits/stdc++.h>
using namespace std;
 
int main(){
	int N,work=0;
	cin >> N;
	vector<pair<int,int>> A(N);
	for (int i=0; i<N; i++){
		cin >> work;
		A.at(i) = make_pair(work,i+1);
	}
	sort(A.begin(),A.end());
	for (int i=0; i<N; i++){
		cout << A.at(i).second;
		if (i != N-1) {
			cout << " ";
		}
		else {
			cout << endl;
		}
	}
}
	

Measured memory_bytes: 1664
#include<bits/stdc++.h>
using namespace std;
int b[100000000];
int main(){
  int a;
  cin>>a;
  for(int i=0;i<a;i++){
    cin>>b[i];
  }
  sort(b,b+a);
  for(int i=0;i<a;i++){
    cout<<b[i];
    if(i!=a-1) cout<<" ";
  }
  cout<<"\n";
}



Measured memory_bytes: 10908
#include <iostream>
#include <array>
#include <string>

const int max_n = 1046527;

long int str2int(std::string str)
{
  auto sum = 0;
  auto p = 1;
  for (auto s : str)
    {
      int tmp;
      if (s == 'A') tmp = 1;
      else if (s == 'C') tmp = 2;
      else if (s == 'G') tmp = 3;
      else tmp = 4;

      sum += tmp * p;
      p *= 5;
    }

  return sum;
}

int h(long int key, int i)
{
  int h1 =  key % max_n;
  int h2 =  1 + key % (max_n-1);

  return (h1 + i*h2) % max_n;
}

struct dict
{
  std::array<int, max_n> arr;

  dict(){arr.fill(0);}

  void insert(int key)
  {
    auto i = 0;
    while (arr[h(key, i)] != 0) i++;
    arr[h(key, i)] = key;
  }

  int find(int key)
  {
    auto i = 0;
    while (arr[h(key, i)] != key)
      {
        if (arr[h(key, i)] == 0) return -1;
        i++;
      }
    return i;
  }

};

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

  std::string command, key;
  dict dic;
  for (int i=0; i<n; i++)
    {
      std::cin >> command >> key;

      if (command == "insert")
        {
          dic.insert(str2int(key));
        }
      else if (command == "find")
        {
          if (dic.find(str2int(key)) == -1)
            {
              std::cout << "no" << std::endl;
            }
          else
            {
              std::cout << "yes" << std::endl;
            }
        }
    }
}



Measured memory_bytes: 7296
import collections

n = int(input())
a_lst = [int(elem) for elem in input().split()]
c = collections.Counter(a_lst)
res1 = 0
for k in c.keys():
  res1 += c[k] * (c[k] - 1) // 2

for i in range(n):
  res = res1
  res -= c[a_lst[i]] - 1
  print(res)

Measured memory_bytes: 26024
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>

static const int MOD = 1000000007;
using ll = long long;
using u32 = uint32_t;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max() / 32 * 15 + 208;

int solve(int n){
    vector<string> v(n);
    string vowel = "aiueo";
    int sz = 0;
    for (int i = 0; i < n; ++i) {
        string s, t;
        cin >> s;
        t += s[0];
        for (int j = 0; j+1 < s.size(); ++j) {
            for (int k = 0; k < 5; ++k) {
                if(s[j] == vowel[k]) t += s[j+1];
            }
        }
        v[i] = t;
        sz = max(sz, (int)t.size());
    }
    sort(v.begin(), v.end());
    v.erase(unique(v.begin(), v.end()), v.end());
    if(v.size() < n){
        return -1;
    }
    for (int i = 1; i <= sz; ++i) {
        int valid = true;
        for (int j = 0; j < n-1; ++j) {
            if(v[j].substr(0, i) == v[j+1].substr(0, i)) valid = false;
        }
        if(valid) return i;
    }
    return -1;
}

int main() {
    int n;
    while(cin >> n, n){
        printf("%d\n", solve(n));
    }
    return 0;
}


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

int main(){
	cin.tie(0),ios::sync_with_stdio(false);
	int n; cin>>n;
	vector<int>a(n); for(auto&&i:a)cin>>i;
	vector<bool>ball(n,false);
	vector<int>ans;
	for(int i=n;i>0;--i){
		int sum=0;
		for(int j=i;j<=n;j+=i){
			sum+=ball.at(j-1);
		}
		if((sum&1)!=a.at(i-1)){
			ball.at(i-1)=true;
			ans.emplace_back(i);
		}
	}
	cout<<ans.size();
	if(ans.size()!=0)cout<<"\n"s<<ans.back();
	for(int i=ans.size()-2;i>=0;--i){
		cout<<" "s<<ans.at(i);
	}
	cout<<"\n"s;
}


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

int main()
{
    int x, y;
    cin >> x >> y;

    rep(i, 0, x + 1)
    {
        rep(j, 0, x + 1)
        {
            int a = j * 2;
            int b = (x - j) * 4;

            if ((a + b) == y)
            {
                cout << "Yes" << endl;
                return 0;
            }
        }
    }

    cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 3632
#include <stdio.h>
#include <string.h>
int main(void){
    char s[100];
    int a, b, n, i;
    
    scanf("%d%d",&a,&b);
    scanf("%s",s);
    
    n=strlen(s);
    for(i=0;i<n;i++){
        if((i!=a)&&(s[i]=='-')){
            printf("No\n");
            return 0;
        }
        else if((i==a)&&(s[i]!='-')){
            printf("No\n");
            return 0;
        }
    }
    printf("Yes\n");
    return 0;
}

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

bool check_from_i(int i, int m, vector<int> &A) {
    if (m == 0) {
        return true;
    }
    if (i >= A.size()) {
        return false;
    }

    return (check_from_i(i + 1, m, A) || check_from_i(i + 1, m - A[i], A));
}

bool check(int m, vector<int> &A) {
    return check_from_i(0, m, A);
}

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

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

    int q;
    cin >> q;
    for (int i = 0; i < q; i++)
    {
        int m;
        cin >> m;
        if (check(m, A))
            cout << "yes" << endl;
        else
        {
            cout << "no" << endl;
        }
    }
}


Measured memory_bytes: 3148
from itertools import product

V, E = map(int, input().split(' '))

INF = 10 ** 10


def _str(n):
    if n == INF:
        return 'INF'
    else:
        return str(n)


def _add(a, b):
    if INF in (a, b):
        return INF
    return a + b


dp = []
for _ in range(V):
    dp.append([INF] * V)

for i in range(V):
    dp[i][i] = 0

for _ in range(E):
    a, b, d = map(int, input().split(' '))
    dp[a][b] = d

for k, i, j in product(range(V), repeat=3):
    dp[i][j] = min(dp[i][j], _add(dp[i][k], dp[k][j]))

results = []
for v in range(V):
    if dp[v][v] < 0:
        print('NEGATIVE CYCLE')
        break
    results.append(' '.join(map(_str, dp[v])))
else:
    print('\n'.join(results))



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

#define ll long long

using namespace std;


int W,H;

char r[1000][1000];

int sh,sw;
int bnum=0;

int solve(int i,int j){
    int ans=0;

    if(i <0 || H <= i || j < 0 || W <= j)
        return 0;
    if(r[i][j] == '#'){
        return 0;
    }
    ans = 1;
    r[i][j] = '#';
    ans += solve(i-1,j);
    ans += solve(i+1,j);
    ans += solve(i,j-1);
    ans += solve(i,j+1);

    return ans;
}


int main(){

    while(1){
        scanf("%d %d",&W,&H);
        if(W == 0 && H == 0) break;

        for(int i=0;i<H;i++){
            for(int j=0;j<W;j++){
                cin >> r[i][j];
                if(r[i][j] == '@'){
                    sh = i;
                    sw = j;
                    r[i][j] = '.';
                }
            }
        }
        cout << solve(sh,sw) << endl;
    }

}


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

template <class t>
using vc = vector<t>;
template <class t>
using vvc = vector<vector<t>>;
typedef long long ll;
typedef vc<int> vi;
typedef vvc<int> vvi;
typedef pair<int, int> pi;

#define uset unordered_set
#define umap unordered_map

#define endl "\n"

#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define bg begin()
#define ed end()

#define all(a) a.bg, a.ed

template <class t, class u>
ostream &operator<<(ostream &os, const pair<t, u> &p) {
    return os << "( " << p.k << ", " << p.v << " )";
}

template <class t>
ostream &operator<<(ostream &os, const vc<t> &v) {
    os << "[ ";
    for (int i = 0; i < v.size(); i++) {
        os << v[i];
        if (i != v.size() - 1) {
            os << ", ";
        }
    }
    return os << " ]";
}

ll mult(ll a, ll b, ll c) {
    ll bot = ceil((double)a / c) * c;
    ll top = (b / c) * c;
    return (top - bot) / c + 1;
}

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

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

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    // cout << fixed << setprecision(18);
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    // Solution

    // TODO Had correct idea but implementation not 100% accurate
    //      sometimes off by one
    //
    long long a, b, c, d;
    cin >> a >> b >> c >> d;
    // ll cc = mult(a, b, c);
    // ll cd = mult(a, b, d);
    // ll cboth = mult(a, b, lcm(c, d));
    // cout << b - a + 1 - (cc + cd - cboth) << endl;
    ll l = lcm(c, d);
    //          Total   - divisible by C  - divisible by D  + divisible by both
    cout << (b - (a - 1)) - (b / c - (a - 1) / c) - (b / d - (a - 1) / d) + (b / l - (a - 1) / l) << endl;
}


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

#pragma GCC optimize("O3")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx") 
using namespace std;
typedef long long lint;
typedef long double ldb;
typedef unsigned long long uli;

#define X first
#define Y second
#define F(i, l, r) for(auto i = l; i != r; i++)
#define Df(i, l, r) for(auto i = l; i != r; i--)
#define I(i, a) for(auto i : a)
#define pb push_back
#define rs resize
#define mk make_pair
#define asg assign
#define all(x) x.begin(),x.end()
#define ret return
#define cont continue
#define brk break
#define ins insert
#define era erase
#define fi0(x) memset(x, 0, sizeof(x))
#define finf(x) memset(x, 127, sizeof(x))
#define acpy(y, x) memcpy(y, x, sizeof(y))
#define y1 adjf
#define tm afhdhn

const int MAXN = 1e5 + 5;

int n;
vector<int> gr[MAXN];
int g[MAXN];

void dfs(int v, int p = -1){
	g[v] = 0;
	I(u, gr[v]){
		if(u == p)cont;
		dfs(u, v);
		g[v] ^= (g[u] + 1);
	}
}

int main(){
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	scanf("%d", &n);
	F(i, 0, n - 1){
		int v, u;
		scanf("%d%d", &v, &u);
		v--; u--;
		gr[v].pb(u); gr[u].pb(v);
	}
	dfs(0);
	if(g[0] == 0)printf("Bob"); else printf("Alice");
	ret 0;
}


Measured memory_bytes: 9216
N, A, B = gets.split.map(&:to_i)
hs = N.times.map{gets.to_i}

puts (1..(10**9)).bsearch {|k|
    sum = 0
    hs.each do |h|
        sum += [(h-B*k-1)/(A-B) + 1, 0].max
    end
    sum <= k
}

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

int main(){
 int N;
  cin>>N;
  string s;
  cin>>s;
  for(int i=0;i<s.size();i++){
    s.at(i)+=N;
  }
  for(int i=0;i<s.size();i++){
    if(s.at(i)>90){
      s.at(i)=s.at(i)-90+65-1;
    }
  }
  cout<<s<<endl;
  
  
}


Measured memory_bytes: 256
//made by Sert
#include <bits/stdc++.h>
using namespace std;
const int INF = (int)1e9 + 34;
const int N = (int)1e6 + 34;

typedef long long ll;

ll go(const vector<pair<int, int>> &a, const vector<pair<int, int>> &b) {
    int n = a.size();
    vector<bool> u(n, false);
    int ca = 0, cb = 0;
    ll ans = 0;
    ll bst = 0;
    while (true) {
        while (ca < n && u[a[ca].second]) ca++;
        while (cb < n && u[b[cb].second]) cb++;
        if (ca == n) {
            ans += max(b[cb].first, 0);
            break;
        }
        if (cb == n) {
            ans += max(a[ca].first, 0);
            break;
        }
        int df = a[ca].first + b[cb].first;
        if (df > 0) {
            bst = max(bst, ans + max(a[ca].first, b[cb].first));
            u[a[ca].second] = u[b[cb].second] = true;
            ans += df;
            continue;
        } else {
            ans += max(0, max(a[ca].first, b[cb].first));
            break;
        }
    }
    return max(bst, ans);
}

void solve() {
    int n;
    scanf("%d", &n);
    vector<pair<int, int>> a(n), b(n);
    for (int i = 0; i < n; i++) {
        int x, y;
        scanf("%d%d", &x, &y);
        a[i] = make_pair(x * 2, i);
        b[i] = make_pair(-y * 2, i);
    }
    sort(a.begin(), a.end());
    sort(b.begin(), b.end());
    reverse(a.begin(), a.end());
    reverse(b.begin(), b.end());
    cout << go(a, b) << "\n";
}

int main() {
#ifdef SERT
    freopen("a.in", "r", stdin);
    //freopen("a.out", "w", stdout);
    solve();
    solve();
    solve();
    //solve();
#endif
    solve();
    return 0;
}

Measured memory_bytes: 1792
#include<vector>
#include<cstdio>
#include<algorithm>
using namespace std;
vector<int> e;
int a[13],bes;
void dfs(int i){
	if(i == 13){
		vector<int> f(e);
		sort(f.begin(),f.end());
		f.push_back(24);
		int cur = 99;
		for(int i=0; i+1<f.size(); i++){
			int w = f[i+1]-f[i];
			cur = min(cur, min(w, 24-w));
		}
		if(cur > bes)bes = cur;
		return;
	}
	if(a[i] == 0){
		dfs(i+1);
		return;
	}
	if(i == 0 || i == 12){
		e.push_back(i);
		dfs(i+1);
		e.pop_back();
		return;
	}
	if(a[i] == 2){
		e.push_back(i);
		e.push_back(24-i);
		dfs(i+1);
		e.pop_back();
		e.pop_back();
		return;
	}
	e.push_back(i);
	dfs(i+1);
	e.pop_back();
	e.push_back(24-i);
	dfs(i+1);
	e.pop_back();
}
int main(){
	int n,x,mx = 1;
	a[0] ++;
	for(scanf("%d",&n); n--;){
		scanf("%d",&x);
		a[x] ++;
		if(a[x] > mx)mx = a[x];
	}
	if(a[0] >= 2 || a[12] >= 2 || mx >= 3){
		puts("0");
		return 0;
	}
	bes=0;
	dfs(0);
	printf("%d\n",bes);
	return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <deque>
#include <iostream>
#include <numeric>
#include <queue>
#include <sstream>
#include <string>
#include <string.h>
#include <tuple>
#include <vector>

#define REP(i,x) for(int i{ 0 }; i < (int)(x); i++)
#define REPC(i,x) for(int i{ 0 }; i <= (int)(x); i++)
#define RREP(i,x) for(int i{ (int)(x) - 1 }; i >= 0 ;i--)
#define RREPC(i,x) for(int i{ (int)(x)}; i >= 0; i--)
#define REP1O(i,x) for(int i{ 1 }; i < (int)(x); i++)
#define REP1C(i,x) for(int i{ 1 }; i <= (int)(x); i++)

#define PB push_back
#define MP make_pair
#define F first
#define S second
#define SZ(x) ((int)(x).size())
#define ALL(x) (x).begin(),(x).end()

using namespace std;

typedef int64_t ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vector<int>> vvi;
typedef vector<vector<ll>> vvll;
typedef pair<int, int> pii;
typedef tuple<int, int, int> tupiii;
typedef tuple<ll, ll, ll> tuplll;

const int INTMAX = 2147483647;
const ll LLMAX = 9223372036854775807;
const int MOD = 1000000007;

template<class T> inline bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }
inline void swap(ll& a, ll& b) { a ^= b; b ^= a; a ^= b; }
inline void swap(int& a, int& b) { a ^= b; b ^= a; a ^= b; }


int n, w;
vi vw; vll vv;
vvll dp;


void init()
{
	cin >> n >> w;
	vw.resize(n); vv.resize(n);
	
	REP(i, n)
		cin >> vw[i] >> vv[i];

	dp.resize(n + 1, vll(w + 1, 0));
}


int main()
{
	init();
	REP(i, n)
		REPC(j, w)
	{
		chmax(dp[i + 1][j], dp[i][j]);
		if (j - vw[i] >= 0)
			chmax(dp[i + 1][j], dp[i][j - vw[i]] + vv[i]);
	}

	cout << dp[n][w];

}


Measured memory_bytes: 80256
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii =  pair<int, int>;
using pll =  pair<long long, long long>;
constexpr char ln =  '\n';
constexpr long long MOD = 1000000007LL;
constexpr long long INF = 1000000009LL;
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define fo(i,j,n) for (int i=(j); i < (n); i++)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

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

    double res = 0;
    for(int fir=1; fir<=n; fir++){
        double score = fir, par = 1;
        while(score < k){
            par /= 2;
            score *= 2;
        }
        res += par / n;
    }
    cout << fixed << setprecision(12);
    cout << res << ln;
} 


Measured memory_bytes: 256
#include <vector>
#include <list>
#include <map>
#include <climits>
#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>
#include <queue>
#include <random>
#include <complex>
#include <regex>

using namespace std;

#define SHOW_VECTOR(v) {std::cerr << #v << "\t:" ; for(const auto &xxx : v) {std::cerr << xxx << " ";} std::cerr << "\n";}
#define SHOW_MAP(v) {std::cerr << #v << "\t:" ; for(const auto &xxx : v) {std::cerr << xxx.first << " " << xxx.second << "\n";} std::cerr << "\n";}

typedef complex<double> P;

double getD(P p, double r1, double r2) {
    double sumR = r1 + r2;
    double diffR = r1 - r2;
    return sqrt(sumR * sumR - diffR * diffR);
}

int main() {

    int N;
    cin >> N;

    vector<double> r(N);
    for (int i = 0; i < N; i++) cin >> r[i];

    vector<P> dp(N);

    //x, y
    dp[0] = P(r[0], r[0]);

    for (int i = 1; i < N; i++) {
        double maxV = 1e-10;
        for (int j = 0; j < i; j++) {
            double d = getD(dp[j], r[i], r[j]);
            maxV = max({maxV, d + dp[j].real(), r[i]});
        }
        dp[i] = P(maxV, r[i]);
    }

    double ans = 1e-20;
    for(int i = 0;i<N;i++){
        ans = max(ans, dp[i].real() + dp[i].imag());
    }



//    for (int i = 0; i < N; i++) {
//        cout << fixed << setprecision(10) << dp[i].real() << endl;
//    }
//

    cout << fixed << setprecision(10) << ans << endl;

    return 0;
}


Measured memory_bytes: 3280
n = gets.chomp

n1 = n[-1].to_i

if n1 == 2 or n1 == 4 or n1 == 5 or n1 == 7 or n1 == 9 then
  print "hon"
elsif n1 == 3 then
  print "bon"
else
  print "pon"
end

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

constexpr int kN = 50000;

int main() {
    int n, m, t; scanf("%d%d%d", &n, &m, &t);
    if (t == 1) {
        vector<bitset<kN>> bs(n);
        for (int i = 0; i < n; ++i) bs[i].set(i);
        vector<pair<int, int>> ed(m);
        for (int i = 0; i < m; ++i) {
            int u, v; scanf("%d%d", &u, &v);
            u--, v--;
            bs[u] |= bs[v];
            bs[v] |= bs[u];
            ed[i] = make_pair(u, v);
        }
        for (int i = 0; i < n; ++i) {
            if (bs[i].count() == n) {
                vector<int> ok(n);
                ok[i] = 1;
                bool fd = false;
                string ans(m, '^');
                for (int j = m - 1; j >= 0; --j) {
                    fd |= (ed[j].first == i || ed[j].second == i);
                    if (!fd) continue;
                    if (!ok[ed[j].first] && !ok[ed[j].second]) continue;
                    if (ok[ed[j].first] && ok[ed[j].second]) continue;
                    if (ok[ed[j].second]) ans[j] = 'v';
                    ok[ed[j].first] = ok[ed[j].second] = 1;
                }
                for (int j = 0; j < n; ++j) assert(ok[j]);
                printf("%s\n", ans.c_str());
                return 0;
            }
        }
        puts("-1");
    } else {
        if (n == 2) {
            puts("-1");
            return 0;
        }
        vector<pair<int, int>> ed(m);
        for (int i = 0; i < m; ++i) {
            scanf("%d%d", &ed[i].first, &ed[i].second);
            ed[i].first--;
            ed[i].second--;
        }
        vector<int> dest(n), cnt(n);
        for (int i = 0; i < n; ++i) dest[i] = i, cnt[i] = 1;
        string ans(m, '^');
        for (int i = m - 1; i >= 0; --i) {
            if (dest[ed[i].first] == dest[ed[i].second]) continue;
            if (cnt[dest[ed[i].second]] == n - 1) {
                --cnt[dest[ed[i].second]];
                dest[ed[i].second] = dest[ed[i].first];
                ++cnt[dest[ed[i].second]];
            } else {
                --cnt[dest[ed[i].first]];
                dest[ed[i].first] = dest[ed[i].second];
                ++cnt[dest[ed[i].first]];
                ans[i] = 'v';
            }
        }
        printf("%s\n", ans.c_str());
    }
    return 0;
}


Measured memory_bytes: 306944
#include<iostream>
#include<vector>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<queue>
#include<deque>
#include<map>
#include<bitset>
using namespace std;

typedef long long ll;
#define rep(i, n) for(int i = 0;i < (n);i++)
#define repr(i, n) for(int i = (n);i >= 0;i--)
#define repf(i, m, n) for(int i = (m);i < (n);i++)
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 dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0};
//////////////////////////////////////////////////


int main() {
    vector<vector<int>> a(3, vector<int>(3));
    vector<vector<bool>> c(3, vector<bool>(3, false));
    rep(i,3) rep(j,3) cin >> a[i][j];
    int n; cin >> n;
    rep(i,n) {
        int b; cin >> b;
        rep(j,3) rep(k,3) {
            if (a[j][k] == b) {
                c[j][k] = true;
            }
        }
    }

    bool ans = false;
    rep(i,3) {
        bool tate = true, yoko = true;
        rep(j,3) {
            if (!c[i][j]) tate = c[i][j];
            if (!c[j][i]) yoko = c[j][i];
        }
        if (tate | yoko) ans = true;
    }
    if (c[0][0] && c[1][1] && c[2][2]) ans = true;
    if (c[2][0] && c[1][1] && c[0][2]) ans = true;

    if (ans) cout << "Yes" << endl;
    else cout << "No" << endl;
    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 INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;


int main(){
 ll a;
  double b;
  cin >>a>>b;
  ll ib =b*100+0.5;
  a*=ib;
  a/=100;
  printf("%lld\n",a);
}

Measured memory_bytes: 3768
using System;

namespace AGC025A
{
    class Program
    {
        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());
            int min = 1000000;
            for(int a = 1; a < N; a++){
                int b = N-a;
                int wa_tmp =  wa(a) + wa(b);
                if(wa_tmp < min ) min = wa_tmp;
            }
            Console.WriteLine(min);
        }
        public static int wa(int x){
            int ans = 0;
            while(x > 0){
                ans += x % 10; x /= 10;
            }            
            return ans;
        }
    }
}


Measured memory_bytes: 11092
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <deque>
#include <numeric>
#include <sstream>
#include <iomanip>
#define ALL(X) X.begin(), X.end()
using lint = long long;
template <typename T>
void print_container(std::vector<T> vec)
{
    for (auto iter = vec.begin(); iter != vec.end(); ++iter)
    {
        std::cout << *iter << " ";
    }
    std::cout << std::endl;
}

int main()
{
    lint n;
    scanf("%lld", &n);

    std::vector<lint> a(n);
    for (int i = 0; i < n; ++i)
    {
        scanf("%lld", &a[i]);
    }

    std::unordered_map<lint, lint> ref;

    for (int i = 0; i < n; ++i)
    {
        if (ref.find(a[i]) == ref.end())
        {
            ref[a[i]] = 1;
        }
        else
        {
            ref[a[i]]++;
        }
    }

    lint ans = 0;

    if (ref[1] == 1)
    {
        std::cout << 1 << "\n";
    }
    else if (ref[1] > 1)
    {
        std::cout << 0 << "\n";
    }
    else
    {
        for (int i = 0; i < n; ++i)
        {
            lint cur = a[i];
            lint ok = 1;
            if (ref[cur] == 1)
            {
                for (int j = 2; j < sqrt(cur) + 0.005; ++j)
                {
                    if (cur % j == 0 && (ref.find(j) != ref.end() || ref.find(cur / j) != ref.end()))
                    {
                        ok = 0;
                        break;
                    }
                }
                if (ok == 1)
                {
                    ans++;
                }
            }
        }
        std::cout << ans << "\n";
    }

    return 0;
}


Measured memory_bytes: 15400
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define mod 1000000007
#define f(i,a,b) for(ll i=a;i<b;i++)
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ii pair<ll,ll>
#define vii vector<ii>
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define MAX 1e9
 
ll modpow(ll base, ll exp, ll modulus) {base %= modulus;ll result = 1;while (exp > 0) {if (exp & 1) result = (result * base) % modulus;base = (base * base) % modulus;exp >>= 1;}return result;}
const ld pi=acos(-1);


int main(){
    IOS;
    ll a,v,b,w,t;
    cin>>a>>v>>b>>w>>t;
    ll dist=abs(a-b);
    if(a<=b && a+v*t>=b+w*t)cout<<"YES";
    else if(b<a && a-v*t<=b-w*t)cout<<"YES";
    else cout<<"NO";
    return 0;  
} 





Measured memory_bytes: 3688
// 2013/09/17 Tazoe

#include <iostream>
#include <string>
#include <stack>
using namespace std;

int main()
{
	while(true){
		string S;
		getline(cin, S);

		if(S==".")
			break;

		stack<char> stk;

		bool err = false;

		for(int i=0; i<S.size(); i++){
			switch(S[i]){
				case '(':
				case '[':
					stk.push(S[i]);
					break;
				case ')':
					if(!stk.empty() && stk.top()=='('){
						stk.pop();
					}
					else{
						err = true;
					}
					break;
				case ']':
					if(!stk.empty() && stk.top()=='['){
						stk.pop();
					}
					else{
						err = true;
					}
					break;
			}

			if(err)
				break;
		}

		if(!err && stk.empty()){
			cout << "yes" << endl;
		}
		else{
			cout << "no" << endl;
		}
	}

	return 0;
}

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

const int N = 1003;
int n, tp, x[N], y[N];
bool d, ux[40], uy[40];

inline void cal(int x, bool* c) {
	bool fl = x < 0;
	if (fl)x = -x;
	c[30] = c[31] = 1;
	for (int i = 1; i <= 30; i++)
		c[i - 1] = x >> i & 1;
	if (fl)
		for (int i = 0; i < 31 + d; i++)
			c[i] ^= 1;
}
int main() {
	scanf("%d", &n);
	for (int i = 0; i < n; i++) {
		scanf("%d%d", x + i, &tp);
		y[i] = x[i] - tp, x[i] += tp;
		if (!i)d = x[i] & 1;
		if (x[i] & 1 ^ d || y[i] & 1 ^ d)
			return puts("-1"), 0;
	}
	printf("%d\n", 31 + d);
	for (int i = 0; i < 30; i++)
		printf("%d ", 1 << i);
	printf("%d", (1 << 30) - 1);
	puts(d ? " 1" : "");
	for (int i = 0; i < n; i++) {
		cal(x[i], ux), cal(y[i], uy);
		for (int j = 0; j < 31 + d; j++)
			putchar(ux[j] ? uy[j] ? 'R' : 'U' : (uy[j] ? 'D' : 'L'));
		puts("");
	}
}


Measured memory_bytes: 256