akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
    using namespace std;
    typedef long long ll;
    typedef pair<ll, ll> l_l;
    typedef pair<int, int> i_i;
     
    const long double PI = (acos(-1));
    const long double EPS = 0.0000000001;
     
    long double a, b, x;
     
    void input() {
        cin >> a >> b >> x;
    }
     
    long double f(long double a, long double b, long double x) {
        long double ans;
        if(a * a * b / 2.0 <= x) {
            ans = atan(2 * (a * a * b - x) / (a * a * a));
        } else {
            ans = PI / 2 - atan(2 * x / (a * b * b));
        }
        return ans;
    }
     
    void solve() {
        input();
        cout << fixed << setprecision(10) << f(a, b, x) * 180.0 / PI << endl;
        return;
    }
     
    int main() {
        solve();
        return 0;
    }

Measured memory_bytes: 384
#include "bits/stdc++.h"
using namespace std;
#ifdef _DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

#define int long long
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9) + 7;
template<class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a > b) { a = b; return true; } return false; }

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N; cin >> N;
	int ans = 1;
	rep(i, 0, N) {
		ans *= i + 1;
		ans %= MOD;
	}
	cout << ans << endl;
	return 0;
}

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


dict = {}
for i in range(n):
  s = input()
  if(s not in dict):
    dict[s] = 0
  dict[s]+=1
  
m = max(dict.values())
strs = dict.keys()
strs = filter(lambda x: dict[x] == m , strs)
strs = sorted(strs)
for s in strs:
  print(s)

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

#define ANS  //for answer
#define CMP  //for compe

#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()
#define nv(x) #x,(x)
#define ncv(x) #x,":",(x)
#define ncvc(x) #x,":",(x),","
using ll = long long;
void pPRINT(std::ostream& ost) {}
template <class T, class... U>void pPRINT(std::ostream& ost,const T t,const U... u) {ost<<t<<" ";pPRINT(ost, u...);}
template <class... T>void PRINT(const T... t) {pPRINT(std::cout, t...);}
template <class... T>void PRINTl(const T... t){pPRINT(std::cout,t...);std::cout<<"\n";}
template <class T>void PRINTa(const T* const t,const ll size){REP(i,size)PRINT(t[i]);PRINTl();}
template <class T>void PRINTal(const T* const t,const ll size){REP(i,size)PRINTl(i,":",t[i]);}
#ifdef CMP
using namespace std;
#else
#endif
#ifdef ANS
#define DEBUG(...)
void init(){}
#else
#define DEBUG(...) PRINT("##DEBUG##","file :",__FILE__,", line :",__LINE__,"[");PRINT(__VA_ARGS__);PRINTl("]");
void init(){
  cin.tie(0);
  ios::sync_with_stdio(false);
}
#endif

void solve();

int main(int argc, char *argv[]) {

  init();
  DEBUG();
  solve();

  return 0;
}

void solve(){

  DEBUG("SOLVE START");

  ll a,b,c;cin>>a>>b>>c;
  ll ans = c-(a-b);
  PRINT((ans<0?0:ans));

}

Measured memory_bytes: 256
#include <stdio.h>

int main(void){
	int n, i, a, b;
	long max, m;
	
	
	scanf("%d", &n);
	scanf(" %ld", &m);
	
	max=m;
	
	for(i=0; i<n; i++){
		scanf(" %d %d", &a, &b);
		m += a-b;
		if(m<0) {
			max=0;
			break;
		}		
		if(max < m) max = m;
		
		//printf("now:%ld\n",m);
	}
	
	printf("%ld\n", max);

	return 0;
}

Measured memory_bytes: 596
#include <iostream>
#include <complex>
#include <cmath>
#include <cstdio>
#include <string>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <vector>

using namespace std;

long long dp[4000][4000];
long long pos[4000][4000];
long long sum[4001];

int main() {
    int n;
    cin >> n;
    vector<long long> w(n);
    for (int i = 0; i < n; i++) {
        cin >> w[i];
        sum[i+1] = sum[i] + w[i];
    }
    for (int i = 0; i < 4000; i++) {
        for (int j = 0; j < 4000; j++) {
            dp[i][j] = 1LL << 60;
        }
    }
    for (int i = 0; i < n; i++) {
        dp[i][i] = 0;
        pos[i][i] = i;
        //cout << pos[i][i] << " ";
    }
    //cout << endl;

    for (int d = 1; d < n; d++) {
        for (int i = 0; i + d < n; i++) {
            for (int j = pos[i][i + d - 1]; j <= pos[i+1][i + d] && j < i + d; j++) {
                if (dp[i][i+d] > dp[i][j] + dp[j+1][i+d] + sum[i + d + 1] - sum[i]) {
                    dp[i][i+d] = dp[i][j] + dp[j+1][i+d] + sum[i + d + 1] - sum[i];
                    pos[i][i+d] = j;
                }
            }
            //cout << pos[i][i+d] << " ";
        }
        //cout << endl;
    }
    cout << dp[0][n-1] << endl;
    return 0;
}

Measured memory_bytes: 251260
import java.io.*; 
import java.math.*;
import java.util.*;
import java.awt.Point;
 
public class Main {
	static final long MOD = 998244353L;
	//static final long INF = -1000000000000000007L;
	//static final long MOD = 1000000007L;
	//static final int INF = 1000000007;
	
	public static void main(String[] args) {
		FastScanner sc = new FastScanner();
		PrintWriter pw = new PrintWriter(System.out);
		int N = sc.ni();
		int ans = -1;
		for (int i = 1; i <= 50000; i++) {
			if ((int)(1.08 * i)==N) {
				ans = i;
				break;
			}
		}
		if (ans >= 0)
			pw.println(ans);
		else
			pw.println(":(");
		pw.close();
 	}
    
    public static int[][] sort(int[][] array) {
    	//Sort an array (immune to quicksort TLE)
		Random rgen = new Random();
		for (int i = 0; i < array.length; i++) {
		    int randomPosition = rgen.nextInt(array.length);
		    int[] temp = array[i];
		    array[i] = array[randomPosition];
		    array[randomPosition] = temp;
		}
		Arrays.sort(array, new Comparator<int[]>() {
			  @Override
        	  public int compare(int[] arr1, int[] arr2) {
				  return arr1[0]-arr2[0]; //ascending order
	          }
		});
		return array;
	}
    
