akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define REP(i,m,n) for(int i=(m);i<(n);i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define all(a) a.begin(),a.end()
#define rall(c) (c).rbegin(),(c).rend()
#define mp make_pair
#define endl '\n'
#define vec vector<ll>
#define mat vector<vector<ll> >
#define fi first
#define se second
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> pll;
typedef long double ld;
typedef complex<double> comp;
const ll inf=1e9+7;
const ll mod=1e9+7;
const int MAX=300010;

ll rui(ll a,ll b){
    ll res=1;
    ll x=a;
    while(b){
        if(b&1)res=res*x%mod;
        b/=2;
        x=x*x%mod;
    }
    return res;
}
signed main(){
    ll n;cin>>n;
    ll sum=0;
    vector<ll>a(n);
    rep(i,n){
        cin>>a[i];
        sum=(sum+a[i])%mod;
    }
    ll ans=0;
    rep(i,n){
        ans=(ans+(sum-a[i])%mod*a[i]%mod)%mod;
    }
    ans=ans*rui(2,mod-2)%mod;
    if(ans<0)ans+=mod;
    cout<<ans<<endl;
}

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

using namespace std;

using ll = long long;

template<typename T> using V = std::vector<T>;
using Vi = V<int>;
using VVi = V<V<int>>;
using Vl = V<ll>;
using VVl = V<V<ll>>;
using Vs = V<string>;

template<typename T1, typename T2> using P = std::pair<T1, T2>;
using Pii = P<int, int>;
using Pll = P<ll, ll>;
using Pdd = P<double, double>;

template<typename T1, typename T2> using M = std::map<T1, T2>;
using Mii = M<int, int>;
using Msi = M<string, int>;

#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define REP2(i,s,e) for(int i=(int)(s);i<(int)(e);++i)
#define RREP(i,s,e) for(int i=(int)(s);i>=(int)(e);--i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin(),ie=(c).end();i!=ie;++i)
#define ALL(c) (c).begin(), (c).end()

const double PI = acos(-1);
const ll MOD = 1e9+7;

int n, m, x, y, z, k;
string s;

struct Pos {
    int x, y, z;
};
using LP = P<ll, Pos>;

int main() {
    cin >> x >> y >> z >> k;

    Vl vx(x), vy(y), vz(z);
    REP(i, x) cin >> vx[i];
    REP(i, y) cin >> vy[i];
    REP(i, z) cin >> vz[i];
    sort(ALL(vx), greater<ll>());
    sort(ALL(vy), greater<ll>());
    sort(ALL(vz), greater<ll>());

    auto cmp = [](const LP& a, const LP& b){
        return a.first < b.first;
    };
    priority_queue<LP, V<LP>, decltype(cmp)> q(cmp);
    q.push({vx[0] + vy[0] + vz[0], {0, 0, 0}});
    auto cmp2 = [](const Pos& a, const Pos& b){
        return a.x + a.y*1001 + a.z*1001*1001 < b.x + b.y*1001 + b.z*1001*1001;
    };
    set<Pos, decltype(cmp2)> s(cmp2);
    int cnt = 0;
    while (!q.empty()) {
      	if (s.count(q.top().second) != 0) {
            q.pop();
            continue;
        }
        ll val = q.top().first;
        std::cout << val << '\n';
        cnt++;
        if (cnt == k) break;
        int a = q.top().second.x, b = q.top().second.y, c = q.top().second.z;
        s.insert(q.top().second);
        q.pop();
        if (a+1 < x) q.push({vx[a+1] + vy[b] + vz[c], {a+1, b, c}});
        if (b+1 < y) q.push({vx[a] + vy[b+1] + vz[c], {a, b+1, c}});
        if (c+1 < z) q.push({vx[a] + vy[b] + vz[c+1], {a, b, c+1}});
    }

    return 0;
}


Measured memory_bytes: 640
using System;
using System.IO;
using System.Text;
using static Scanner;
using static System.Math;

class Program
{
    static void Main(string[] args) {
        var writer = new StreamWriter(Console.OpenStandardOutput()) {AutoFlush = false};
        Console.SetOut(writer);
        Solve();
        Console.Out.Flush();
    }
    static void Solve() {
        var S = Scan().AsSpan();
        long answer = 0;
        while (S.IndexOf("><") != -1) {
            var str = S[..(S.IndexOf("><") + 1)].ToString();
            answer += Calc(str);
            S = S[(S.IndexOf("><") + 1)..];
        }
        answer += Calc(S.ToString());
        Console.WriteLine(answer);

        static long Calc(string str) {
            long lt = str.Length - str.Replace("<", "").Length;
            long gt = str.Length - str.Replace(">", "").Length;
            var max = Max(lt, gt);
            return max + lt * (lt - 1) / 2 + gt * (gt - 1) / 2;
        }
    }
}

public static class Scanner
{
    static readonly Stream stdin = Console.OpenStandardInput();
    static readonly byte[] buffer = new byte[1024];
    static int length, p;
    static bool isEof;
    private static byte StdIn() {
        if (isEof) return 0;
        if (p < length) return buffer[p++];
        p = 0;
        if ((length = stdin.Read(buffer, 0, 1024)) > 0) return buffer[p++];
        isEof = true;
        return 0;
    }
    public static char GetChar() {
        var by = StdIn();
        while ((by < '!' || '~' < by) && !isEof) by = StdIn();
        return (char) by;
    }
    public static string Scan() {
        var sb = new StringBuilder();
        for (var ch = GetChar(); '!' <= ch && ch <= '~'; ch = (char) StdIn()) {
            sb.Append(ch);
        }
        return sb.ToString();
    }
}

Measured memory_bytes: 36988
using System;

class ABC_139_C
{
    static void Main(string[] args)
    {
        int N = int.Parse(Console.ReadLine());
        string[] input = Console.ReadLine().Split(' ');
        int[] H = new int[N];
        for (int i = 0; i < N; i++)
        {
            H[i] = int.Parse(input[i]);
        }

        int maxCount=0;
        int count = 0;
        int height = H[N-1];
        for (int i = N-2; i >= 0; i--)
        {
            if(H[i]>=height)
            {
                height = H[i];
                count++;
                maxCount = Math.Max(maxCount, count);
            }
            else
            {
                height = H[i];
                count=0;
                maxCount = Math.Max(maxCount, count);
            }
        }

        Console.WriteLine(maxCount);
    }
}


Measured memory_bytes: 29020
import java.util.*;
import static java.lang.Math.*;
import static java.lang.System.out;

public class Main {
	Scanner sc = new Scanner(System.in);
	public static void main(String[] args) {
		new Main().AOJ0197();
	}
	
	int c197=0;
	void AOJ0197(){	// Greatest Common Divisor: Euclidean Algorithm
		while(sc.hasNext()){
			int x=sc.nextInt(), y=sc.nextInt();
			if(x<2)	break;
			c197=0;
			out.println(gcd(max(x,y), min(x,y))+" "+c197);
		}
	}
	int gcd(int x, int y){
		if(y==0)	return x;
		c197++;
		return gcd(y, x%y);
	}
	
	void AOJ0001(){	// List of Top 3 Hills
		int[] m = new int[10];
		for(int i=0; i<10; i++)	m[i]=sc.nextInt();
		Arrays.sort(m);
		for(int i=9; i>=7; i--)	out.println(m[i]);
	}
	
	void AOJ10029(){	// Sort II
		int n=sc.nextInt();
		int[] ans = new int[n];
		for(int i=0; i<n; i++)	ans[i]=sc.nextInt();
		Arrays.sort(ans);
		out.print(ans[0]);
		for(int i=1; i<n; i++)	out.print(" "+ans[i]);
		out.println();
	}
	
	int[][] p26 = new int[10][10];
	int c26=100;
	void AOJ0026(){	// Dropping Ink
		int ans=0;
		while(sc.hasNext()){
			Scanner sc2 = new Scanner(sc.nextLine()).useDelimiter(",");
			int x=sc2.nextInt(), y=sc2.nextInt(), s=sc2.nextInt();
			// out.println("x"+x+" y"+y+" s"+s);
			ans=max(solve26(x,y),ans);
			ans=max(solve26(x-1,y),ans);	ans=max(solve26(x+1,y),ans);
			ans=max(solve26(x,y-1),ans);	ans=max(solve26(x,y+1),ans);
			if(s>=2){
				ans=max(solve26(x-1,y-1),ans);	ans=max(solve26(x-1,y+1),ans);
				ans=max(solve26(x+1,y-1),ans);	ans=max(solve26(x+1,y+1),ans);
			}
			if(s>=3){
				ans=max(solve26(x-2,y),ans);	ans=max(solve26(x+2,y),ans);
				ans=max(solve26(x,y-2),ans);	ans=max(solve26(x,y+2),ans);
			}
		}
		out.println(c26);
		out.println(ans);
	}
	int solve26(int x, int y){
		int r=-1;
		if(0<=x && x<=9 && 0<=y && y<=9){
			c26 -= p26[x][y]==0? 1: 0;
			p26[x][y]++;
			r=p26[x][y];
		}
		return r;	// RA
	}
	
	void AOJ0008(){	//Sum of 4 Integers
		while(sc.hasNext()){
			int ans=0, n=sc.nextInt();
			for(int a=0; a<10; a++){
				for(int b=0; b<10; b++){
					for(int c=0; c<10; c++){
						for(int d=0; d<10; d++)		if((a+b+c+d)==n)	ans++;
					}
				}
			}
			out.println(ans);
		}
	}
	
	void AOJ0055(){	// Sequence
		while(sc.hasNext()){
			double last=sc.nextDouble(), ans=last;
			for(int i=2; i<=10; i++){
				ans+= i%2==0? last*2: last/3;
				last = i%2==0? last*2: last/3;
				// out.println(last);
			}
			out.println(ans);
		}
	}
}

Measured memory_bytes: 13000
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define fastio() ios_base::sync_with_stdio(false);
#define rmod(x, y) ((((x)%(y))+(y))%(y))
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef long double ld;
template<typename T, typename R = null_type, typename C = less<T>>
tree<T, R, C, rb_tree_tag, tree_order_statistics_node_update> ordered_set(){
	return tree<T, R, C, rb_tree_tag, tree_order_statistics_node_update>();
}

const int maxn = 15, maxs = 1e5+2e4, inf = 1e9+7;

int n, S, a[maxn], b[maxn], dp[maxn][maxs];

int main(){
	scanf("%d %d", &n, &S); S/=100;
	for(int i = 1; i<=n; i++) scanf("%d %d", &a[i], &b[i]), b[i]/=100;
	for(int i = 0; i<=n; i++) fill(dp[i], dp[i]+maxs, inf);
	dp[0][0] = 0;
	int ans = 1e9;
	for(int i = 1; i<=n; i++){
		for(int s = 0; s<maxs; s++){
			for(int c = 0; c<a[i] && c*i<=s; c++)
				dp[i][s] = min(dp[i][s], dp[i-1][s-(c*i)]+c);
			if ((i*a[i])+b[i]<=s) dp[i][s] = min(dp[i][s], dp[i-1][s-(i*a[i])-b[i]] + a[i]);
			if (s>=S) ans = min(ans, dp[i][s]);
		}
	}
	printf("%d\n", ans);
	return 0;
}


Measured memory_bytes: 6400
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <cassert>
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
typedef vector<int> VI;
typedef long long ll;
typedef pair<int,int> PII;
const ll mod=1000000007;
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
// head
 
const int N=101000;
int n,m,u,v,vis[N];
VI e[N],ret;
void dfs(int u) {
	ret.pb(u); vis[u]=1;
	for (auto v:e[u]) if (!vis[v]) {
		dfs(v);
		break;
	}
}
int main() {
	scanf("%d%d",&n,&m);
	rep(i,0,m) {
		scanf("%d%d",&u,&v);
		e[u].pb(v); e[v].pb(u);
	}
	vis[v]=1;
	dfs(u);
	reverse(all(ret));
	vis[v]=0;
	dfs(v);
	printf("%d\n",SZ(ret));
	for (auto p:ret) printf("%d ",p);
}

Measured memory_bytes: 9720
#include<iostream>
#include <iomanip>
#include <ios>
#include <vector>
#include <string>
#include <algorithm>
#include <string>
#include<limits>
#include<cstdlib>
#include<functional>
#include<cassert>
#include <cstdio>
#include <stack>
#include <queue>
#include <map>
#define fi(p) for(int i=0;i<(p);i++)
#define ce(d) cout<<d<<endl;

using namespace std;
int N;
int L;
int P;
const int MAX_N = 100000;
const int MAX_W = 100000;


int A[MAX_N+1];
int B[MAX_N+1];

void solve() {

	int N;
	cin >> N ;
	
	bool res = false;

	for (int i = 0; i <= N / 7; i++) {
		int sum = N - 7 * i;
		if (sum % 4 == 0) {
			res++;
			break;
		}
	}
	if (res == true) {
		ce("Yes");
	}
	else {
		ce("No");
	}




	
}

int main()
{
	solve();

	int a;//止める用
	cin >> a;
	return 0;
}

Measured memory_bytes: 256
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif


using namespace std;
using ll = long long;

const ll MOD = 1000000007;
const ll INF = 1e18;
const double pi = acos(-1);
const int dx4[4] = {1, 0, -1, 0};
const int dy4[4] = {0, 1, 0, -1};
const int dx8[8] = {1,1,0,-1,-1,-1,0,1};
const int dy8[8] = {0,1,1,1,0,-1,-1,-1};


#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()


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





void solve(){
    
    // remove the bottom 3 lines when you submit this code.
    std::ifstream in("sample.txt");
    std::cin.rdbuf(in.rdbuf());

    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int n,q; cin >> n >> q;
    string s; cin >> s;
    vector<int> vecAC(100010);
    int countAC = 0;
    for (int i = 1; i < s.length(); i++) {
        if(s[i-1]=='A' && s[i]=='C') countAC++;
        vecAC[i] = countAC;
    }
    
    for (int i = 0; i < q; i++) {
        int l,r; cin >> l >> r;
        cout << vecAC[r-1] - vecAC[l-1] << endl;
    }
    
    
    
}



signed main() {
    solve();
    return 0;
}



Measured memory_bytes: 1488
#include<stdio.h>
#pragma GCC optimize("O2")
#pragma GCC optimize("O3")
#pragma GCC target("avx")
#define rep(i,N) for(int i=0;i<(int)N;i++)
const int MOD=1e9+7,MAX=1e6;
static inline int IN(void)
{
  int x=0,f=0,c=getchar();while(c<48||c>57){f^=c==45,c=getchar();}
  while(c>47&&c<58){x=x*10+c-48,c=getchar();}return f?-x:x;
}
typedef struct{int SPF[1000001];int Primes[1000001];int count[1000001];int sz;}Template;
struct T{int fact[1000001],inv[1000001];};
Template P;struct T MODINV;
static inline int MPow(int a,int b){return b?1l*MPow(1l*a*a%MOD,b>>1)*(b&1?a:1)%MOD:1;}
static inline void ready(void)
{
  *P.SPF=1,*P.Primes=2,*P.count=0,P.sz=1;
  rep(i,MAX/2)P.SPF[2*(i+1)]=2,P.SPF[2*(i+1)-1]=2*(i+1)-1;
  rep(i,MAX/2-1)
  {
    int x=2*(i+1)+1;if(P.SPF[x]==x)P.Primes[P.sz++]=x;
    rep(j,P.sz)
    {
      if(P.Primes[j]<=P.SPF[x]&&x*P.Primes[j]<=MAX)P.SPF[x*P.Primes[j]]=P.Primes[j];
      else break;
    }
  }
  rep(i,P.sz/2)P.count[P.Primes[2*i]]=P.count[P.Primes[2*i+1]]=0;
}
static inline void init(void)
{
  MODINV.fact[0]=1;rep(i,MAX)MODINV.fact[i+1]=1l*MODINV.fact[i]*(i+1)%MOD;
  MODINV.inv[MAX]=MPow(MODINV.fact[MAX],MOD-2);
  rep(i,MAX)MODINV.inv[MAX-1-i]=1l*MODINV.inv[MAX-i]*(MAX-i)%MOD;
}
static inline void Radix32(int *a,const int sz)
{
  int x,shift=0,elem[256],temp[sz];
  while(shift<32)
  {
    int bucket[256]={0};
    rep(i,sz){x=(a[i]>>shift)&255;bucket[x]++;temp[i]=a[i];}
    elem[0]=0;rep(i,255)elem[i+1]=elem[i]+bucket[i];
    rep(i,sz){x=(temp[i]>>shift)&255;a[elem[x]]=temp[i];elem[x]++;}
    shift+=8;
  }
}
int main(void)
{
  int N=IN(),A=0,invsum=0,k=0,lcm=1,x=0,temp[10000],box[168]={};ready();init();
  rep(i,N)
  {
    A=IN();invsum=(invsum+1l*MODINV.fact[A-1]*MODINV.inv[A]%MOD)%MOD;
    rep(j,168){x=0;while(A%P.Primes[j]==0){A/=P.Primes[j];if(box[j]<++x)box[j]=x;}}
    if(A!=1){temp[k++]=A;}
  }
  Radix32(temp,k);
  rep(i,168){rep(j,box[i]){lcm=1l*lcm*P.Primes[i]%MOD;}}
  x=-1;rep(i,k){if(x!=temp[i]){lcm=1l*lcm*temp[i]%MOD;x=temp[i];}}
  x=1l*lcm*invsum%MOD;return printf("%d\n",x),0;
}

Measured memory_bytes: 17556
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define vi vector<int>
#define ff first
#define ss second
#define file_se_input  freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
#define pp long long int
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define pb push_back
#define mp make_pair
#define pi 3.141592653589793238
#define eb emplace_back
#define rep(i,a,b) for (int i = a; i <= b; i++)
#define zip(i,a,b) for(int i=a;i<b;i++)
#define rzip(i,a,b) for(int i=a;i>=b;i--)
#define ll unsigned long long int
#define test int t;cin>>t; while(t--)
#define um unordered_map
#define en '\n'
#define us unordered_set
typedef pair<int, int>     pii;
typedef pair<char, int>    pci;
typedef pair<char, char>   pcc;
typedef vector<pii>       vii;
typedef long double ld;
#define all(v) v.begin(), v.end()
#define INF (1e18+5)
#define inf (1e9+5)
#define mod 1000000007


bool check_prime(long long n)
{
	int flag = 0;
	for (long long i = 2; i * i <= n; i++)
	{
		if (n % i == 0)
		{
			flag = 1;
			break;
		}
	}
	if (n == 1)
		return false;
	else if (flag == 0 || n == 2 || n == 3)
	{
		return true;
	}
	else
	{
		return false;
	}

}

int BE(int x, int n, int m) //function to calculate x raise to power n modulo m
{
	int result = 1;
	while (n > 0)
	{
		if (n % 2 == 1)
			result = result * x % m;
		x = x * x % m;
		n = n / 2;
	}
	return result;
}

int32_t main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(0);
#ifndef ONLINE_JUDGE
	if (fopen("input.txt", "r"))
	{
		freopen ("input.txt" , "r" , stdin);
		freopen ("output.txt" , "w" , stdout);
	}
#endif
	//_______________________________-code starts-_______________________________________________
	int n;
	cin >> n;
	int a[n]; zip(i, 0, n) cin >> a[i];
	int b[n]; zip(i, 0, n) b[i] = a[i];
	zip(i, 1, n)
	{
		a[i] = a[i - 1] ^ a[i];
	}
	int x = a[n - 1];
	zip(i, 0, n)
	{
		int var = b[i] ^ x;
		cout << var << " ";
	}
	cout << endl;


	return 0;
}



