akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
//const ull mod = 1e9 + 7;
const ll mod = 1e9 + 7;
#define REP(i,n) for(int i=0;i<(int)n;++i)

// debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

template<class S, class T> ostream& operator << (ostream& os, const pair<S, T> v){
  os << "(" << v.first << ", " << v.second << ")"; return os;
}
template<class T> ostream& operator << (ostream& os, const vector<T> v){
  for(int i = 0; i < (int)v.size(); i++){if(i > 0){os << " ";} os << v[i];} return os;
}
template<class T> ostream& operator << (ostream& os, const vector<vector<T>> v){
  for(int i = 0; i < (int)v.size(); i++){if(i > 0){os << endl;} os << v[i];} return os;
}
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }

// conversion number to bit
string num2bit(ll num, ll len){
  string bit = "";
  REP(i, len){
    bit += char('0'+(num>>i & 1));
  }
  return bit;
}

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

    ll N, X;
    cin >> N >> X;
    vector<ll> x(N);
    REP(i, N) cin >> x[i];

    vector<ll> s(N+1, 0);
    REP(i, N) s[i+1] = s[i] + x[i];

    ll mi = (1ll<<60);


    for(int d=1;d<=N;d++){
    	ll tmp = 0;
    	tmp += (d*X + N*X);
    	REP(i, N/d){
    		ll a = N-1-d+1-i*d;
    		ll b = N-1-i*d;
    		if(i==0){
    			tmp += (s[b+1]-s[a])*5;
    		}else{
    			tmp += (s[b+1]-s[a])*((i+2)*(i+2)-(i+1)*(i+1));	
    		}
    		if(tmp<0){
    			tmp = (1ll<<60);
    			break;
    		}
    	}
    	ll las = N/d;
    	tmp += (s[N%d])*((las+2)*(las+2) - (las+1)*(las+1));

    	chmin(mi, tmp);
    }
    cout << mi << endl;
    return 0;
}

Measured memory_bytes: 3456
#include <bits/stdc++.h>
using namespace std;
 #define rep(i, n) for (int i = 0; i < (int)(n); i++)
 
int main() {
  int X;
  cin>>X;
  int Y=X%500;
  int Z=X/500;
  int A=Y/5;
  cout<<Z*1000+A*5<<endl;
}

Measured memory_bytes: 256
using System;
using System.Numerics;
using System.Linq;
using System.Collections.Generic;
using System.Text;
using System.Collections;

namespace debug
{
    class main
    {
        static void Main(string[] args)
        {
            //問題クラスを展開
            ProgramB a = new ProgramB();
            a.main();//実行する

        }

    }

    class ProgramA
    {
        public void main()
        {

            string[] s = Console.ReadLine().Split(' ');

            Console.WriteLine((int.Parse(s[0]) - 1) * (int.Parse(s[1]) - 1));


        }
    }

    class ProgramB
    {
        public void main()
        {

            string s = Console.ReadLine();

            Console.WriteLine(s[0] + (s.Length - 2).ToString() +s[s.Length -1]);


        }
    }

}






Measured memory_bytes: 13140
#include<bits/stdc++.h>
using namespace std;
#define oo (long long)1e18
#define ll long long
#define setdp memset(dp,-1,sizeof(dp))
const ll mod = 1e9+7;
void _IOS(){ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);cin.sync_with_stdio(0);}
#define PI 3.14159265359
int sx,sy,tx,ty;
//8c:1a:bf:89:66:b6
struct threeElements{
int _1st,_2nd,_3rd;
};
vector<vector<int>>adj(10);
int sum,n,m,visited[11];
int main()
{
   // freopen ("jumping.in","r",stdin);
   _IOS();
   //18:52
   ll n;
   cin>>n;
   ll i=1,ans=0;
    while((i*(i+1))/2<n)
    {
        i++;
        ans++;
    }
    cout<<ans+1;


}


Measured memory_bytes: 3644
#include<stdio.h>

int main(void){

  int A,B,T;
  int ans=0;
  int i;

  scanf("%d %d %d",&A,&B,&T);

  for(i=1;i<T+1;i++){

    if(i%A==0)ans = ans + B;
    else{}
  }

  printf("%d\n",ans);

  return 0;

}


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

namespace CSharpSample01
{
    
    class Program
    {

        
        
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ');
            int P = int.Parse(input[0]);
            int Q = int.Parse(input[1]);
            int R = int.Parse(input[2]);

            List<int> list = new List<int>();

            list.Add(P + Q);
            list.Add(Q + R);
            list.Add(P + R);

            list.Sort();

            Console.WriteLine(list[0]);
          
        }
    }
}

Measured memory_bytes: 13140
#include <iostream>
#include <algorithm>
#include <queue>
#include <cstring>

using namespace std;

typedef pair<int, int> Pii;
typedef pair<int, pair<Pii, Pii> > Tpl;
#define fi first
#define se second
int W, H;
int const INF = 1<<29;
inline bool inF(int x, int y) {
  return 0<=x&&x<W&&0<=y&&y<H;
}

int main() {

  int const dx[] = {-1,0,1,0};
  int const dy[] = {0,-1,0,1};
  while(cin >> W >> H && (W|H)) {
    int tx, ty, kx, ky; cin >> tx >> ty >> kx >> ky; tx--; ty--; kx--; ky--;
    int grid[51][51];
    for(int i=0; i<H; i++)
      for(int j=0; j<W; j++)
	cin >> grid[i][j];
    
    static int vis[51][51][51][51];
    fill(vis[0][0][0], vis[51][0][0], INF);
    
    queue<Tpl> Q;
    Q.push(Tpl(make_pair(0, make_pair(Pii(tx, ty), Pii(kx, ky)))));
    vis[ty][tx][ky][kx] = 0;
    int ans = -1;
    while(!Q.empty()) {
      Tpl t = Q.front(); Q.pop();
      const int tx = t.se.fi.fi, ty = t.se.fi.se, kx = t.se.se.fi, ky = t.se.se.se;
      const int cost = t.fi;
      for(int i=0; i<4; i++) {
	int ntx = tx+dx[i], nty = ty+dy[i];
	int nkx = kx-dx[i], nky = ky-dy[i];
	if(tx == kx && ty == ky) { ans = cost; goto EXIT; }
	if(!inF(ntx, nty) && !inF(nkx, nky)) continue;
	if(!inF(ntx, nty)) ntx = tx, nty = ty;
	if(!inF(nkx, nky)) nkx = kx, nky = ky;
	if(grid[nty][ntx] && grid[nky][nkx]) continue;
	if(grid[nty][ntx]) ntx = tx, nty = ty;
	if(grid[nky][nkx]) nkx = kx, nky = ky;
	if(vis[nty][ntx][nky][nkx] > cost+1) {
	  if(cost+1 == 100) continue;
	  vis[nty][ntx][nky][nkx] = cost+1;
	  Q.push(Tpl(cost+1, make_pair(Pii(ntx, nty), Pii(nkx, nky))));
	}
      }
    }
    
  EXIT:;
    if(ans == -1) cout << "NA" << endl;
    else cout << ans << endl;
  }
  
  return 0;
}