    public static long[][] sort(long[][] array) {
    	//Sort an array (immune to quicksort TLE)
		Random rgen = new Random();
		for (int i = 0; i < array.length; i++) {
		    int randomPosition = rgen.nextInt(array.length);
		    long[] temp = array[i];
		    array[i] = array[randomPosition];
		    array[randomPosition] = temp;
		}
		Arrays.sort(array, new Comparator<long[]>() {
			  @Override
			  //Descending order
        	  public int compare(long[] arr1, long[] arr2) {
				  if (arr2[0] < arr1[0])
					  return -1;
				  if (arr2[0] > arr1[0])
					  return 1;
				  return 0;
	          }
		});
		return array;
	}
    
    static class FastScanner { 
        BufferedReader br; 
        StringTokenizer st; 
  
        public FastScanner() { 
            br = new BufferedReader(new InputStreamReader(System.in)); 
        } 
  
        String next() { 
            while (st == null || !st.hasMoreElements()) { 
                try { 
                    st = new StringTokenizer(br.readLine());
                } catch (IOException  e) { 
                    e.printStackTrace(); 
                } 
            } 
            return st.nextToken(); 
        } 
  
        int ni() { 
            return Integer.parseInt(next()); 
        } 
  
        long nl() { 
            return Long.parseLong(next()); 
        } 
  
        double nd() { 
            return Double.parseDouble(next()); 
        } 
  
        String nextLine() { 
            String str = ""; 
            try { 
                str = br.readLine(); 
            } catch (IOException e) {
                e.printStackTrace(); 
            } 
            return str; 
        }
    }
}

Measured memory_bytes: 23252
#include <bits/stdc++.h>
#define ll long long int
#define N 1000
#define M 1000000007
#define f(i, a, b) for (ll i = (ll)a; i <= (ll)b; i++)
#define rf(i, a, b) for (ll i = (ll)a; i >= (ll)b; i--)
#define po pop_back
#define pb push_back
#define lb lower_bound
#define fi first
#define se second
#define mp make_pair
#define bs binary_search
#define debug(x) cout << #x << " = " << x << endl
#define ub upper_bound
#define ibs ios_base::sync_with_stdio(false)
#define cti cin.tie(0)
#define all(x) x.begin(), x.end()
#define PI 3.14159265
#define cot cout.tie(0)
using namespace std;
/**
  * @author :: Rishabh
  *
  */
	ll a[110];
	ll b[110];
	
	ll dp[1001][100001]={0};
int main()
{
	ibs;
	cti;
	ll n,w;
	cin>>n>>w;

	for(ll i=0;i<n;i++)
	cin>>a[i]>>b[i];
	 
	for(ll i=0;i<n;i++)
    {
        for(ll j=0;j<(w+1);j++)
        {
            if ((j - a[i]) >= 0) 
            dp[i+1][j] = max(dp[i][j - a[i]] + b[i], dp[i][j]);
            else 
            dp[i + 1][j] = dp[i][j];
        }
    }
    cout<<dp[n][w]<<"\n";
	return 0;
}


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

const long long mod = 1e9 + 7;

using ll = long long;
using pii  = pair<int, int>;
using pll = pair<ll, ll>;
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pii>
#define vpll vector<pll>

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; i++)
#define rep1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; i++)
#define repr(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rep1r(i, n) for (int i = ((int)(n)); i >= 1; i--)

#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define RSORT(x) sort(rall(x));
#define pb push_back
#define mp make_pair

#define INF (2e18)
#define PI (acos(-1))
#define EPS (1e-7)

ull gcd(ull a, ull b) { return b ? gcd(b, a % b) : a; }
ull lcm(ull a, ull b) { return a / gcd(a, b) * b; }

int main(){
    ll a, b, c, d;
    cin >> a >> b >> c >> d;
    cout << max({a*c, a*d, b*c, b*d}) << endl;
    return 0;
}


Measured memory_bytes: 3624
MM = input().split()
N = int(MM[0])
M = int(MM[1])
list1 = []
list2 = []
for i in range(N):
  LL = input().split()
  list1.append(LL)

for i in range(M):
  MM = input().split()
  list2.append(MM)

for i in list1:
  mini = 40**8
  ans = 0
  for j in range(len(list2)):
    x = int(i[0]) - int(list2[j][0])
    y = int(i[1]) - int(list2[j][1])
    xx = abs(x) + abs(y)
    if xx < mini:
      mini = xx
      ans = j+1
  print(ans)

Measured memory_bytes: 8984
L = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]

K = int(input())
print(L[K-1])

Measured memory_bytes: 3060
#include <bits/stdc++.h>    
using namespace std;
     
    int main(){
      char x,y;
      cin >> x >> y;
      if(x == y){
        cout << '=' << endl;
      }else if(x > y){
        cout << '>' << endl;
      }else{
        cout << '<' << endl;
      }
     
      return 0;
    }

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

int main(){
    string s,t;
    cin>>s;
    cin>>t;
    ll i=0,cnt=0;
    for(i=0;i<s.size();i++){
        if(s[i]!=t[i])
            cnt++;
    }
cout<<cnt<<endl;
return 0;
}




Measured memory_bytes: 3832
#include <bits/stdc++.h>
#define rep(i,n) for(ll i=0;i<(n);++i)
#define all(a) (a).begin(),(a).end()
using namespace std;
using Graph = vector<vector<int>>;
typedef pair<int,int> P;
typedef long long ll;

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

    rep(i,n){
        int tmp = 0;

        for(char c = 'a'; c<= 'z'; c++){
            bool jud1 = false;
            for(int j=0; j<=i; j++){
                if(s[j] == c) jud1 = true;
            }

            bool jud2 = false;
            for(int j=i+1; j<n; j++){
                if(s[j] == c) jud2 = true;
            }

            if(jud1 && jud2) tmp++;

        }
        ans = max(ans,tmp);
    }

    cout << ans << endl;
}

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

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

    if(s[1] == 'B') {
        s[1] = 'R';
    } else {
        s[1] = 'B';
    }

    cout << s << endl;
    return 0;
}

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

vector<bool> primes_create(int n){
  vector<bool> primes(n+1, true);
	primes[0] = primes[1] = false;
  for(int i=2L; i*i<=n; ++i){
		int ix = i + i;
		while(ix <= n){
			primes[ix] = false;
			ix += i;
		}
  }
  return primes;
}

int main(){
	vector<bool> primes = primes_create(100000+1);

	vector<int> C(primes.size());//Cumulative sum
	for(int n=1; n<primes.size(); ++n)
		C[n] += C[n-1] + (primes[n] && (n+1)%2==0 && primes[(n+1)/2]);

	int Q; cin>>Q;
	while(Q--){
		int l,r; cin>>l>>r;
		cout<< C[r] - C[l] + (C[l]!=C[l-1]) <<endl;
	}
}