Measured memory_bytes: 6636
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String[] s = sc.next().split("");
        String[] t = sc.next().split("");

        int[][] dp = new int[s.length + 1][t.length + 1];
        dp[0][0] = 0;
        for (int i = 0; i < s.length; i++) {
            for (int j = 0; j < t.length; j++) {
                if (s[i].equals(t[j])) {
                    dp[i + 1][j + 1] = dp[i][j] + 1;
                } else {
                    dp[i + 1][j + 1] = Math.max(dp[i + 1][j], dp[i][j + 1]);
                }
            }
        }

        int i = s.length;
        int j = t.length;
        String res = "";
        while (i > 0 && j > 0) {
            if (dp[i][j] == dp[i - 1][j]) {
                i--;
            } else if (dp[i][j] == dp[i][j - 1]) {
                j--;
            } else {
                res = s[i - 1] + res;
                i--;
                j--;
            }
        }
        System.out.println(res);
    }
}

Measured memory_bytes: 86032
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
    double a,b,x;
    scanf("%lf%lf%lf",&a,&b,&x);
    if(x<=a*a*b/2)
    {
        double tmp=2*x/(a*b);
        printf("%lf",90-acos(b/sqrt(b*b+tmp*tmp))*180/M_PI);
    }
    else
    {
        double tmp=2*x/(a*a)-b;
        printf("%lf",90-acos((b-tmp)/sqrt(a*a+(b-tmp)*(b-tmp)))*180/M_PI);
    }
    return 0;
}


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