Measured memory_bytes: 27784
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <map>
#include <set>
using namespace std;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 2000000000
static int dp[2][5005][2];
int co[10005];
int main(){
	int n;
	scanf("%d",&n);
	for(int i=1;i<n;i++){
		scanf("%d",&co[i]);
	}
	for(int i=0;i<2;i++){
		for(int j=0;j<=n/2;j++){
			for(int k=0;k<2;k++){
				dp[i][j][k]=INF;
			}
		}
	}
	dp[0][0][0]=0;
	dp[0][0][1]=0;
	for(int i=0;i<=n/2;i++){
		for(int j=0;j<=n/2;j++){
			int p=i%2;
			if(i!=0){
				dp[p][j][0]=dp[1-p][j][0];
				dp[p][j][1]=dp[1-p][j][0]+co[i+j];
			}
			if(j!=0){
				dp[p][j][0]=min(dp[p][j][0],dp[p][j-1][1]+co[i+j]);
				dp[p][j][1]=min(dp[p][j][1],dp[p][j-1][1]);
			}
		}
	}
	int ans=min(dp[0][n/2][0],dp[0][n/2][1]);
	printf("%d\n",ans);
}

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


#include "bits/stdc++.h"
#define int long long
#define For(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(obj) begin(obj), end(obj)
#define Max(x) *max_element(ALL(x))
#define Min(x) *min_element(ALL(x))
#define Lower_bound(A, key) distance(A.begin(), lower_bound(ALL(A), key))
#define Upper_bound(A, key) distance(A.begin(), upper_bound(ALL(A), key))

using namespace std;
using ll      = long long;
const int MOD = (int)(1e9 + 7);
const int INF = (int)(1e13 + 7);

int bpm(int x, int y) {
  if (x == 0)
    return 0;
  else if (y == 0) {
    return 1;
  }
  int ans = 1;
  x %= MOD;
  int digit = (int)((log((double)y) / log((double)2) / 1 + 1));
  for (int i = 0; i < digit; i++) {
    if (((y >> i) & 1u) == 1) {
      ans *= x;
      ans %= MOD;
    }
    x = x * x;
    x %= MOD;
  }
  return ans;
}


class CWriteAndErase {
public:
	int solve(std::istream& cin, std::ostream& cout) {
          int N;
          cin>>N;
          vector<int> A(N);
          rep(i, N){
            cin>>A[i];
          }
          sort(ALL(A));
          int ans = 0;
          int num = 1;
          if (N == 1){
            cout<<1<<endl;
            return 0;
          }
          For(i, 1, N){
            if (A[i] == A[i-1]){
              num += 1;
            }else{
              if (num%2){
                ans += 1;
              }
              num = 1;
            }
          }
          if (A[N-1] == A[N-2]){
            if (num%2){
              ans += 1;
            }
          }
          if (A[N-1] != A[N-2]){
            ans += 1;
          }
          cout<<ans<<endl;
	}
};