Measured memory_bytes: 1024
n = int(input())
f = []
for _ in range(n):
    f_ = list(map(int, input().split()))
    f.append(f_)

p = []
for _ in range(n):
    p.append(list(map(int, input().split())))


def help(a):
    if sum(a) == 0:
        return -float("inf")
    res = 0
    for i in range(n):
        num = 0
        for j in range(10):
            if a[j] == 1 and f[i][j] == 1:
                num += 1
        res += p[i][num]
    return res
lst = []
for a1 in range(2):
        for a2 in range(2):
            for a3 in range(2):
                for a4 in range(2):
                    for a5 in range(2):
                        for a6 in range(2):
                            for a7 in range(2):
                                for a8 in range(2):
                                    for a9 in range(2):
                                        for a10 in range(2):
                                            res = help([a1, a2, a3, a4, a5, a6, a7, a8, a9, a10])
                                            lst.append(res)
print(max(lst))

Measured memory_bytes: 3064
#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(int i = 0; i < n; ++i) cin >> a[i];
  int q;
  cin >> q;
  vector<int> x(q), y(q);
  for(int i = 0; i < q; ++i) {
    cin >> x[i] >> y[i];
    x[i]--; y[i]--;
  }

  auto vec = a;
  sort(vec.begin(), vec.end());
  int cnt = 0;
  for(int i = 0; i < n; ++i) {
    if(vec[i] != a[i]) cnt++;
  }
  if(cnt == 0) return cout << 0 << endl, 0;

  for(int i = 0; i < q; ++i) {
    if(a[x[i]] == vec[x[i]]) cnt++;
    if(a[y[i]] == vec[y[i]]) cnt++;
    if(a[y[i]] == vec[x[i]]) cnt--;
    if(a[x[i]] == vec[y[i]]) cnt--;
    swap(a[x[i]], a[y[i]]);

    if(cnt == 0) return cout << i + 1 << endl, 0;
  }
  cout << -1 << endl;
}


Measured memory_bytes: 7624
#include<iostream>
#include<cstdio>
#include<vector>
#include<algorithm>
#include<iterator>

using namespace std;
void haha()
{
   int x;
   cin>>x;
   if(x>=400 && x<=599)
    cout<<"8"<<endl;
    else if(x>=600 && x<=799)
    cout<<"7"<<endl;
    else if(x>=800 && x<=999)
    cout<<"6"<<endl;
    else if(x>=1000 && x<=1199)
    cout<<"5"<<endl;
    else if(x>=1200 && x<=1399)
    cout<<"4"<<endl;
    else if(x>=1400 && x<=1599)
    cout<<"3"<<endl;
    else if(x>=1600 && x<=1799)
    cout<<"2"<<endl;
    else if(x>=1800 && x<=1999)
    cout<<"1"<<endl;

}

int main()
{
        haha();
}


Measured memory_bytes: 3592
#include<iostream>
#include<cstring>
using namespace std;
char A[205];

int main()
{
cin >> A;
int b=strlen(A)-2;
while(b){
int p=1;
for(int i=0;i<b/2;i++)
{
	if(A[i]!=A[i+b/2]) p=0;
	if(p==0) break;
}
if(p==1) break;
else b=b-2;	
}
cout << b << endl;
return 0;	
}

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

int main(void){

    int N,K;
    cin >> N >> K;
    //cout << (N + 1) / 2 <<">=" <<  K<<endl;
    if( (N + 1) / 2 >= K)cout <<"YES"<<endl;
    else cout << "NO"<<endl;
    
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main { 
	public static void main(String[] args){
        // 変数と配列
	String str;
        int inNumber1, inNumber2, inNumber3;
 
        // 各数字の入力
        Scanner scan = new Scanner(System.in);
        str = scan.next();
        inNumber1 = Integer.parseInt(str);
        str = scan.next();
        inNumber2 = Integer.parseInt(str);
        str = scan.next();
        inNumber3 = Integer.parseInt(str);

        // 条件判定
        if(inNumber1 < inNumber2 && inNumber2 < inNumber3)
                System.out.println("Yes");
        else
                System.out.println("No");
	}
}

Measured memory_bytes: 17120
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
using namespace std;
using ll=long long;
constexpr ll mod=998244353;
constexpr int inf=1000000000;
constexpr ll linf=1000000000000000000;

ll modpow(ll x,ll n){
    ll res=1;
    while(n>0){
        if(n&1)res=res*x%mod;
        x=x*x%mod;
        n>>=1;
    }
    return res;
}

ll dp[301][300*300+1];
ll dp2[301][300*300+1];

int main(){
    int n;
    cin>>n;
    int a[n];
    int sum=0;
    rep(i,n){
        cin>>a[i];
        sum+=a[i];
    }
    dp[0][0]=dp2[0][0]=1;
    rep(i,n){
        rep(j,sum){
            dp[i+1][j]=(dp[i+1][j]+2*dp[i][j])%mod;
            dp2[i+1][j]=(dp2[i+1][j]+dp2[i][j])%mod;
            if(j+a[i]<=sum){
                dp[i+1][j+a[i]]=(dp[i+1][j+a[i]]+dp[i][j])%mod;
                dp2[i+1][j+a[i]]=(dp2[i+1][j+a[i]]+dp2[i][j])%mod;
            }
        }
    }
    ll ans=modpow(3,n);
    for(int i=(sum+1)/2;i<=sum;++i){
        ans=(ans-3*dp[n][i])%mod;
    }
    if(sum%2==0){
        ans=(ans+3*dp2[n][sum/2])%mod;
    }
    cout<<(ans+mod)%mod<<endl;
}


Measured memory_bytes: 422784
#include<stdio.h>
int main(void)
{
    int c[100],t[100],N,T,i,j,k,l,min=1001;
    scanf("%d %d",&N,&T);
    for(i=0;i<N;i++)
    {
        scanf("%d %d",&c[i],&t[i]);
        if(t[i]<=T&&c[i]<min)
            min=c[i];
    }
    if(min==1001) printf("TLE");
    else printf("%d",min);
    return 0;
}


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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll mod = 1e9 + 7;
  ll N, M;
  cin >> N >> M;
  ll mg;
  ll ans;
  if(abs(N - M) == 0) {
    mg = 2;
  } else if(abs(N - M) == 1) {
    mg = 1;
  } else {
    mg = 0;
  }
  ll a = 1;
  ll b = 1;
  for(ll i = 1; i <= N; i++) {
    a = (a * i) % mod;
  }
  for(ll i = 1; i <= M; i++) {
    b = (b * i) % mod;
  }
  ans = (a * b * mg) % mod;
  cout << ans << endl;

  return 0;
}

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