int main()
{
    int n;
    cin >> n;
    vector<int> d(n);
    for (int i = 0; i < n; i++) {
        cin >> d[i];
    }
    long ans = 0;
    for (int i = 0; i < n - 1; i++) {
        for (int j = i + 1; j < n; j++) {
            ans += d[i] * d[j];
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int maxn=2e5;
int n,cnt[maxn];
long long ans=1e15,Ans,tot[2];
bool flag=false;
struct point{
	long long bel,val;
}p[2*maxn];
inline long long read(){
	long long x=0,f=1;
	char c;
	do{c=getchar();if(c=='-') f*=-1;}while(!isdigit(c));
	while(isdigit(c)){x=(x<<3)+(x<<1)+c-'0';c=getchar();}
	return x*f;
}
bool cmp(const point a,const point b){return a.val<b.val;}

int main(){
	n=read();
	for(int i=1;i<=n;i++){
		p[2*i].val=read();p[2*i-1].bel=i;
		p[2*i-1].val=read();p[2*i].bel=i;
		tot[0]+=p[2*i].val;tot[1]+=p[2*i-1].val;
	}
	ans=min(tot[0],tot[1]);
	sort(p+1,p+2*n+1,cmp);
	for(int i=1;i<=n;i++){
		cnt[p[i].bel]++;Ans+=p[i].val;
		if(cnt[p[i].bel]==2) flag=true;
	}
	if(flag){ans=min(ans,Ans);}
	else{
		ans=min(ans,(p[n].bel==p[n+1].bel)?min(Ans-p[n].val+p[n+2].val,Ans-p[n-1].val+p[n+1].val):Ans-p[n].val+p[n+1].val);
	}
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 4736
#include <iostream>
#include <vector>
#include <stack>
using namespace std;

int main() {
  int l;
  cin >> l;
  vector<int> in_list(1000);
  stack<int> st;
  int c;
  int i;
  for (i = 0; i < l; i++) {
    cin >> c;
    if (0 < c) {
      if (in_list[c] == 0) {
        st.push(c);
        in_list[c] = 1;
      } else {
        cout << i + 1 << endl;
        return 0;
      }
    } else {
      if (st.empty()) {
        cout << i + 1 << endl;
        return 0;
      }
      if (st.top() != -c) {
        cout << i + 1 << endl;
        return 0;
      } else {
        st.pop();
        in_list[-c] = 0;
      }
    }
  }
  cout << "OK" << endl;
  return 0;
}



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

int main(){
  int a, b;
  cin >> a >> b;
  if(a == b) cout << "Draw" << endl;
  else if(a == 1) cout << "Alice" << endl;
  else if(b == 1) cout << "Bob" << endl;
  else if(a > b) cout << "Alice" << endl;
  else cout << "Bob" << endl;
  return 0;
}

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

struct zahyou{
	int x;
	int y;
};

int main(){
	
	int tx,ty,count;
	char map[100][100];
	bool flag;
	struct zahyou now;
	
	
	
	while(cin>>tx>>ty,tx&&ty){
		
		flag=false;
		now.x=0;
		now.y=0;
		memset(map,'\0',sizeof(map));
		
		for(int i=0;i<tx;i++){
			for(int j=0;j<ty;j++){
				cin>>map[i][j];
			}
		}
		
		while(1){

			if(map[now.y][now.x]=='.'){
				cout<<now.x<<" "<<now.y<<endl;
				break;
			}
			else if(map[now.y][now.x]=='1'){
				cout<<"LOOP"<<endl;
				break;
			}

			if(map[now.y][now.x]=='>'){
				map[now.y][now.x]='1';
				now.x++;
			}
			else if(map[now.y][now.x]=='<'){
				map[now.y][now.x]='1';
				now.x--;
			}
			else if(map[now.y][now.x]=='v'){
				map[now.y][now.x]='1';
				now.y++;
			}
			else if(map[now.y][now.x]=='^'){
				map[now.y][now.x]='1';
				now.y--;
			}
		}
	}
}

Measured memory_bytes: 0
# -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=998244353
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1

def main():
    N,M,K=map(int,input().split())
    def COMinit(n,MOD):
        fac,finv,inv=[0]*max(2,n+1),[0]*max(2,n+1),[0]*max(2,n+1)
        fac[0]=fac[1]=1
        finv[0]=finv[1]=1
        inv[1]=1
        for i in range(2,(n+1)):
            fac[i]=fac[i-1]*i%MOD
            inv[i]=MOD-inv[MOD%i]*(MOD//i)%MOD
            finv[i]=finv[i-1]*inv[i]%MOD
        return fac,finv,inv
    
    fac,finv,inv=COMinit(N+10,MOD)
    
    def COM(n, k, MOD=MOD):
        if n<k or n<0 or k<0:
            return 0
        return fac[n]*(finv[k]*finv[n-k]%MOD)%MOD
    
    ans=0
    for i in range(K+1):
        ans+=COM(N-1,i)*M*pow(M-1,N-i-1,MOD)
        ans%=MOD
    print(ans)

if __name__ == '__main__':
    main()


Measured memory_bytes: 78096
import java.util.*;

class Main {
    public static void main(String[] args){
        System.gc();
        Scanner sc = new Scanner(System.in);
        long X = Integer.parseInt(sc.next());
        long A = Integer.parseInt(sc.next());
        long B = Integer.parseInt(sc.next());
        String ans;
        if (B <= A) ans = "delicious";
        else if (B <= A + X) ans = "safe";
        else ans = "dangerous";
        System.out.println(ans);
        sc.close();
    }
}

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

using namespace std;

int main(){
    cin.tie(0);
    cin.sync_with_stdio(0);

    string s;
    cin >> s;

    for(int i=0; i<s.size(); i++)if(s[i] != 'U' && s[i] != 'D'){
        if((i+1) % 2 == 0 && s[i] != 'L'){
            cout << "No";
            return 0;
        }
        else if((i+1) % 2 == 1 && s[i] != 'R'){
            cout << "No";
            return 0;
        }
    }
    cout << "Yes";
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#pragma comment(linker, "/stack:512000000")
#include<utility>
#include<iostream>
#include<fstream>
#include<vector>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<ctime>
#include<functional>
#include<random>
#include<climits>
#include<queue>
#include<stack>
#include<deque>
#include<bitset>
#include<map>
#include<set>
#include<unordered_map>
#include<unordered_set>
#include<cassert>
#include<ccomplex>

//4Head

#define all(x) x.begin(), x.end()
#define mp make_pair
#define X first
#define Y second

using namespace std;

using ll = long long;
using ull = unsigned long long;
using ld = long double;
mt19937_64 gen(time(NULL));

ll const mod = 1e9 + 7;

namespace {
	ll mul(ll a, ll b) {
		ll val = a * b - (ll)((ld)a * b / mod) * mod;
		if (val < 0) val += mod;
		if (val >= mod) val -= mod;
		return val;
	}

	ll poww(ll a, ll b) {
		ll val = 1;
		a %= mod;
		while (b > 0) {
			if (b % 2) val = mul(a, val);
			a = mul(a, a);
			b >>= 1;
		}
		return val % mod;
	}

	ll inv(ll a) {
		return poww(a, mod - 2);
	}
}

ll const maxn = 3e5 + 5;

signed main() {
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	string s; cin >> s;
	s = '0' + s;
	ll ans = 0;
	bool f = false;
	for (ll i = (ll)s.size() - 1; i >= 1; i--) {
		ll x = s[i] - '0';
		if (!f) {
			if (x < 5) {
				ans += x;
			} else if (x > 5) {
				ans += 10 - x;
				f = true;
			} else {
				if (s[i - 1] - '0' >= 5) {
					ans += 10 - x;
					f = true;
				} else {
					ans += x;
				}
			}
		} else {
			x++;
			f = false;
			if (x == 10) {
				f = true;
			} else {
				if (x < 5) {
					ans += x;
				} else if (x > 5) {
					ans += 10 - x;
					f = true;
				} else {
					if (s[i - 1] - '0' >= 5) {
						ans += 10 - x;
						f = true;
					} else {
						ans += x;
					}
				}
			}
		}
	}
	if (f) ans++;
	cout << ans << endl;
	return 0;
}

/*
3
0 1
3 0
1 0
*/

Measured memory_bytes: 2332
import java.io.*
import java.util.*
import java.lang.Math.*


fun main() {
    val N = rd.readInt()
    val A = rd.readIntArray()

    var ans = 0
    for (i in 0 until N step 2) {
        if (A[i]%2 == 1) ans++
    }

    println(ans)
}


//val rd = debug.Reader("abc", "168", "b", "sample-1")
val rd = Reader()
fun main(args: Array<String>) {
    Thread(null, MainThread(), "mainThread", 128 * 1024 * 1024).start()
}


const val MOD = 1_000_000_007L; const val INF = Int.MAX_VALUE/2; const val LINF = Long.MAX_VALUE/2
data class IntPair(val first: Int, val second: Int)
val errPrintln: (Any) -> Unit = { msg -> System.err.println(msg) }
class MainThread : Runnable {
    override fun run() { main() }
}
class Reader {
    private val br = BufferedReader(InputStreamReader(System.`in`))
    val readString: () -> String = { br.readLine() }
    val readInt: () -> Int = { br.readLine().toInt() }
    val readLong: () -> Long = { br.readLine().toLong() }
    val readIntArray: () -> IntArray = { br.readLine().split(' ').map { it.toInt() }.toIntArray() }
    val readLongArray: () -> LongArray = { br.readLine().split(' ').map { it.toLong() }.toLongArray() }
    val readListInt: () -> List<Int> = { br.readLine().split(' ').map { it.toInt() } }
    val readListLong: () -> List<Long> = { br.readLine().split(' ').map { it.toLong() } }
}


Measured memory_bytes: 36768
#include"bits/stdc++.h"
using namespace std;
typedef long long ll;
#define int               long long
#define ff                first
#define ss                second
#define md                1000000007
#define md1               998244353
#define inf               1000000000000000
#define minf              -1000000000000000
#define pb                push_back
#define in                insert
#define mkp               make_pair
#define mpll              map<ll,ll>
#define len(p)            (ll)p.size()
#define pll               pair<ll,ll>
#define all(v)            v.begin(),v.end()
#define mem(a,t)          memset(a,t,sizeof(a))
#define endl              "\n"
#define ar                array
#define vl                vector<ll>
#define vpll              vector<pair<ll,ll>>
#define f(i,yha,wha)      for(ll i=yha;i<wha;i++)
#define rf(i,wha,yha)     for(ll i=wha;i>=yha;i--)
#define f0(n)             for(ll i=0;i<n;i++)
#define f1(n)             for(ll i=1;i<=n;i++)
#define fg(i,yha,wha,gap) for(ll i=yha;i<wha;i+=gap)


void flash()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
}
ll pw(ll x, ll y)
{
    if (y == 0)
        return 1;
    if (y == 1)
        return x;
    ll ans = pw(x, y / 2);
    ans = ans * ans;
    if (y % 2 == 1)
        ans = ans * x;
    return ans;
}






void solve()
{
    ll n;
    cin >> n;
    ll a[n + 10];
    map<ll, ll>mp;
    f(i, 1, n + 1)
    {
        cin >> a[i];
        mp[i - a[i]]++;
    }
    ll cnt = 0;
    f(i, 1, n + 1)
    {
        cnt += (mp[i + a[i]]);
    }
    cout << cnt << endl;



}

int32_t main()
{
    flash();
    int t;
    t = 1;
    // cin >> t;
    while (t--)
    {
        solve();
    }
    return 0;
}


Measured memory_bytes: 27880
#include <bits/stdc++.h>
#include <cctype>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
//template<typename key, typename val>
//using ordered_tree =
//  tree<key, val, std::less<>, rb_tree_tag, tree_order_statistics_node_update>;
using namespace std;
typedef long long int64;
typedef unsigned long long uint64;
typedef complex<double> comp;
const double pi = 3.14159265358979323846;
const int inf = (int)1e+9 + 2;
const int64 inf64 = (int64)1e+18 + 2;
const double dinf = 1e+20;
const int mod = 1'000'000'007;//*/998244353;
const int base = 2187;
const double eps = 1e-9;
const int N = 300'000;
const int LOGN = 19;

int n, m, k;

void solve(int) {
  cin >> n;
  char ok = 0;
  for (; n; n /= 10) 
    ok |= n % 10 == 7;
  if (ok) {
    cout << "Yes\n";
  } else {
    cout << "No\n";
  }
}

void precalc() {
}

int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  precalc();
  int test = 1;
  //cin >> test;
  //auto start = chrono::high_resolution_clock::now();
  for (int i = 1; i <= test; ++i) {
    solve(i);
  }
  //cerr << chrono::duration_cast<chrono::milliseconds>(chrono::high_resolution_clock::now() - start).count() << '\n';
  return 0;
}



Measured memory_bytes: 3652
#include <iostream>
#include <math.h>
#include <cstdio>
using namespace std;
int main(void){
    int a,b,ans;
    char op;
    while(1){
    scanf("%d %c %d", &a, &op, &b);
        if(op=='+'){
            ans=a+b;
        }else if(op=='-'){
            ans=a-b;
        }else if(op=='*'){
            ans=a*b;
        }else if(op=='/'){
            ans=a/b;
        }else{
            break;
        }
    printf("%d\n", ans);
    }
}



Measured memory_bytes: 3204
#include<iostream>
#include<map>
#include<algorithm>
using namespace std;

int n, r[1000], w[1000];
bool dp[2][1001];

int main(){
  std::ios::sync_with_stdio(false);
  while(cin >> n,n){
    int sumr = 0, sumw = 0, id = 0;
    for(int i=0;i<n;i++){
      cin >> r[i] >> w[i];
      sumr += r[i]; sumw += w[i];
      if(r[id] < r[i])id = i;
    }

    int lim = 2*r[id]-sumr;
    if(lim<=0){
      cout << sumr + sumw << endl;
      continue;
    }

    for(int j=0;j<=lim;j++)dp[0][j] = false;
    dp[0][0] = true;
    
    for(int i=0;i<n;i++){
      int now = i&1, nxt = 1-now;
      for(int j=0;j<=lim;j++)dp[nxt][j] = false;
      for(int j=0;j<=lim;j++){
	if(dp[now][j]){
	  dp[nxt][j] = true;
	  if(i!=id && j+w[i]<=lim)dp[nxt][j+w[i]] = true;
	}
      }
    }
    
    int tmp = 0;
    for(int i=0;i<=lim;i++){
      if(dp[n&1][i])tmp = i;
    }
    cout << sumr + sumw + lim - tmp << endl;
  }
}

Measured memory_bytes: 1204
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <queue>
#include <vector>
#define LL long long
using namespace std;
const int MAXN = 1e3 + 5, inf = 0x3f3f3f3f;
struct Node {
	int X, Y, tmp;
	bool operator<(const Node p) const {return tmp > p.tmp;}
};
priority_queue <Node> que;
Node t, q;
int n, m, S, T, S1, T1, minn = inf, tox[5] = {1, -1, 0, 0}, toy[5] = {0, 0, 1, -1};
bool vis[MAXN][MAXN];
char a[MAXN][MAXN], s[MAXN];
int main() {
	scanf("%d%d%d%d%d%d", &n, &m, &S, &T, &S1, &T1);
	for(int i = 1; i <= n; i ++) {
		scanf("%s", s + 1);
		for(int j = 1; j <= m; j ++) {
			a[i][j] = s[j];
		}
	}
	t.X = S; t.Y = T; t.tmp = 0;
	que.push(t);
	while(que.size()) {
		t = que.top(); que.pop();
		if(vis[t.X][t.Y]) continue;
		vis[t.X][t.Y] = 1;
		if(t.X == S1 && t.Y == T1) {
			minn = min(minn, t.tmp);
			break;
		}
		for(int i = 0; i < 4; i ++) {
			int x = t.X + tox[i], y = t.Y + toy[i];
			if(x < 1 || x > n || y < 1 || y > m || vis[x][y] || a[x][y] == '#') continue;
			q.X = x; q.Y = y; q.tmp = t.tmp;
			que.push(q);
		}
		for(int i = t.X - 2; i <= t.X + 2; i ++) {
			for(int j = t.Y - 2; j <= t.Y + 2; j ++) {
				if(i < 1 || i > n || j < 1 || j > m || vis[i][j] || a[i][j] == '#') continue;
				q.X = i; q.Y = j; q.tmp = t.tmp + 1;
				que.push(q);
			}
		}
	}
	if(minn == inf) minn = -1;
	printf("%d", minn);
	return 0;
}

Measured memory_bytes: 5552
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda:sys.stdin.readline().rstrip()
from collections import deque
def resolve():
    n=int(input())
    E=[[] for _ in range(n)]
    for i in range(n-1):
        a,b=map(int,input().split())
        a-=1; b-=1
        E[a].append(b)
        E[b].append(a)

    # double sweepで直径を求める
    dist=[INF]*n
    dist[0]=0
    Q=deque([0])
    while(Q):
        v=Q.popleft()
        for nv in E[v]:
            if(dist[nv]!=INF): continue
            dist[nv]=dist[v]+1
            Q.append(nv)

    v=max((dist[v],v) for v in range(n))[1]
    dist=[INF]*n
    dist[v]=0
    Q=deque([v])
    while(Q):
        v=Q.popleft()
        for nv in E[v]:
            if(dist[nv]!=INF): continue
            dist[nv]=dist[v]+1
            Q.append(nv)

    dia=max(dist)
    print("Second" if(dia%3==1) else "First")
resolve()

Measured memory_bytes: 103856
/*بِسْمِ اللَّهِ الرَّحْمَنِ الرَّحِيم*/

#include <bits/stdc++.h>
using namespace std;

const int mx=1e5+5;
char str[mx];
int main ()
{
    int n,a,b;
    scanf ("%s",str);
    n=strlen(str);
    a=b=-1;
    for (int i=0;i<n-1;i++) {
        if (str[i]==str[i+1]) {
            a=i+1,b=i+2;
            break;
        }
        if (i<n-2 && str[i]==str[i+2]) {
            a=i+1,b=i+3;
            break;
        }
    }
    printf ("%d %d\n",a,b);

    return 0;
}


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

#define lld long long

int main() {
    lld N,M;
    lld S[10001];
    lld sum = 0;
    cin >> N >> M;
    for(int i=0;i<M;i++){
        cin >> S[i];
        sum += S[i];
    }
    if(sum <= N){
        cout << N - sum << endl;
    } else {
        cout << "-1" << endl;
    }
    return 0;
}

Measured memory_bytes: 3680
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pdd pair<double,double>
#define X first
#define Y second
#define REP(i,a) for(int i=0;i<a;++i)
#define REPP(i,a,b) for(int i=a;i<b;++i)
#define FILL(a,x) memset(a,x,sizeof(a))
#define foreach( gg,itit )  for( typeof(gg.begin()) itit=gg.begin();itit!=gg.end();itit++ )
#define mp make_pair
#define pb push_back
#define all(s) s.begin(),s.end()
#define present(c,x) ((c).find(x) != (c).end())
const double EPS = 1e-8;
const int mod = 1e9+7;
const int N = 1e6+10;
const ll INF = 1e18;

//#define DEBUG
ll power(ll x,ll y){
  ll t=1;
  while(y>0){
    if(y%2) y-=1,t=t*x%mod;
    else y/=2,x=x*x%mod;
  }
  return t;
}
#ifdef DEBUG
#define dprintf(fmt,...) fprintf(stderr,fmt,__VA_ARGS__)
#else
#define dprintf(fmt,...)
#endif

pii pt[N]; int rad[N];
long double dis[N];
int u[N];
priority_queue<pair<long double,int> > P;
long double comp(pii a,pii b){
  return sqrt((1ll*a.X-b.X)*(1ll*a.X-b.X)+(1ll*a.Y-b.Y)*(1ll*a.Y-b.Y));
}
int main(){
  cout<<fixed<<setprecision(10);
  pii z; scanf("%d%d",&z.X,&z.Y);
  pt[0]=z;
  scanf("%d%d",&z.X,&z.Y);
  pt[1]=z;
  int n; scanf("%d",&n);
  REP(i,n){
    pii z; scanf("%d%d",&z.X,&z.Y);
    pt[i+2]=z;scanf("%d",&rad[i+2]);
  } 
  n+=2;
  REP(i,n) dis[i]=INF;
  dis[0]=0;
  P.push(mp(0,0));
  while(!P.empty()){
    pair<long double,int> z=P.top(); P.pop();
    z.X*=-1;
    if(u[z.Y]) continue;
    u[z.Y]=1;
    REP(i,n) if(i!=z.Y){
      long double dik = max((long double)0.0,comp(pt[z.Y],pt[i])-rad[i]-rad[z.Y])+z.X;
     // printf("%d %d %Lf\n",z.Y,i,dik);
      if(dik<dis[i]){
        dis[i]=dik;
        P.push(mp(-dik,i));
      }
    }
  }
  cout<<dis[1]<<endl;
  return 0;
}

Measured memory_bytes: 8556
#include<cstdio>
#include<algorithm>
#include<queue>
#include<string>
#include<cstring>
#include<cstdlib>
#include<sstream>
#include<set>
using namespace std;
class P{
    public:
    int num;
    int cnt;
    bool used[10];
    P(){}
    P(int num,int cnt,bool a[10]):num(num),cnt(cnt){
        for(int i = 0; i < 10; i++){
            used[i] = a[i];
        }
    }
};
int bond(int x,int y){
    stringstream ss1;
    ss1 << x;
    stringstream ss2;
    ss2 << y;
    string ans = ss1.str() + ss2.str();
    stringstream Ans;
    Ans << ans;
    int res;
    Ans >> res;
    return res;
}
int main(){
    int n;
    int m;
    while(scanf("%d%d",&n,&m),(n|m)){
        int card[10];
        set<int> S;
        queue<P> Q;
        for(short i = 0; i < n; i++){
            bool x[10]={0};
            x[i] = 1;
            scanf("%d",&card[i]);
            Q.push(P(card[i],1,x));
        }
        short ans = 0;
        while( Q.size() ){
            P p = Q.front();Q.pop();
            if(p.cnt == m){
                if(S.find(p.num) == S.end())ans++,S.insert(p.num);
            }
            else{
                for(int i = 0; i < n; i++){
                    if(p.used[i] == 0){
                        p.used[i] = 1;
                        Q.push(P(bond(p.num,card[i]),p.cnt+1,p.used));
                        p.used[i] = 0;
                    }
                }
            }
        }
        printf("%d\n",ans);
    }
    return 0;
}

Measured memory_bytes: 1420
#include <iostream>
#include <vector>
#include <map>
#include <cmath>
#include <algorithm>
#define endl "\n"
using namespace std;

int main()
{
    int minm = 1001;
    int maxm = 0;

    int n;
    cin >> n;
    for(int i = 0; i < n; i ++)
    {
    	int val;
    	cin >> val;
    	minm = min(minm, val);
    	maxm = max(maxm, val);
    }

    cout << maxm - minm;
}

Measured memory_bytes: 256
#include <stdio.h>
long long k, s=100;
int i, j, n, m, ans=0;
int main(){
    scanf("%lld", &k);
    while(s < k){
    	s = s + s * 0.01;
    	ans++;
    }
    printf("%d\n", ans);
    return 0;
}

Measured memory_bytes: 1732
#include <bits/stdc++.h>
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define rep(i, s, N) for(ll i{s}; i < N; i++)
#define rem(i, N, s) for(ll i{N}; i > s; i--)
using namespace std;using ll = long long int;using ld = long double;using P = pair<ll,ll>;const int MOD = (int)1e9+7;const string rt = "\n";const string sp = " ";/* 最大公約数 */template<typename T> T gcd(T a, T b){return b != 0 ? gcd(b, a % b) : a;}/* UnionFind */template<typename T> struct UnionFind{vector<T> par;UnionFind(T n) : par(n, -1){}void init(T n){par.assign(n, -1);}T root(T x){if (par[x] < 0) return x;else return par[x] = root(par[x]);}bool issame(T x, T y){return root(x) == root(y);}bool merge(T x, T y){x = root(x); y = root(y);if(x == y) return false;if(par[x] > par[y]) swap(x, y);par[x] += par[y];par[y] = x;return true;}int size(int x) {return -par[root(x)];}};/* コンビネーション */template<typename T> ll combpm(T N_, T C_) {const int NUM_=400001;static ll fact[NUM_+1],factr[NUM_+1],inv[NUM_+1];if (fact[0]==0) {inv[1]=fact[0]=factr[0]=1;for (int i=2;i<=NUM_;++i) inv[i] = inv[MOD % i] * (MOD - MOD / i) % MOD;for (int i=1;i<=NUM_;++i) fact[i]=fact[i-1]*i%MOD, factr[i]=factr[i-1]*inv[i]%MOD;}if(C_<0 || C_>N_) return 0;return factr[C_]*fact[N_]%MOD*factr[N_-C_]%MOD;}/* 多次元ベクター */template<class T>vector<T> mvec(size_t a){return vector<T>(a);}template<class T, class... Ts>auto mvec(size_t a, Ts... ts){return vector<decltype(mvec<T>(ts...))>(a, mvec<T>(ts...));}/* テスト関数 */void test(ll n){cout << "test" << n << endl;}/* 小数点以下 */void fixsp(ll n){cout << fixed << setprecision(n);}void defsp(ll n){cout << defaultfloat << setprecision(n);}/* 重み付きUnionFind */struct WUnionFind {vector<int> par;vector<int> rank;WUnionFind(int n = 1) {init(n);}void init(int n = 1) {par.resize(n); rank.resize(n);for (int i = 0; i < n; ++i) par[i] = i, rank[i] = 0;}int root(int x) {if (par[x] == x) {return x;}else {int r = root(par[x]);return par[x] = r;}}bool issame(int x, int y) {return root(x) == root(y);}bool merge(int x, int y) {x = root(x); y = root(y);if (x == y) return false;if (rank[x] < rank[y]) swap(x, y);if (rank[x] == rank[y]) ++rank[x];par[y] = x;return true;}};/* IO高速化 */void fastio(){ios::sync_with_stdio(false);cin.tie(NULL);}
/* ここからコード開始 */

int main(){
  fastio;
  ll N;
  cin >> N;
  auto stock = mvec<ll>(0);
  auto A = mvec<ll>(N);
  for(auto&& i : A){
    cin >> i;
  }
  stock.push_back(-1*A[0]);
  ll now{};
  rep(i, 1, N){
    auto it = upper_bound(all(stock), -1*A[i]);
    if(it == stock.end()) stock.push_back(-1*A[i]);
    else{
      *it = -1*A[i];
    }
    // for(auto&& i : stock){
    // cout << i << sp;
    // }
    // cout << rt;
  }
  cout << stock.size() << rt;
}

Measured memory_bytes: 2168
#include <stdio.h>

#define  N  36

typedef struct{
  char x;
  int y;
}Tru;


  main(){
   
    int i,j,minj,n,z;
    Tru C[N],D[N],tmp1,tmp2;

    scanf("%d",&n);
    for(i=0;i<n;i++){
      scanf(" %c%d",&C[i].x,&C[i].y);
      D[i] = C[i];
    }

    for(i=0;i<n-1;i++){
      for(j=n-1;j>i;j--){
        if(C[j].y<C[j-1].y){
          tmp1 =C[j];
	  C[j]=C[j-1];
	  C[j-1]=tmp1;
	}
      }
    }

    for(i=0;i<n-1;i++){
      printf("%c%d ",C[i].x,C[i].y);
    }
    printf("%c%d\n",C[n-1].x,C[n-1].y);
    printf("Stable\n");

    for(i=0;i<n;i++){
      minj = i;
      for(j=i;j<n;j++){
	if(D[j].y<D[minj].y){
	  minj = j;
	}
      }
      if(i!=minj){
	tmp2 =D[i];
	D[i]=D[minj];
	D[minj]=tmp2;
      }
    }

    for(i=0;i<n-1;i++){
      printf("%c%d ",D[i].x,D[i].y);
    }
    printf("%c%d\n",D[n-1].x,D[n-1].y);
    for(i=0;i<n;i++){
      if(C[i].x!=D[i].x){
        z=0;	break;
      }
      else if(C[i].x==D[i].x)   z=1;
    }

    if(z==0)   printf("Not stable\n");
    else if(z==1)  printf("Stable\n");
    return 0;
}

Measured memory_bytes: 608
import scala.io.StdIn
import scala.collection.mutable.ArrayBuffer

object Main extends App {

  val n = StdIn.readLine().trim.toInt
  class Point(val x: Double, val y: Double){
    override def toString: String = {
      f"$x%.8f $y%.8f"
    }
  }
  
  final val start = new Point(0, 0)
  final val end   = new Point(100, 0)
  final val th = scala.math.Pi * 60.0 / 180.0

  def calcuPoint(p1: Point, p2: Point, a: Double, b: Double) = new Point((a*p1.x+b*p2.x)/3.0, (a*p1.y+b*p2.y)/3.0)
  
  
  def koch(d: Double, p1: Point, p2: Point, ret: ArrayBuffer[Point]): Unit = {
    if(d != 0){
      val s = calcuPoint(p1, p2, 2.0, 1.0) 
      val t = calcuPoint(p1, p2, 1.0, 2.0)
      val u = new Point((t.x - s.x)*math.cos(th) - (t.y - s.y)*math.sin(th) + s.x,
                        (t.x - s.x)*math.sin(th) + (t.y - s.y)*math.cos(th) + s.y)
      
      koch(d-1, p1, s, ret)
      // println(s)
      ret += s
      
      koch(d-1, s, u, ret)
      //println(u)
      ret += u
      
      koch(d-1, u, t, ret)
      // println(t)
      ret += t

      koch(d-1, t, p2, ret)

    }
  }
  
  var result = ArrayBuffer.empty[Point]

  //println(start)
  result += start
  koch(n, start, end, result)
  result += end
  
  //result.foreach(println)
  println(result.mkString(f"%n"))
  
}


Measured memory_bytes: 60336
#!/usr/bin/env python3
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf') ;mod = 10**9+7
mans = -inf ;ans = 0 ;count = 0 ;pro = 1

n = int(input())
F = [list(map(int,input().split())) for i in range(n)]
P = [list(map(int,input().split())) for i in range(n)]
for bit in range(1,2**10):
  tmp = 0
  for i in range(n):
    count = 0
    for k in range(10):
      if bit >> k & 1:
        count += F[i][k]
    tmp += P[i][count]
  mans = max(mans,tmp)
print(mans)
    

Measured memory_bytes: 41836
#include <iostream>
#include <string>
#include <vector>
using namespace std;
using ll = long long;
int main() {
    string s;
    cin >> s;
    vector<string> t = {"SUN","MON","TUE","WED","THU","FRI","SAT"};
    for (int i = 0; i < t.size(); i++) {
        if (s == t[i]) {
            cout << 7 - i << endl;
            return 0;
        }
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define mod (int)(1e9+7)
#define inf (int)(3e18)
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define P std::pair<int,int>
#define PiP std::pair<int,std::pair<int,int>>
#define all(v) v.begin(),v.end()
#define mkp std::make_pair
#define prique(T) std::priority_queue<T,vector<T>,greater<T>>
using namespace std;
template<class T> inline void chmax(T& a, T b) { a = std::max(a, b); }
template<class T> inline void chmin(T& a, T b) { a = std::min(a, b); }

bool prime(int x) {
	for (int i = 2; i * i <= x; i++) {
		if (x % i == 0)return false;
	}
	return x != 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
int lcm(int x, int y) {
	return x / gcd(x, y) * y;
}
int kai(int x, int y) {
	int res = 1;
	for (int i = x - y + 1; i <= x; i++) {
		res *= i; res %= mod;
	}
	return res;
}
int mod_pow(int x, int y, int m) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % m;
		}
		x = x * x % m;
		y >>= 1;
	}
	return res;
}
int comb(int x, int y) {
	if (y > x)return 0;
	return kai(x, y) * mod_pow(kai(y, y), mod - 2, mod) % mod;
}
int get_rand(int MIN, int MAX) {
	std::random_device rnd;
	std::mt19937_64 mt64(rnd());
	std::uniform_int_distribution<int>engine(MIN, MAX);
	return engine(mt64);
}
/*--------Library Zone!--------*/

int n;
multiset<int>st;
signed main() {
	cin >> n;
	rep(i, n) {
		int a; cin >> a;
		auto it = st.lower_bound(a);
		if (it == st.begin())st.insert(a);
		else {
			it--;
			st.erase(it); st.insert(a);
		}
	}
	cout << st.size() << endl;
}

Measured memory_bytes: 4992