signed main() {
	CWriteAndErase solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


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

#define MOD 1000000007
#define rep(i, n) for(ll i=0; i < (n); i++)
#define rrep(i, n) for(ll i=(n)-1; i >=0; i--)
#define ALL(v) v.begin(),v.end()
#define rALL(v) v.rbegin(),v.rend()
#define FOR(i, j, k) for(ll i=j;i<k;i++)
#define debug_print(var) cerr << #var << "=" << var <<endl;
#define DUMP(i, v)for(ll i=0;i<v.size();i++)cerr<<v[i]<<" "

using namespace std;
typedef long long int ll;
typedef vector<ll> llvec;
typedef vector<double> dvec;
typedef pair<ll, ll> P;
typedef long double ld;
struct edge{ll x, c;};

ll mod(ll a, ll mod){
  ll res = a%mod;
  if(res<0)res=res + mod;
  return res;
}

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

ll modinv(ll a, ll mod){
  return modpow(a, mod-2, mod);
}

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

bool is_prime(ll n){
  ll i = 2;
  if(n==1)return false;
  if(n==2)return true;
  bool res = true;
  while(i*i <n){
    if(n%i==0){
      res = false;
    }
    i = i+1;
  }

  //if(i==1)res = false;
  if(n%i==0)res=false;
  return res;
}

struct UnionFind{
  ll N;
  llvec p;
  llvec cnt;
  UnionFind(ll n){
    N = n;
    p=llvec(N);
    cnt=llvec(N, 0);
    rep(i, N){
      p[i] = i;
      cnt[i] = 1;
    }
  }

  void con(ll a, ll b){
    P at = root(a);
    P bt = root(b);
    if(at.second!=bt.second){
      if(at.first>bt.first){
        swap(at, bt);
        swap(a, b);
      }
      p[at.second] = bt.second;
      cnt[bt.second]+=cnt[at.second];
      p[a]=bt.second;
    }
  }

  P root(ll a){
    ll atmp = a;
    ll c=0;
    while(atmp!=p[atmp]){
      atmp = p[atmp];
      c++;
    }
    p[a] = atmp;
    return {c, atmp};
  }

  bool is_con(ll a, ll b){
    P at=root(a);
    P bt=root(b);
    return at.second == bt.second;
  }
  
};

struct dijkstra{
  ll N;
  llvec d;
  vector<vector<edge>> e;
  dijkstra(ll n){
    N = n;
    //d = llvec(N, 1e18);
    e = vector<vector<edge>>(N);
  }

  void add_edge(ll from, ll to, ll cost){
    e[from].push_back({to, cost});
  }

  void run(ll start){
    priority_queue<P, vector<P>, greater<P>> que;
    que.push({0, start});
    d = llvec(N, 1e18);
    d[start]=0;
    while(!que.empty()){
      P q = que.top();que.pop();
      ll dc = q.first;
      ll x = q.second;
      if(dc>d[x]){
        continue;
      }else{
        for(auto ip: e[x]){
          if(d[ip.x]<=d[x]+ip.c){
            continue;
          }else{
            d[ip.x]= d[x]+ip.c;
            que.push({d[ip.x], ip.x});
          }
        }
      }
    }
  }  
};


/**************************************
** A main function starts from here  **
***************************************/
int main(){
  ll N, K;
  cin >> N >> K;
  llvec a(N);
  rep(i, N){
    cin >> a[i];
  }

  ll cnt = 0;
  if(a[0]>K){
    cnt = a[0]-K;
    a[0] = K;
  }
  rep(i, N-1){
    if(a[i+1] + a[i] > K){
      cnt += a[i+1] + a[i] - K;
      a[i+1] = K - a[i];
    }
  }
  cout << cnt << endl;
  return 0;
}


Measured memory_bytes: 4008
#include<bits/stdc++.h>
using namespace std;
int main()
{
    string s;
    cin>>s;
    int diff=INT_MAX;
    for(int i=0;i<s.length()-2;i++)
    {
        int n = (s[i]-'0')*100+(s[i+1]-'0')*10+s[i+2]-'0';
        diff= min(diff,abs(753-n));
    }
    cout<<diff<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <cstring>
#include <queue>
#include <ctime>
#include <cassert>
#include <cstdio>
#include <algorithm>
#include <unordered_set>
#include <unordered_map>
#include <bitset>

using namespace std;

#define fr first
#define sc second
#define mp make_pair
#define pb push_back
#define epr(...) fprintf(stderr, __VA_ARGS__)
#define db(x) cerr << #x << " = " << x << endl
#define db2(x, y) cerr << "(" << #x << ", " << #y << ") = (" << x << ", " << y << ")\n"; 
#define db3(x, y, z) cerr << "(" << #x << ", " << #y << ", " << #z << ") = (" << x << ", " << y << ", " << z << ")\n"
#define all(a) (a).begin(), (a).end()
#define sz(a) (int)a.size()

#define equal equalll
#define less lesss
const int N = -1;
const long long INF = 1e9 + 19;
typedef long long ll;



void read() {
    string s;
    cin >> s;
    int res = 0;
    int bal = 0;
    for (auto ch: s) {
        if (ch == 'S')
            bal--;
        else
            bal++;
        res = max(bal, res);
    }
    cout << res * 2 << endl;

}

void solve() {

}

void stress() {

}

int main(){
#ifdef MY_DEBUG
    freopen("in", "r", stdin);
    //freopen("out", "w", stdout);
#endif
    if (1) {
        int k = 1;
        for (int tt = 0; tt < k; tt++) {
            read();
            solve();
        }
    }
    else {
        stress();
    }

    return 0;
}


Measured memory_bytes: 640
#include <cstdio>
#include <cmath>

#include <iostream>

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

#include <algorithm>

using namespace std;
vector<vector<int> > vv;
vector<int> v, dist;

int main(int argc, char *argv[]) {
  	
  	
  	int n;
  	cin>> n;
  	vv = vector<vector<int> >(n + 1, vector<int> (0));
  	v = vector<int> (n + 1, 0);
  	dist = vector<int> (n + 1, -1);
  	for (int i = 0; i < n - 1; i++) {
  		int a, b;
  		scanf("%d%d", &a, &b);
  		// cin >> a >> b;
  		vv[a].push_back(b);
  		vv[b].push_back(a);
  		v[a]++;
  		v[b]++;
  	}

  	int res = 0;
  	queue<int> q;
  	for (int i = 1; i <= n; i++) {
  		if (v[i] == 1) {
  			q.push(i);
  			dist[i] = 0;
  		}
  	}

  	while (q.size() > 0) {
  		queue<int> qq;
  		while (q.size() > 0) {
  			int t = q.front();
  			q.pop();
  			v[t] = 0;
  			for (int i = 0; i < vv[t].size(); i++) {
  				if (v[vv[t][i]] == 0)
  					continue;
  				v[vv[t][i]]--;
  				res = max(res, dist[vv[t][i]] + dist[t] + 1);
  				dist[vv[t][i]] = max(dist[vv[t][i]], dist[t] + 1);
  				if (v[vv[t][i]] == 1) {
  					qq.push(vv[t][i]);
  				}
  			}
  		}
  		q = qq;
  	}

  	// cout << res << endl;
  	if (res % 3 == 1)
  		cout << "Second" << endl;
  	else
  		cout << "First" << endl;
}

Measured memory_bytes: 14324
str = list(input())

ok = True
for i in range(len(str)):
    if i % 2 == 0:
        if str[i] in ["R", "U", "D"]:
            pass
        else:
            ok = False

            
    else:
        if str[i] in ["L", "U", "D"]:
            pass
        else:
            ok = False


if ok:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 2940
using System;
using CompLib.Util;

public class Program
{
    public void Solve()
    {
        var sc = new Scanner();
        long k = sc.NextLong();
        long mod = 0;
        for (int i = 1; i < 10 * k; i++)
        {
            mod *= 10;
            mod += 7;
            mod %= k;
            if (mod == 0)
            {
                Console.WriteLine(i);
                return;
            }
        }

        Console.WriteLine("-1");
    }

    public static void Main(string[] args) => new Program().Solve();
}

namespace CompLib.Util
{
    using System;
    using System.Linq;

    class Scanner
    {
        private string[] _line;
        private int _index;
        private const char Separator = ' ';

        public Scanner()
        {
            _line = new string[0];
            _index = 0;
        }

        public string Next()
        {
            if (_index >= _line.Length)
            {
                string s;
                do
                {
                    s = Console.ReadLine();
                } while (s.Length == 0);

                _line = s.Split(Separator);
                _index = 0;
            }

            return _line[_index++];
        }

        public string ReadLine()
        {
            _index = _line.Length;
            return Console.ReadLine();
        }

        public int NextInt() => int.Parse(Next());
        public long NextLong() => long.Parse(Next());
        public double NextDouble() => double.Parse(Next());
        public decimal NextDecimal() => decimal.Parse(Next());
        public char NextChar() => Next()[0];
        public char[] NextCharArray() => Next().ToCharArray();

        public string[] Array()
        {
            string s = Console.ReadLine();
            _line = s.Length == 0 ? new string[0] : s.Split(Separator);
            _index = _line.Length;
            return _line;
        }

        public int[] IntArray() => Array().Select(int.Parse).ToArray();
        public long[] LongArray() => Array().Select(long.Parse).ToArray();
        public double[] DoubleArray() => Array().Select(double.Parse).ToArray();
        public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();
    }
}

Measured memory_bytes: 27464
#include  <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define inf 1000000007
//P pa(114,514);   ,vector<P>vec(N,0);
//vector<vector<int>> vec(縦, vector<int>(横));
#define REP(i,N) for(int i=0;i<N;i++)
int gcd(int a, int b) {
    if(a>b){
        swap(a,b);
        }
    while(b%a!=0){
        b%=a;
        swap(a,b);
    }
    return a;
}
//cout << setprecision(123);
//a=atoi(S.c_str());
//S=to_string(a);
int main(){
  int n,m,ans=0;
  cin>>n;
  m=log10(n)+1;
  m=floor(m);
  
  if(m%2==1){
    ans=n-pow(10,m-1)+1+(pow(100,(m-1)/2)-1)/11;
  }
  else{
    ans=(pow(100,m/2)-1)/11;
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//using ll = long long;
void p(vector<int> A){rep(i,A.size()){cout << A[i] << " ";}cout << "\n";}

int main(){
    int n;
    cin >> n;
    vector<string> w(n);
    rep(i,n)cin >> w[i];
    char e;//endword
    rep(i,n){
        string s = w[i];
        if(i == 0)e = s[s.size()-1];
        else{
            if(e != s[0]){
                cout << "No" << endl;
                exit(0);
            }
            else e = s[s.size()-1];
        }
       // cout << e;
    }
    sort(w.begin(),w.end());
    rep(i,n-1){
        if(w[i] == w[i+1]){
            cout << "No" << endl;
            exit(0);
            }
    }
    cout << "Yes" << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<utility>
#include<vector>
#include<cmath>
#include<cstring>
#include<cstdio>
#include<time.h>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
const double EPS=1e-10;
using namespace std;
typedef long long ll;
typedef vector<int> vi;
int main(){
	int n;
	int co=0;
	while(cin>>n,n){
		if(co)cout<<endl;
		co++;
		vector<string>s(n);
		vector<int>in(n);
		rep(i,n){
			int a,b,c;
			cin>>s[i]>>a>>b>>c;
			in[i]=a*3+c;
		}
		rep(i,n)for(int j=n-2;j>=i;j--)if(in[j]<in[j+1]){
			swap(s[j],s[j+1]);
			swap(in[j],in[j+1]);
		}
		rep(i,n)cout<<s[i]<<","<<in[i]<<endl;
	}
}

Measured memory_bytes: 1212
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
typedef long long int lld;

const lld N = 200043;
const lld MOD = 1000000007;

lld add(lld x, lld y)
{
    x =((x%MOD)+(y%MOD))%MOD;
    while(x >= MOD) x -= MOD;
    while(x < 0) x += MOD;
    return x;
}

lld mul(lld x, lld y)
{
    return ((x%MOD)*(y%MOD))% MOD;
}

lld binpow(lld x, lld y)
{
    lld z = 1;
    while(y)
    {
        if(y & 1) z = mul(z, x);
        x = mul(x, x);
        y >>= 1;
    }
    return z;
}

lld inv(lld x)
{
    return binpow(x, MOD - 2);
}

lld divide(lld x, lld y)
{
    return mul(x, inv(y));
}

// Combinations

/*
lld fact[N];

void precalc()
{
    fact[0] = 1;
    for(lld i = 1; i < N; i++)
        fact[i] = mul(fact[i - 1], i);
}

lld C(lld n, lld k)
{
    return divide(fact[n], mul(fact[k], fact[n - k]));
}
*/
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    lld t,i,j;
    //cin>>t;
    t=1;
    while(t--)
    {
        lld n,m,x;
        cin>>n>>m>>x;
        lld ar[n];
        lld br[n][m];
        for(i=0;i<n;i++)
        {
            cin>>ar[i];
            for(j=0;j<m;j++)
                cin>>br[i][j];
        }
        lld ans=LLONG_MAX;
        lld mask=(1<<n);
        for(i=0;i<mask;i++)
        {
            lld dp[m]={0};
            lld ctr=0;
            //cout<<i<<" i"<<endl;
            for(j=0;j<n;j++)
            {  // cout<<"1<<j"<<" "<<(1<<j)<<" "<<((1<<j)&i)<<endl;
                if(((1<<j)&i))
                {   //cout<<j<<" j"<<endl;
                    ctr+=ar[j];
                    for(lld k=0;k<m;k++)
                        dp[k]+=br[j][k];
                }
            }
            //cout<<ctr<<endl;
            bool ok=true;
            for(j=0;j<m;j++)
                if(dp[j]<x)
                ok=false;
            if(ok)
                ans=min(ans,ctr);
        }
        if(ans==LLONG_MAX)
            cout<<-1<<endl;
        else
            cout<<ans<<endl;
    }
}





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

int solve(string);

stack <int> st;

int main()
{
  string str;
  while(cin >> str){
    if(str == "+" || str == "-" || str == "*")
      st.push(solve(str));
    else st.push(atoi(str.c_str()));
    
    if(getchar()=='\n'){
      cout << st.top() << endl;
      return 0;
    }
  }
  return 0;
}

int solve(string str){
  int b = st.top();
  st.pop();
  int a = st.top();
  st.pop();
  if(str == "+")return a+b;
  else if(str == "-")return a-b;
  else if(str == "*")return a*b;
}



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

#define FOR(a, b, c) for (int a = (b), _for = (c); a < _for; ++a)
#define REP(a, n) FOR(a, 0, n)
#define x first
#define y second
#define pb push_back
#define pii pair<int, int>
#define ll long long
#define lf double

using namespace std;

const int MAX = (int)1e6 + 5;

int main(){
	int a,b,c;
	scanf ("%d%d%d",&a,&b,&c);
	if (a+b+c>=22) puts ("bust");
	else puts ("win");
	
	
	return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define ff first
#define ss second
#define pb push_back
typedef long long ll;
#define db(x) cerr<<__LINE__<<": "<<#x<<" = "<<(x)<<'\n'
const int inf = 1e9+7;
const int N = 1e6+9;
int A[N];

void solve() {
    int a, b, n;
    cin>>n;
    ll x=0;
    for(int i=0;i<n;++i) {
        cin>>A[i];
        x^=A[i];
    }
    for(int i=0;i<n;++i) {
        ll res=x^A[i];
        cout<<res<<" ";
    }
}
int main() {
    ios_base::sync_with_stdio(0);
    int T=1 ,cas=0;
    while(T--) {
        solve();
    }
    return 0;
}

Measured memory_bytes: 4424
// #include <bits/stdc++.h>
#include <iostream>
#include <string>
#include <cmath>
#include <vector>
#include <algorithm>

using namespace std;

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

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

    sort(A.begin(), A.end());
    sort(B.begin(), B.end());

    int min_mid, max_mid;
    if (N % 2 != 0) {
        int mid = (N) / 2;
        min_mid = A[mid];
        max_mid = B[mid];
    } else {
        min_mid = A[N/2-1]+A[N/2];
        max_mid = B[N/2-1]+B[N/2];
    }

    int res = max_mid - min_mid + 1;
    cout << res << endl;
}


Measured memory_bytes: 4344
#include <bits/stdc++.h>
#define	f first
#define	s second
#define int long long
using namespace	std;
const int INF=LLONG_MAX;
typedef pair<int,int> P;
signed main(){

  vector<int> match;
  P ad[100000];
  int n,t,q,wh[100000];
  cin>>n>>t>>q;
  for(int i=0,a,b;i<n&&cin>>a>>b;i++) ad[i]=P(a,b);
  for(int i=0;i<n-1;i++) if(ad[i].s==1&&ad[i+1].s==2) match.push_back((ad[i].f+ad[i+1].f)/2);
  for(int i=0;i<n;i++){
    if(ad[i].s==1){
      auto it=lower_bound(match.begin(),match.end(),ad[i].f);
      if(it==match.end()) wh[i]=INF;
      else wh[i]=*it;
    }
    else{
      auto it=upper_bound(match.begin(),match.end(),ad[i].f);
      if(it==match.end()) wh[i]=*match.rbegin();
      else if(it==match.begin()) wh[i]=-INF;
      else wh[i]=*(it-1);
    }
  }
  for(int i=0,a;i<q&&cin>>a;i++){
    a--;
    if(ad[a].s==1){
      if(ad[a].f+t<wh[a]) cout<<ad[a].f+t<<endl;
      else cout<<wh[a]<<endl;
    }
    else{
      if(ad[a].f-t>wh[a]) cout<<ad[a].f-t<<endl;
      else cout<<wh[a]<<endl;
    }
  }
  return 0;
}

Measured memory_bytes: 5512
N = int(input())
l = [int(x) for x in input().split()]
l.sort(reverse = True)
ans = 0
for i in range(N-2):
    for j in range(i+1,N-1):
        for k in range(j+1,N):
            if l[i] == l[j] or l[j] == l[k]:
                continue
            if l[i] >= l[j]+l[k]:
                continue
            ans += 1
print(ans)

Measured memory_bytes: 9188
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep1(i, n) for(int i = 1; i <= (int)(n); i++)
#define showmap(is, js, x) {rep(i, is){rep(j, js){cout << x[i][j] << " ";}cout << endl;}}
#define show(x) {for(auto i: x){cout << i << " ";} cout<<endl;}
#define showm(m) {for(auto i: m){cout << m.x << " ";} cout<<endl;}
typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, ll> llP;
ll gcd(int x, int y){ return y?gcd(y, x%y):x;}
ll lcm(ll x, ll y){ return (x*y)/gcd(x,y);}


int main()
{
    int n;
    ll d;
    cin >> n >> d;
    vector<llP> a(n);
    rep(i, n){ cin >> a[i].first >> a[i].second; }


    ll ans = 0;
    rep(i, n){
        ll dist = (a[i].first*a[i].first) + (a[i].second*a[i].second);
        if (dist <= d*d){
            ans++;
        }
    }

    cout << ans << endl;
}



Measured memory_bytes: 6276
#include <iostream>
#include <vector>
#include <queue>
#include <map>
#include <algorithm>
#include <string>
#include <limits.h>

#define ll long long

using namespace std;

int main(){

    string s;
    cin >> s;

    if(s[0] == s[1]){

        char tmp = s[2];

        if(tmp == s[0]){
            cout << "No" << endl;
        }else{
            if(tmp == s[3]){
                cout << "Yes" << endl;
            }else{
                cout << "No" << endl;
            }
        }

    }else{
        char tmp = s[1];
        bool ans = true;

        for(int i = 2; i < 4; i++){
            if(s[i] != tmp && s[i] != s[0]) ans = false;
        }

        if(ans){
            cout << "Yes" << endl;
        }else{
            cout << "No" << endl;
        }
    }



    return 0;
}

Measured memory_bytes: 256
r, c, n = list(map(int, input().split()))

p = []
for i in range(n):
    x1, y1, x2, y2 = list(map(int, input().split()))
    if x1 == 0 or x1 == r or y1 == 0 or y1 == c:
        if x2 == 0 or x2 == r or y2 == 0 or y2 == c:
            if y1 == 0:
                p.append([x1, i])
            elif x1 == r:
                p.append([r + y1, i])
            elif y1 == c:
                p.append([2 * r + c - x1, i])
            else:
                p.append([2 * r + 2 * c - y1, i])

            if y2 == 0:
                p.append([x2, i])
            elif x2 == r:
                p.append([r + y2, i])
            elif y2 == c:
                p.append([2 * r + c - x2, i])
            else:
                p.append([2 * r + 2 * c - y2, i])

p.sort()

t = []

old = -1
for i in range(0, len(p)):
    temp = p[i][1]

    if temp == old:
        t.pop()
        if len(t) == 0:
            old = -1
        else:
            old = t[-1]
    else:
        t.append(temp)
        old = temp
if len(t) > 0:
    print("NO")
else:
    print("YES")


Measured memory_bytes: 34568
parseInt(x) = parse(Int, x)
parseMap(x::Array{SubString{String},1}) = map(parseInt, x)

function main()
  A, B, C, X, Y = parseMap(split(readline()))
  ans = min(A + B, 2C) * min(X, Y)
  if X > Y
    ans += (X - Y) * min(A, 2C)
  end
  if X < Y
    ans += (Y - X) * min(B, 2C)
  end
  println(ans)
end

main()

Measured memory_bytes: 110644
import sys
input = lambda : sys.stdin.readline().rstrip()

n = int(input())
xyh = []
for _ in range(n):
    xyh.append(list(map(int, input().split())))
for cx in range(101):
    for cy in range(101):
        flag = 1
        H = None
        maxh = 10**10
        for x, y, h in xyh:
            if h == 0:
                maxh = min(maxh, abs(x - cx) + abs(y - cy))
            else:
                if H is None:
                    H = h + abs(x - cx) + abs(y - cy)
                    if H > maxh:
                        flag = 0
                        break
                else:
                    if H != h + abs(x - cx) + abs(y - cy):
                        flag = 0
                        break
        if flag and H <= maxh:
            print(cx, cy, H)
            sys.exit()
        

Measured memory_bytes: 42860
#define _CRT_SECURE_NO_WARNINGS
#pragma GCC optimize(3)
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma comment(linker, "/stack:200000000")
#include <bits/stdc++.h>
#define SIZE 200010
#define rep(i, a, b) for (int i = a; i <= b; ++i)
#define ll long long
#define mp make_pair
#define pi acos(-1.0)
#define eps 1e-9
using namespace std;
void io() { ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); }
ll n, m, cnt, ans;
ll a[SIZE];

int main() {
	io(); cin >> n;
	rep(i, 1, n) cin >> a[i];
	ll maxx = 1e18;
	rep(i, 1, 100) {
		ll tmp = 0;
		rep(j, 1, n) {
			tmp += (i - a[j]) * (i - a[j]);
		}
		maxx = min(maxx, tmp);
	}
	cout << maxx;
}

Measured memory_bytes: 256
n = int(input())
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
                pass

    # divisors.sort()
    return divisors

yakusuli = make_divisors(n)

ans = 0

for i in yakusuli:
    if i < n // i - 1:
        ans += n // i - 1

print(ans)

Measured memory_bytes: 3268
#include<bits/stdc++.h>
using namespace std;
queue< long long > q;
vector< long long > lunlun;
map< long long,long long > mp;
int main()
{
    long long n;
    scanf("%lld",&n);
    for(long long i=1;i<=10;i++)  q.push(i),mp[i] = 1;
    int cnt = 0;
    while(!q.empty())
    {
        long long now = q.front();  q.pop();
        lunlun.push_back(now);
        long long nxt = now*10+(now%10);
//        printf("%lld %lld\n",now,nxt);
        if(nxt<=3234566667&&!mp[nxt])                 mp[nxt]=1,q.push(nxt);
        if(nxt-1<=3234566667&&now%10!=0&&!mp[nxt-1])  mp[nxt-1] = 1,q.push(nxt-1);
        if(nxt+1<=3234566667&&now%10!=9&&!mp[nxt+1])  mp[nxt+1] = 1,q.push(nxt+1);
    }
    sort(lunlun.begin(),lunlun.end());
//    printf("%d\n",lunlun.size());
    printf("%lld\n",lunlun[n-1]);
    return 0;
}
/*
3234566667

*/


Measured memory_bytes: 8056
#include <cmath>
#include <stdio.h>

double PI = 3.141592653589;
//ベクトルの定義
struct Vector2D{
	double x;
	double y;
};

//ベクトルの長さを計算する
double get_vector_length( Vector2D v ) {
	return pow( ( v.x * v.x ) + ( v.y * v.y ), 0.5 );
}

//ベクトル内積
double dot_product(Vector2D vl, Vector2D vr) {
	return vl.x * vr.x + vl.y * vr.y;
}

//２つのベクトルABのなす角度θを求める
double AngleOf2Vector(Vector2D A, Vector2D B )
{
	//　※ベクトルの長さが0だと答えが出ませんので注意してください。

	//ベクトルAとBの長さを計算する
	double length_A = get_vector_length(A);
	double length_B = get_vector_length(B);

	//内積とベクトル長さを使ってcosθを求める
	double cos_sita = dot_product(A,B) / ( length_A * length_B );

	//cosθからθを求める
	double sita = acos( cos_sita );	

	//ラジアンでなく0〜180の角度でほしい場合はコメント外す
	sita = sita * 180.0 / PI;

	if(sita > 180){
		sita = 360 - sita;
	}

	return sita;
}

int main()
{
	Vector2D v1,v2,v3;
	double x[3],y[3],xp,yp;
	double sum;
	while(scanf("%lf %lf %lf %lf %lf %lf %lf %lf", &x[0], &y[0], &x[1], &y[1], &x[2], &y[2], &xp, &yp) != EOF){
		v1.x = x[0] - xp;
		v1.y = y[0] - yp;
		v2.x = x[1] - xp;
		v2.y = y[1] - yp;
		v3.x = x[2] - xp;
		v3.y = y[2] - yp;
		sum = AngleOf2Vector(v1, v2) + AngleOf2Vector(v1, v3) + AngleOf2Vector(v3, v2);
		if(sum < 360){
			printf("NO\n");
		}else{
			printf("YES\n");
		}
	}
	return 0;
}

Measured memory_bytes: 1148
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N;
  
  string S;
  map<string, int> count;
  long result = 0;
  
  int i = 0;
  while(i < N) {
    cin >> S;
    sort(S.begin(), S.end());
    if (count[S] > 0 ) {
      result += count[S];
    }
    count[S]++;
    i++;
  }

  cout << result << endl;
}


Measured memory_bytes: 11136
import java.util.*;
import java.lang.*;
import java.math.*;
import java.io.*;

import static java.lang.Math.*;
import static java.util.Arrays.*;

public class Main{

	Scanner sc=new Scanner(System.in);

	int INF=1<<28;
	double EPS=1e-9;

	void run(){
		for(;;){
			int n=5;
			int max=0;
			char c='A';
			for(int i=0; i<n; i++){
				int a=sc.nextInt()+sc.nextInt();
				if(a==0){
					return;
				}
				if(a>max){
					c=(char)('A'+i);
					max=a;
				}
			}
			println(c+" "+max);
		}
	}

	void debug(Object... os){
		System.err.println(Arrays.deepToString(os));
	}

	void print(String s){
		System.out.print(s);
	}

	void println(String s){
		System.out.println(s);
	}

	public static void main(String[] args){
		// System.setOut(new PrintStream(new BufferedOutputStream(System.out)));
		new Main().run();
	}
}

Measured memory_bytes: 12000
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

void init();
void insert(int);
void deleteN();
void deleteFirst();
void deleteLast();
void deleteK(int);
void print();

struct Node{
  int key;
  struct Node *prev, *next;
};

struct Node *nil;

int main(){
  int key,num,i;
  int size = 0;
  char array[20];
  int p = 0;
  int d = 0;

  scanf("%d",&num);
  init();

  for(i = 0;i < num;i++){
    scanf("%s%d",array,&key);
    if(array[0] == 'i'){
      insert(key);
      p++;
      size++;
    }
    else if(array[0] == 'd'){
      if(strlen(array) > 6){
        if(array[6] == 'F'){
          deleteFirst();
        }
        else if(array[6] == 'L'){
          deleteLast();
        }
      }
      else{
        deleteK(key);
        d++;
      }
      size--;
    }
  }
  print();
  return 0;
}

struct Node* listSearch(int key){
  struct Node *cur = nil -> next;
  while(cur != nil && cur -> key != key){
    cur = cur -> next;
  }
  return cur;
}

void init(){
  nil = (struct Node *)malloc(sizeof(struct Node));
  nil -> next = nil;
  nil -> prev = nil;
}

void insert(int key){
  struct Node *a = (struct Node *)malloc(sizeof(struct Node));
  a -> key = key;
  a -> next = nil -> next;
  nil -> next -> prev = a;
  nil -> next = a;
  a -> prev = nil;
}

void deleteN(struct Node *b){
  if(b == nil){
    return;
  }
  b -> prev -> next = b -> next;
  b -> next -> prev = b -> prev;
  free(b);
}

void deleteFirst(){
  deleteN(nil -> next);
}

void deleteLast(){
  deleteN(nil -> prev);
}

void deleteK(int key){
  deleteN(listSearch(key));
}

void print(){
  int count = 0;

  struct Node *cur;
  cur = nil -> next;
  while(1){
    if(cur == nil){
      break;
    }
    if(count++ > 0){
      printf(" ");
    }
    printf("%d",cur -> key);
    cur = cur -> next;
  }
  printf("\n");
}



Measured memory_bytes: 32940
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for (int i=0;i<(n);i++)
//#define int long long  
int main(){
    string s;
    cin >> s;
    int Ans =0;
    REP(i,6){
        if(s[i]=='1')Ans++;
    }
    cout << Ans  << endl;
	return 0;
}


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

int main(){

  string s;
  bool f=false;

  cin>>s;
  for(int i=0;i<s.size();i++){
    if(s[i]=='9') f=true;
  }

  if(f) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;


  return 0;
}


Measured memory_bytes: 256
n,m=map(int,input().split())
cor, wro = 0,0
solved = [False]*(n+1)
pen = [0]*(n+1)
for i in range(m):
    p,s = input().split()
    p = int(p)
    if s == 'AC' and not solved[p]:
        cor+=1
        solved[p]=True
    elif s == 'WA' and not solved[p]:
        pen[p]+=1
for i in range(n+1):
  if solved[i]:
    wro+=pen[i]
print(cor,wro)

Measured memory_bytes: 4596
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int main(){
  vector<int> ans(3);
  for(int i=0;i<3;i++)cin >> ans.at(i);
  sort(ans.begin(),ans.end());
  cout << ans.at(0) + ans.at(1) +ans.at(2)*10;
}


Measured memory_bytes: 3580
#include<stdio.h>

int main(){
    int a,b,sum,i;
    while(scanf("%d %d",&a,&b)!=-1){
        sum=a+b;
        for(i=0;sum!=0;i++){
            sum=(int)sum/10;
        } 
        printf("%d\n",i);
     }
    
    return 0;
}

Measured memory_bytes: 600
N = int(input())

JP = [0]
BTC = [0]

for _ in range(N):
    L = input().split()
    if L[1] == "JPY":
        JP.append(float(L[0]))
    else:
        BTC.append(float(L[0]))
print(sum(JP) + sum(BTC) * 380000)


Measured memory_bytes: 3060
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Practice
{
    class Program
    {
        static void Main(string[] args)
        {
            //ここから
            int n = int.Parse(Console.ReadLine());
            string str = Console.ReadLine();

            int count = 0;

            for (int i = 0; i < n - 2; i++)
            {
                if (str[i] == 'A' && str[i + 1] == 'B' && str[i + 2] == 'C')
                {
                    count++;
                }
            }

            Console.WriteLine(count);

            //ここまで
        }
    }
}


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

#define pb push_back
#define ff first
#define ss second

const long long MAXN = 1e5 + 21, inf = 1e18 + 21, LG = 20;

int n;
map <int, int> mp;
int a[MAXN];
long long ans;

int main() {
    ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        mp[a[i]] = 0;
    }

    int cnt = 0;
    for (auto &y: mp)
        y.ss = cnt++;

    for (int i = 0; i < n; i++)
        ans += (i % 2 != mp[a[i]] % 2);
    
    cout << ans / 2 << '\n';
    return 0;
}


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

using namespace std;
using ll = long long;

int main() {
  ll W, H, x, y;
  cin >> W >> H >> x >> y;
  double s = double(W*H)/2;
  bool two = (x == double(W)/2) && (y == double(H)/2) ? 1 : 0;
  cout << fixed << setprecision(10) << s << " " << two << endl;
}


Measured memory_bytes: 256
import math
 
a, b, t = map(int, input().strip().split())
 
t = math.radians(t)
h = b * math.sin(t)
l = a + b + math.sqrt(a*a + b*b - 2*a*b*math.cos(t))
s = a * h / 2
print(s)
print(l)
print(h)

Measured memory_bytes: 7872
x = int(input())

n = [int(e) for e in input().split()]

def cal(n):
    count = 0
    for i in range(len(n)):
        if n[i] % 2 == 0:
            if n[i] % 3 == 0 or n[i] % 5 == 0:
                count += 1
        else:
            count += 1
    if count == len(n):
        print("APPROVED")
    else:
        print("DENIED")
cal(n)

Measured memory_bytes: 38256
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>

using namespace std;

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

	int ans = 0;

	for (int i = 0; i < n; i++) {
		cin >> h;

		if (h >= k) {
			ans++;
		}
	}

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin >> N;
  vector<int> vec(4);
  vec[0] = N/1000;
  vec[1] = (N/100) % 10;
  vec[2] = (N%100) / 10;
  vec[3] = N%10;
  for(int i=0;(1<<3);i++){
    bitset<3> bit(i);
    int ans = vec[0];
    for(int j=0;j<3;j++){
      if(bit.test(j)) ans += vec[j+1];
      else ans -= vec[j+1];
    }
    if(ans == 7){
      cout << vec[0];
      for(int j=0;j<3;j++){
        if(bit.test(j)) cout << "+";
        else cout << "-";
        cout << vec[j+1];
      }
      cout << "=7" << endl;
      break;
    }
  }
}