#define d(x) cerr << #x ":" << x << endl;
#define dd(x, y) cerr << "(" #x "," #y "):(" << x << "," << y << ")" << endl
#define rep(i, n) for (int i = (int)(0); i < (int)(n); i++)
#define repp(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define all(v) v.begin(), v.end()
#define dump(v)                  \
    cerr << #v ":[ ";            \
    for (auto macro_vi : v) {    \
        cerr << macro_vi << " "; \
    }                            \
    cerr << "]" << endl;
#define ddump(v)                           \
    cerr << #v ":" << endl;                \
    for (auto macro_row : v) {             \
        cerr << "[";                       \
        for (auto macro__vi : macro_row) { \
            cerr << macro__vi << " ";      \
        }                                  \
        cerr << "]" << endl;               \
    }
using lint       = long long;
const int INF    = 1e9;
const lint LINF  = 1e18;
const lint MOD   = 1e9 + 7;
const double EPS = 1e-10;

// 約数列挙
template <class T>
vector<T> dividers(T n) {
    vector<T> ret;
    for (T x = 1; x * x <= n; x++) {
        if (n % x == 0) {
            ret.push_back(x);
            ret.push_back(n / x);
        }
    }
    return ret;
}

int main() {
    lint N;
    cin >> N;
    vector<lint> divs = dividers(N);
    dump(divs);

    lint ans = 0;
    for (auto div : divs) {
        lint m = div - 1;
        if (m == 0) continue;
        if (N % m == N / m and m > N / m) { ans += m; }
    }

    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 384
s=str(input())
n=len(s)
i=0
ans=0
c=0
d=0
j=0
while i < n:
	if s[i] == "<":
		c=c+1
		ans=ans+c
		j=0
	else:
		j=j+1
		if j > 1:
			if d >= j:
				ans=ans+j-1
			else:
				ans=ans+j
		elif i == 0:
			ans=1
		else:
			d=c
		c=0
	i=i+1
print(ans)

Measured memory_bytes: 4104
#include <bits/stdc++.h>
using namespace std;
int main(void)
{
  long long int n,i,j,count,answer,len;
  cin >> n;
  vector <vector<double>> data((n),vector<double>(n));
  for(i=0;i<n;i++)
  {
    for(j=0;j<2;j++)
    {
      cin >> data[i][j];
    }
  }
  count=0;
  for(i=0;i<n;i++)
  {
    if(data[i][0] == data[i][1])
    {
      count++;
    }
    else
    {
      count = 0;
    }
    if(count == 3)
    {
      break;
    }
  }
  if(count == 3)
  {
    cout << "Yes";
  }
  else
  {
    cout << "No";
  }
  
  return 0;
}

Measured memory_bytes: 3792
import java.io.*;

class Main{
public static void main(String[] args) throws IOException{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
String line="";
double weight;
while((line=br.readLine())!=null){
weight=Double.parseDouble(line);
classOfBoxing(weight);
}
}
private static void classOfBoxing(double n){
if(n<=48.00){
System.out.println("light fly");
}
else if(n>48.00 &&n<=51.00){
System.out.println("fly");
}
else if(n>51.00 &&n<=54.00){
System.out.println("bantam");
}
else if(n>54.00 &&n<=57.00){
System.out.println("feather");
}
else if(n>57.00 &&n<=60.00){
System.out.println("light");
}
else if(n>60.00 &&n<=64.00){
System.out.println("light welter");
}
else if(n>64.00 &&n<=69.00){
System.out.println("welter");
}
else if(n>69.00 &&n<=75.00){
System.out.println("light middle");
}
else if(n>75.00 &&n<=81.00){
System.out.println("middle");
}
else if(n>81.00 &&n<=91.00){
System.out.println("light heavy");
}
else{
System.out.println("heavy");
}
}
}

Measured memory_bytes: 16900
line = raw_input()
N, K = [int(s) for s in line.split(' ')]
line = raw_input()
Xs = [int(s) for s in line.split(' ')]

ret = []
for i in range(0, len(Xs) - K + 1):
    p = Xs[i + K - 1]
    m = Xs[i]
    if p * m == 0:
        ret.append(abs(p) * abs(m))
        continue
    if p * m > 0:
        ret.append(max(abs(p), abs(m)))
        continue
    ret.append(abs(p) * 2 + abs(m))
    ret.append(abs(p) + abs(m) * 2)

print min(ret)


Measured memory_bytes: 12264
import sys

N = int(input())
s = input()

for i in range(4):
    ans = ''
    if i == 0:
        ans += 'SS'
    elif i == 1:
        ans += "SW"
    elif i == 2:
        ans += "WS"
    elif i == 3:
        ans += "WW"
    for j in range(N-1):
        if ans[j+1] == 'S':
            if s[j+1] == 'o':
                ans += ans[j]
            else:
                if ans[j] == 'S':
                    ans += 'W'
                else:
                    ans += 'S'
        else:
            if s[j+1] == 'x':
                ans += ans[j]
            else:
                if ans[j] == 'S':
                    ans += 'W'
                else:
                    ans += 'S'
    if ans[0] == ans[-1]:
        if ans[0] == "S":
            if s[0] == 'o' and ans[-2] == ans[1]:
                print(ans[:-1])
                sys.exit()
            elif s[0] == 'x' and ans[-2] != ans[1]:
                print(ans[:-1])
                sys.exit()
        else:
            if s[0] == 'x' and ans[-2] == ans[1]:
                print(ans[:-1])
                sys.exit()
            elif s[0] == 'o' and ans[-2] != ans[1]:
                print(ans[:-1])
                sys.exit()

print(-1)


Measured memory_bytes: 9500
#!/usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys
import random
import itertools
import math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt


def LI(): return list(map(int, input().split()))


def LF(): return list(map(float, input().split()))


def LI_(): return list(map(lambda x: int(x)-1, input().split()))


def II(): return int(input())


def IF(): return float(input())


def LS(): return list(map(list, input().split()))


def S(): return list(input().rstrip())


def IR(n): return [II() for _ in range(n)]


def LIR(n): return [LI() for _ in range(n)]


def FR(n): return [IF() for _ in range(n)]


def LFR(n): return [LI() for _ in range(n)]


def LIR_(n): return [LI_() for _ in range(n)]


def SR(n): return [S() for _ in range(n)]


def LSR(n): return [LS() for _ in range(n)]


mod = 1000000007
inf = 1e10
#solve


def solve():
    n, m = LI()
    a = LI()
    a0 = a[0]
    bi = 0
    while not (a0 & 1):
        bi += 1
        a0 >>= 1
    if not bi:
        print(0)
        return
    for ai in a[1:]:
        tmp = 0
        while not (ai & 1):
            tmp += 1
            ai = ai >> 1
        if tmp == bi:
            continue
        print(0)
        return

    def lcm(a):
        from fractions import gcd
        x = a[0]
        for i in range(1, len(a)):
            x = (x * a[i]) // gcd(x, a[i])
        return x
    lc = lcm(list(map(lambda x: x >> 1, set(a))))
    print((m + lc) // lc // 2)
    return


#main
if __name__ == '__main__':
    solve()


Measured memory_bytes: 79328
import Data.List
import qualified Data.ByteString.Char8 as B

main = breads >>= print . sum . init . sort

breads :: IO [Int]
breads = unfoldr uff <$> B.getLine
    where
        uff b = check <$> B.readInt b
        check (a, b)
            | B.null b = (a, b)
            | otherwise = (a, B.tail b)


Measured memory_bytes: 380
#include "bits/stdc++.h"
using namespace std;
     
#define DEBUG(x) cout<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cout<<#v<<":";for(int i=0;i<v.size();i++) cout<<" "<<v[i]; cout<<endl
     
typedef long long ll;
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll, ll>
const int inf = 1000000001;
const ll INF = 1e16;
#define MOD 1000000007
#define mod 1000000009
#define pi 3.14159265358979323846
#define Sp(p) cout<<setprecision(15)<<fixed<<p<<endl;
int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 };
int dx2[8] = { 1,1,0,-1,-1,-1,0,1 }, dy2[8] = { 0,1,1,1,0,-1,-1,-1 };

int main () {
  string s;
  cin >> s;
  int i;
  char pre = 'p';
  int cnt = 0;
  for (i = 0; i < s.size(); i++) {
    if (pre != s[i]) {
      cnt++;
    }
    pre = s[i];
  }
  cout << cnt - 1 << endl;
}


Measured memory_bytes: 512
_fib = [None] * 45
_fib[0] = 1
_fib[1] = 1

def fib(n):
    if _fib[n] is None:
        _fib[n] = fib(n-1) + fib(n-2)
    return _fib[n]

_n = int(raw_input())
print(fib(_n))

Measured memory_bytes: 6372
#include<bits/stdc++.h>
#define god dimasi5eks
#pragma GCC optimize("O3")
#define fi first
#define se second
#define pb push_back
#define pf push_front
#define mod 1000000007
#define dancila 3.14159265359
#define eps 1e-9

// #define fisier 1

using namespace std;

typedef long long ll;


int add(int a, int b)
{
    int x = a+b;
    if(x >= mod)
        x -= mod;
    if(x < 0)
        x += mod;
    return x;
}
ll mul(ll a, ll b)
{
    return (a*b) % mod;
}

ll pw(ll a, ll b)
{
    ll ans = 1;
    while(b)
    {
        if(b & 1)
            ans = (ans * a) % mod;
        a = (a * a) % mod;
        b >>= 1;
    }
    return ans;
}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
long long rand_seed()
{
    long long a = rng();
    return a;
}

int n, v[200002], pi[200002], ans[200002];

bool cmp(int a, int b)
{
    return v[a] < v[b];
}
int main()
{

    #ifdef fisier
        ifstream f("input.in");
        ofstream g("output.out");
    #endif

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    cin >> n;
    for(int i = 1; i <= n; ++i)
        cin >> v[i], pi[i] = i;
    sort(pi + 1, pi + n + 1, cmp);
    for(int i = 1; i <= n; ++i)
        if(i <= n/2)
            ans[pi[i]] = v[pi[n/2+1]];
        else
            ans[pi[i]] = v[pi[n/2]];
    for(int i = 1; i <= n; ++i)
        cout << ans[i] << '\n';
    return 0;
}


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

//.define
// #define FILE_IN_OUT
#define RET(_x)                       return cout << (_x) << '\n', 0;
#define all(_obj)                     (_obj).begin(), (_obj).end()
#define loop(_n)                      for (int i = 0; i < (_n); ++i)
#define CeilDiv(_dividend, _divider)  (((_dividend) - 1LL + (_divider)) / (_divider))
#define sz(_obj)                      static_cast<int>((_obj).size())
#ifdef SHJ_LOCAL
#define debug(_x)                     std::cerr << (#_x) << " = " << (_x) << '\n' << std::flush;
#else
#define debug(_x)                     {}
#endif
#define endl "\n"
template<typename Tp>
inline void outarr(Tp _begin, Tp _end, const char* _delim = " ") {
    for (Tp current = _begin; current != _end; ++current) {
        std::cout << *current << _delim;
    }
    std::cout << '\n';
}

//.constant
using ll  = long long;
using pii = std::pair<int, int>;
constexpr int INF = 0x3f3f3f3f;
constexpr int MOD = static_cast<const int>(1e9 + 7);

//.data

//.code
int main() {
#ifdef FILE_IN_OUT
    std::ifstream cin ("input.txt",  std::ios::in);
    std::ofstream cout("output.txt", std::ios::out);
#else
    std::ios_base::sync_with_stdio(false);
    std::cin.tie(nullptr);
#endif

    int n;
    cin >> n;
    vector<int> cnt(100005, 0);
    ll sum = 0;
    loop(n) {
        int x;
        cin >> x;
        ++cnt[x];
        sum += x;
    }
    int q;
    cin >> q;
    while (q--) {
        int b, c;
        cin >> b >> c;
        sum -= 1LL * b * cnt[b];
        sum += 1LL * c * cnt[b];
        cnt[c] += cnt[b];
        cnt[b] = 0;
        cout << sum << endl;
    }

#ifdef FILE_IN_OUT
    cin.close();
    cout.close();
#endif
    return 0;
}

Measured memory_bytes: 3720
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);

		int A = scan.nextInt();
		int B = scan.nextInt();
		String a = String.valueOf(A);
		String b = String.valueOf(B);

		System.out.println(a.length()>=2 || b.length()>=2?-1:A*B);

		scan.close();

	}

}