Measured memory_bytes: 3624
//A.cpp
#include <iostream>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <vector>
#include <queue>
#include <math.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;

int main(){
  double a,b,x;
  cin >> a >> b >> x;
  double ans;
  if(x <= a*a*b/2) ans = atan((a*b*b)/(2*x));
  else ans = atan(2*(a*a*b-x)/(a*a*a));
  printf("%lf\n", ans*180/acos(-1));
  return 0;
}


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

s = 0
m = 10**9+7
same = True
for _ in range(n):
    a,b = map(int, input().split())
    if a > b:
        m = min(m, b)
    s += a
    same &= a==b
if same:
    m = s
print(s-m)


Measured memory_bytes: 3060
/*! path: /home/ts3min/work/tspro/src/contest/atcoder/msol2020/d.ts */!function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=0)}([function(e,t,n){"use strict";(function(e){var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.main=void 0;const o=r(n(2)),i=n(3);function u(e){const t=i.getNextInt(e),n=t(),r=[];for(let e=0;e<n;e++)r[e]=BigInt(t());console.log(function({N:e,A:t}){let n=BigInt(1e3);for(let r=1;r<e;r++)if(t[r-1]<t[r]){n+=n/t[r-1]*(t[r]-t[r-1])}return n}({N:n,A:r}).toString())}if(t.main=u,n.c[n.s]===e){u(o.default.readFileSync("/dev/stdin","utf8"))}}).call(this,n(1)(e))},function(e,t){e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),e.webpackPolyfill=1),e}},function(e,t){e.exports=require("fs")},function(e,t,n){"use strict";function*r(e){const t=e.split(/\s+/);for(const e of t)yield e}Object.defineProperty(t,"__esModule",{value:!0}),t.getNextBigInt=t.getNextInt=t.getNext=t.getIteratorWithParser=t.getIterator=void 0,t.getIterator=r,t.getIteratorWithParser=function*(e,t){const n=e.split(/\s+/);for(const e of n)yield t(e)},t.getNext=function(e){const t=r(e);return()=>t.next().value},t.getNextInt=function(e){const t=r(e);return()=>parseInt(t.next().value)},t.getNextBigInt=function(e){const t=r(e);return()=>BigInt(t.next().value)}}]);
//# sourceMappingURL=submit.js.map

Measured memory_bytes: 29712
#include <bits/stdc++.h>
#define ll long long
#define INF INT_MAX 
#define mod 1000000007
using namespace std;
vector<bool> seq(100005,true);
void prime(){
    seq[0] = false;
    seq[1] = false;

    for(int i=2;i<10005;i++){
        if(seq[i]==true){
            for(int j=i*i;j<100005;j+=i){
                seq[j] = false;
            }
        }
    }
}
int main(){
    int N;
    cin >> N;
    int l,r;
    prime();
    vector<int> count(100005,0);
    for(int i=0;i<100005;i++){
        if(seq[i]==true && seq[(i+1)/2] == true ){
            count[i]++;
        }
    }
    for(int i=1;i<100005;i++){
        count[i] = count[i] + count[i-1];
    }
    
    for(int i=0;i<N;i++){
        cin >> l >> r;
        cout << count[r]-count[--l] << endl;
    }
}

Measured memory_bytes: 1024
from collections import deque

N, M = map(int, input().split())
X = [[] for _ in range(N)]
for i in range(M):
    a, b = map(int, input().split())
    X[a-1].append(b-1)
    X[b-1].append(a-1)

checked = [False for _ in range(N)]
queue = deque([0])
checked[0] = True
ans = [0 for _ in range(N)]
while queue:
    now = queue.popleft()
    for i in X[now]:
        if not checked[i]:
            ans[i] = now +1
            queue.append(i)
            checked[i] = True