Measured memory_bytes: 23252
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigInteger;
import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.Stream;

public class Main {
    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            br = new BufferedReader(new
                    InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

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

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }

    public static void main(String[] args) throws Exception {
        FastReader fr  = new FastReader();
        int n = fr.nextInt();
        long[] arr = new long[n];
        for (int i = 0; i < n; i++) {
            arr[i] = fr.nextInt();
        }
        long ans = 0;
        long maxTillNow = arr[0];
        for (int i = 1; i < n; i++) {
            if(arr[i]<maxTillNow){
                ans+=(maxTillNow-arr[i]);
            }
            else if(arr[i]>maxTillNow){
                maxTillNow = arr[i];
            }
        }
        System.out.println(ans);
    }
}


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

#define rep(i, m, n) for(int(i) = (int)(m); i < (int)(n); ++i)
#define rep2(i, m, n) for(int(i) = (int)(n)-1; i >= (int)(m); --i)
#define REP(i, n) rep(i, 0, n)
#define REP2(i, n) rep2(i, 0, n)
#define all(hoge) (hoge).begin(), (hoge).end()
#define en '\n'
using ll = long long;
using ull = unsigned long long;
template <class T>
using vec = vector<T>;
template <class T>
using vvec = vector<vec<T>>;
typedef pair<ll, ll> P;
using tp = tuple<ll, ll, ll>;
constexpr long long INF = 1LL << 60;
constexpr int INF_INT = 1 << 25;
constexpr long long MOD = (ll)1e9 + 7;
//constexpr long long MOD = 998244353LL;
using ld = long double;
static const ld pi = 3.141592653589793L;
typedef vector<ll> Array;
typedef vector<Array> Matrix;

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