for i in range(N):
    if i == 0:
        print('Yes')
    else:
        print(ans[i])

Measured memory_bytes: 37740
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<set>
#include<unordered_map>
#include<iomanip>
#include<bitset>
#define mod 1000000007
using namespace std;
typedef long long ll;
#define chmax(a,b) a=max(a,b)
#define chmin(a,b) a=min(a,b)
#define mad(a,b) a=(a+b)%mod
#define mul(a,b) a=a*b%mod
#define N 100010
ll fac[N],ivf[N],inv[N];
ll C(ll n,ll k){
    return fac[n]*ivf[k]%mod*ivf[n-k]%mod;
}
ll P(ll n,ll k){
    return fac[n]*ivf[n-k]%mod;
}

ll n;
vector<ll> g[N];
ll dfs(ll x,ll from){
    ll res=1;
    for(auto y:g[x])if(y!=from){
	res+=dfs(y,x);
    }
    return res;
}

ll dp[5010][5010];
int main(){
    fac[0]=ivf[0]=inv[1]=1;
    for(int i=1;i<N;i++){
	if(i>1)inv[i]=(mod-(mod/i*inv[mod%i]%mod))%mod;
	fac[i]=fac[i-1]*i%mod;
	ivf[i]=ivf[i-1]*inv[i]%mod;
    }
    cin>>n;
    for(int i=0;i<n-1;i++){
	ll a,b; cin>>a>>b;
	g[a].push_back(b);
	g[b].push_back(a);
    }
    vector<ll> centroid;
    for(int i=1;i<=n;i++){
	ll ma=0;
	for(auto y:g[i]){
	    chmax(ma,dfs(y,i));
	}
	if(ma<=n/2)centroid.push_back(i);
    }
    if(centroid.size()==2){
	cout<<fac[n/2]*fac[n/2]%mod<<endl;
	return 0;
    }
    vector<ll> siz;
    for(auto y:g[centroid[0]]){
	siz.push_back(dfs(y,centroid[0]));
    }
    for(int i=0;i<5010;i++)dp[0][i]=0;
    dp[0][0]=1;
    for(int i=0;i<siz.size();i++){
	for(int j=0;j<5010;j++)dp[i+1][j]=0;
	for(int j=0;j<5010;j++){
	    for(int k=0;k<=siz[i]&&j+k<5010;k++){
		ll cur=C(siz[i],k)*P(siz[i],k)%mod;
		mad(dp[i+1][j+k],dp[i][j]*cur);
	    }
	}
    }
    ll ans=0;
    for(int i=0;i<=n;i++){
	ll cur=dp[siz.size()][i]*fac[n-i]%mod;
	if(i%2==0)mad(ans,cur);
	else mad(ans,-cur);
    }
    if(ans<0)ans+=mod;
    cout<<ans<<endl;
}