//グラフ関連
struct Edge {
    ll to, cap, rev;
    Edge(ll _to, ll _cap, ll _rev) {
        to = _to;
        cap = _cap;
        rev = _rev;
    }
};
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;

void add_edge(Graph &G, ll from, ll to, ll cap, bool revFlag, ll revCap) {
    G[from].push_back(Edge(to, cap, (ll)G[to].size()));
    if(revFlag)
        G[to].push_back(Edge(from, revCap, (ll)G[from].size() - 1));
}

void solve() {
    ll n;
    cin >> n;
    vec<ll> a(n);

    vec<ll> con(1010101, 0);
    REP(i, n) {
        cin >> a[i];
        con[a[i]]++;
    }

    vec<int> arr(1010101, 1);
    ll m = 1000000;
    bool flag = false;
    bool flag2 = false;
    for(ll i = 2; i * 2 <= m; i++) {
        if(arr[i]) {
            ll tmp = con[i];
            for(ll j = 2; i * j <= m; j++) {
                arr[i * j] = 0;
                tmp += con[i * j];
            }
            if(tmp >= 2)
                flag = true;
            if(tmp == n)
                flag2 = true;
        }
    }
    if(flag2) {
        cout << "not coprime" << en;
    } else if(flag) {
        cout << "setwise coprime" << en;
    } else {
        cout << "pairwise coprime" << en;
    }
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    /*
    ll t;
    cin >> t;
    while(t--)*/
    solve();

    return 0;
}


Measured memory_bytes: 22992
#include<stdio.h>
#define MMAX 20
#define NMAX 50000
#define INF 1<<30

 int C[MMAX],T[NMAX];

 int main(){
         int n,m,i,j;
         scanf("%d%d",&n,&m);

         for(i=1;i<=m;i++){
                   scanf("%d",&C[i]);
                   }

         for(i=0;i<=NMAX;i++){T[i]=INF;}
         T[0]=0;
         for(i=1;i<=m;i++){
                       for(j=0;j+C[i]<=n;j++){
                                     T[j+C[i]]=T[j+C[i]]<T[j]+1?T[j+C[i]]:T[j]+1;
                                     }
                       }
         printf("%d\n",T[n]);
         return 0;
         }


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

int main() {


  int n,q;

  cin >> n >> q;

  int y;
  string ans= "kogakubu10gokan",name;
  int flg = 0;
  for(int i=0;i<n;i++){
    cin >> y >> name;
    if(flg == 1)continue;
    if(y <=q) ans = name;
    else flg = 1;
  }

  cout << ans << endl;

  return 0;

}

Measured memory_bytes: 1204
#include <cstdio>
#include <vector>

inline int read(){
	char c=getchar(); int x=0,ft=1;
	for(;c<'0'||c>'9';c=getchar()) if(c=='-') ft=-1;
	for(;c>='0'&&c<='9';c=getchar()) x=x*10+c-'0';
	return x*ft;
}

int n,val[3005],f[3005]; std::vector<int> g[3005];

inline void add_edge(int u,int v){
	g[u].push_back(v); g[v].push_back(u);
}

void dfs(int u,int pre){
	f[u]=false;
	for(auto v: g[u]) if(v!=pre&&val[v]<val[u]){
		dfs(v,u); if(!f[v]){ f[u]=true; return; }
	}
}

int main(){
	n=read(); for(int i=1;i<=n;++i) val[i]=read();
	for(int i=1;i<=n-1;++i) add_edge(read(),read());
	for(int i=1;i<=n;++i){ dfs(i,0); if(f[i]) printf("%d ",i); }
	return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <numeric>
#include <string>
#include <algorithm>
#include <vector>
using namespace std;

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

	long long v[3] = {0,0,0};
	long long extra = 0;
	for (int i = 0; i < n; ++i) {
		if (s[i] == 'R') {
			++v[0];
		}
		else if (s[i] == 'G') {
			++v[1];
		}
		else {
			++v[2];
		}

		int j = 1;
		while (i+j+j < n) {
			if (s[i] != s[i + j] && s[i + j] != s[i + j + j] && s[i] != s[i + j + j]) {
				++extra;
			}
			++j;
		}
	}

	cout << v[0] * v[1] * v[2] - extra << endl;

	return 0;
}

Measured memory_bytes: 3632
import java.util.*;
public class Main {
	
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        
        boolean[] map = new boolean[101];
        for (int i = 0; i < 3; i++) {
        	map[sc.nextInt()] = true;
        }
        
        int ans = 0;
        for (boolean b : map) {
        	ans +=b?1:0;
        }
        
        System.out.println(ans);
    }
}

Measured memory_bytes: 22996
def main():
    _ = int(input())
    A = list(map(int, input().split()))
    b1 = 0
    b2 = 0
    b4 = 0
    for a in A:
        if a % 2 == 0:
            if a % 4 == 0:
                b4 += 1
            else:
                b2 += 1
        else:
            b1 += 1
    if b2 > 0:
        if b4 >= b1:
            print('Yes')
            return
    else:
        if b4 + 1 >= b1:
            print('Yes')
            return
    print('No')