Measured memory_bytes: 201344
import java.util.Random;
import java.util.Scanner;
class Main {
  public static void main(String[] args) {
    Random rand = new Random();
    Scanner stdIn = new Scanner(System.in);

    int[][] a = new int [100000][2];
    int i = 0;
    while(true) {
      int h = stdIn.nextInt();
      int w = stdIn.nextInt();

      if (h == 0 && w == 0)
      break;
      a[i][0] = h;
      a[i++][1] = w;
    }

    for (int j = 0; j < i; j++) {
      for (int k = 0; k < a[j][0]; k++) {
        for (int l = 0; l < a[j][1]; l++) {
           if ((k+l)%2 == 0) {
             System.out.print("#");
           } else {
             System.out.print(".");
           }
        }
        System.out.println();
      }
      System.out.println();
    }
  }
}


Measured memory_bytes: 37424
#include<iostream>
using namespace std;
int a,b,c,d,e,n,mx;
int t [1002][1002];
char moji;
int min(int a,int b,int c){
  if(a<=b&&a<=c)return a;
  if(b<=a&&b<=c)return b;
  if(c<=a&&c<=b)return c;
}
int main(){
  while(true){
    cin>>n;
    if(n==0)break;
    for(int i=0;i<1002;i++){
      for(int j=0;j<1002;j++){
	t[i][j]=-1;
      }
    }
    for(int i=0;i<1002;i++)t[i][0]=0;
    for(int i=0;i<1002;i++)t[0][i]=0;
    for(int i=1;i<=n;i++){
      for(int j=1;j<=n;j++){
	cin>>moji;
	if(moji=='*'){
	  t[i][j]=0;
	}
      }
    }
    mx=0;
    for(int i=1;i<=n;i++){
      for(int j=1;j<=n;j++){
	if(t[i][j]==-1)t[i][j]=min(t[i-1][j],t[i][j-1],t[i-1][j-1])+1;
	if(t[i][j]>mx)mx=t[i][j];
      }
    }
    cout<<mx<<endl;
  }
  return 0;

}

Measured memory_bytes: 5080