main()


Measured memory_bytes: 14252
def drop?(s,q,pos)
  n=s.size
  q.each{|t,d|
    next unless t==s[pos]
    pos+=d
    if pos<0
      return -1
    elsif pos==n
      return 1
    end
  }
  0
end

n,q=gets.split.map(&:to_i)
s=gets.chomp.chars.map(&:to_sym)
query=q.times.map{
  t,d=gets.split
  sym=t.to_sym
  dir=d==?L ? -1 : 1
  [sym,dir]
}

l_most=-1
l,r=0,n-1
until l>r
  m=(l+r)/2
  if drop?(s,query,m)==-1
    l_most=m
    l=m+1
  else
    r=m-1
  end
end
r_most=n
l,r=0,n-1
until l>r
  m=(l+r)/2
  if drop?(s,query,m)==1
    r_most=m
    r=m-1
  else
    l=m+1
  end
end

puts r_most-l_most-1

Measured memory_bytes: 31636
import sys, math
from functools import lru_cache
from collections import deque
sys.setrecursionlimit(500000)
MOD = 10**9+7

def input():
    return sys.stdin.readline()[:-1]

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

def ii():
    return int(input())

def i2(n):
    tmp = [list(mi()) for i in range(n)]
    return [list(i) for i in zip(*tmp)]

def main():
    K = ii()
    if K%2==0 or K%5==0:
        print(-1)
        return
    a = 7
    cnt = 1
    while a%K != 0:
        a = (10*a+7)%K
        cnt += 1
    print(cnt)

if __name__ == '__main__':
    main()

Measured memory_bytes: 9416
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
    ll i,a=0,b=0,n;
    cin>>n;
    string str;
    cin>>str;
    for(i=0;i<str.length();i++){
        if(str[i]=='R')
            a+=1;
        else
            b+=1;
    }
    if(a>b)
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;
	return 0;
}


Measured memory_bytes: 256
n = gets.to_i
sp = n.times.map{gets.chomp.split}
n.times do |i|
  sp[i] << i
end

sp.sort_by! {|a,b,c| [a,b.to_i]}

prev = sp[0][0]
ans = []
cnt = []
sp.each do |s|
  if s[0]!=prev
    ans += cnt.reverse!
    cnt = [s[2]]
    prev = s[0]
  else
    cnt << s[2]
  end
end

# cnt << sp[-1][2]
ans+=cnt.reverse!

ans.each do |a|
  puts a+1
end

Measured memory_bytes: 1788
// 2015/03/25 Tazoe

#include <iostream>
using namespace std;

void DFS(int F[102][102], int y, int x, int C)
{
	if(F[y][x]!=C)
		return;

	F[y][x] = 6;

	DFS(F, y-1, x, C);
	DFS(F, y, x+1, C);
	DFS(F, y+1, x, C);
	DFS(F, y, x-1, C);
}

int main()
{
	while(true){
		int w, h;
		cin >> w >> h;

		if(w==0 && h==0)
			break;

		int xs, ys;
		cin >> xs >> ys;

		int xg, yg;
		cin >> xg >> yg;

		int n;
		cin >> n;

		int F[102][102] = {};

		for(int i=0; i<n; i++){
			int c, d, x, y;
			cin >> c >> d >> x >> y;

			F[y][x] = F[y][x+1] = F[y+1][x] = F[y+1][x+1] = c;

			if(d==0){
				F[y][x+2] = F[y][x+3] = F[y+1][x+2] = F[y+1][x+3] = c;
			}
			else{
				F[y+2][x] = F[y+2][x+1] = F[y+3][x] = F[y+3][x+1] = c;
			}
		}

//		for(int y=0; y<=h; y++){
//			for(int x=0; x<=w; x++){
//				cout << F[y][x];
//			}
//			cout << endl;
//		}

		if(F[ys][xs]==0){
			cout << "NG" << endl;
			continue;
		}

		DFS(F, ys, xs, F[ys][xs]);

		if(F[yg][xg]==6){
			cout << "OK" << endl;
		}
		else{
			cout << "NG" << endl;
		}
	}

	return 0;
}

Measured memory_bytes: 1200
s = int(input())
c = [0]*1000000

if s != 1:
    m = 1
    while True:
        c[s] = 1
        if s % 2 == 0:
            s = s//2
        else:
            s = 3*s + 1
        m += 1
        if c[s] == 1:
            break
else:
    m = 4

print(m)

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

int main() {
    int n, w;
    cin >> n >> w;
    vector<vector<int>> v(4, vector<int>());
    int w1, v1;
    cin >> w1 >> v1;
    v.at(0).push_back(v1);
    for (int i = 0; i < n - 1; i++) {
        int wi, vi;
        cin >> wi >> vi;
        v.at(wi - w1).push_back(vi);
    }
    
    for (int i = 0; i < 4; i++) {
        sort(v.at(i).begin(), v.at(i).end());
        reverse(v.at(i).begin(), v.at(i).end());
    }

    vector<vector<long long>> sum(4, vector<long long>(110, 0));
    for (int i = 0; i < 4; i++) {
        for (int j = 0; j < (int)v.at(i).size(); j++) {
            sum.at(i).at(j + 1) = sum.at(i).at(j) + v.at(i).at(j);
        }
    }

    long long ans = 0;
    for (int i = 0; i <= (int)v.at(0).size(); i++) {
        if (w1 * i > w) break;
        for (int j = 0; j <= (int)v.at(1).size(); j++) {
            if (w1 * i + (w1 + 1) * j > w) break;
            for (int k = 0; k <= (int)v.at(2).size(); k++) {
                if (w1 * i + (w1 + 1) * j + (w1 + 2) * k > w) break;
                for (int l = 0; l <= (int)v.at(3).size(); l++) {
                    if (w1 * i + (w1 + 1) * j + (w1 + 2) * k + (w1 + 3) * l > w) break;

                    ans = max(ans, sum.at(0).at(i) + sum.at(1).at(j) + sum.at(2).at(k) + sum.at(3).at(l));
                }
            }
        }
    }

    cout << ans << endl;
}   

Measured memory_bytes: 256
N = int(input())
X = [[0]*10 for _ in range(10)]
for n in range(1, N+1):
    s = str(n)
    a = int(s[0])
    b = int(s[-1])
    X[a][b] += 1

ans = 0
for a in range(1,10):
    for b in range(1,10):
        ans += X[a][b]*X[b][a]
print(ans)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,r;
    cin>>n>>r;
    if(n>=10){
	  cout<<r;
	  return 0;
    }
    int sc=100*(10-n);
    int ans=r+sc;
    cout<<ans;
    return 0; 
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector> 
#include <cstring>
#include <queue>
#include <stack>
#include <ctime>
#include <set>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,int> pli;
typedef pair<int,ll> pil;

const int maxN = 510;
int a[maxN];
int n;
int main()
{
	scanf("%d",&n);
	if(n==0)
	{
		puts("0");
	}
	ll cnt = 1;
	for(int i=0;i<=60;i++)
	{
		if((n>>i) & 1)
		{
			a[i] = 1;
			n -= cnt;
		}
		cnt *= -2;
	}
	for(int i=60;i>=0;i--)
	{
		if(a[i] == 1)
		{
			for(int j=i;j>=0;j--)
			{
				printf("%d",a[j]);
			}
			cout<<endl;
			break;
		}
	}
	return 0;
}

Measured memory_bytes: 256
import sys

n = int(input())
nums = [int(input()) for i in range(n)]
maxnum = - sys.maxsize
prevmax = nums[n - 1]

for i in reversed(range(n - 1)):
    dif = prevmax - nums[i]

    if dif > maxnum:
        maxnum = dif

    prevmax = max(nums[i], prevmax)

print(maxnum)


Measured memory_bytes: 13600
use std::io::*;
         
fn main() {
        	
     let mut nk = String::new();
     let mut s = String::new();
         
     stdin().read_line(&mut nk).unwrap();
     stdin().read_line(&mut s).unwrap();
         
     let k: usize = nk.trim().split_whitespace().collect::<Vec<_>>()[1].parse::<usize>().unwrap();
         
     let mut s = s.trim().chars().collect::<Vec<char>>();
     s[k - 1] = (s[k-1] as u8 + 32) as char;
     
     println!("{}", s.into_iter().collect::<String>());
}
         

Measured memory_bytes: 4352
s1 = input()
s2 = input()
N = len(s1)
s1l = []
s2l = []
ans = True
f = False
for i in range(N):
  f = True
  for s in range(len(s1l)):
    if s1[i] == s1l[s]:
      if s2[i] != s2l[s]:
        ans = False
      f = False
      break
    elif s2[i] == s2l[s]:
      ans = False
  if f:
    s1l.append(s1[i])
    s2l.append(s2[i])
if ans:
  print("Yes")
else:
  print("No")

Measured memory_bytes: 3632
// 0:55
#include <iostream>
#include <cstring>
#include <cmath>
#include <string>
#include <algorithm>
#include <utility>
#include <vector>
#include <set>
#include <map>
#include <deque>
#include <tuple>
using namespace std;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vll>;
using pll = pair<ll,ll>;
using tll = tuple<ll,ll,ll>;
#define pb push_back
#define for1(i,n) for (ll i=0;i<(n);(i)++)
#define for2(i,m,n) for (ll i=(m);(i)<(n);(i)++)
#define for3(i,m,n,d) for (ll i=(m);(i)<(n);(i)+=(d))
#define INF (1LL << 60)
#define DEBUG 0
#if DEBUG
    #define dump(v1) dump_1(#v1, v1)
    #define dump2(v1,v2) dump_2(#v1, v1, #v2, v2)
    #define dump3(v1,v2,v3) dump_3(#v1, v1, #v2, v2, #v3, v3)
#else
    #define dump(v1)
    #define dump2(v1,v2)
    #define dump3(v1,v2,v3)
#endif
#if DEBUG
template <typename T>
void dump_1(const string& n1, const T& v1)
{
    cerr << n1 << ": " << v1 << endl;
}
template <typename T1, typename T2>
void dump_2(const string& n1, const T1& v1, const string& n2, const T2& v2)
{
    cerr << n1 << ": " << v1 << "  " << n2 << ": " << v2 << endl;
}
template <typename T1, typename T2, typename T3>
void dump_3(const string& n1, const T1& v1, const string& n2, const T2& v2, const string& n3, const T3& v3)
{
    cerr << n1 << ": " << v1 << "  " << n2 << ": " << v2 << "  " << n3 << ": " << v3 << endl;
}
template <typename T1,typename T2>
ostream& operator << (ostream& os, const pair<T1,T2>& v)
{
    os << "(" << v.first << ", " << v.second << ")";
    return os;
}
template <typename T1,typename T2, typename T3>
ostream& operator << (ostream& os, const tuple<T1,T2,T3>& v)
{
    os << "(" << get<0>(v) << ", " << get<1>(v) << ", " << get<2>(v) << ")";
    return os;
}
template <typename T>
ostream& operator << (ostream& os, const vector<T>& v)
{
    os << "[";
    for (auto it = v.begin(); it != v.end(); it++) {
        if (it != v.begin()) {
            os << ", ";
        }
        os << *it;
    }
    os << "]";
    return os;
}
template <typename T>
ostream& operator << (ostream& os, const set<T>& v)
{
    os << "{";
    for (auto it = v.begin(); it != v.end(); it++) {
        if (it != v.begin()) {
            os << ", ";
        }
        os << *it;
    }
    os << "}";
    return os;
}
template <typename T1, typename T2>
ostream& operator << (ostream& os, const map<T1,T2>& v)
{
    os << "{";
    for (auto it = v.begin(); it != v.end(); it++) {
        if (it != v.begin()) {
            os << ", ";
        }
        os << it->first << ":" << it->second;
    }
    os << "}";
    return os;
}
#endif // DEBUG
template <typename T>
void print(const T& v)
{
    cout << v << endl;
}
//---------------------------------------------------------

void solve()
{
    ll a,b,h;
    cin >> a >> b >> h;
    print((a+b)*h/2);
}

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


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

using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;


#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))

int dx4[4] = {1,0,-1,0}, dy4[4] = {0,1,0,-1};


int main()
{
    std::cout << std::fixed;
    std::cout << std::setprecision(8);
    double a,b,x;
    cin>>a>>b>>x;
    if(a*a*b<=x*2)
    {
        double v = a*a*b-x;
        double tan = v*2/a/a/a;
        double theta = atan(tan);
        cout<<theta*180/M_PI<<endl;
    }
    else
    {
        double tan=a*b*b/2/x;
        double theta = atan(tan);
        cout<<theta*180/M_PI<<endl;
    }
        
    return 0;
}

Measured memory_bytes: 256