akhauriyash/Code-Regression huggingface dataset:
/*
AizuOnline A1227
Title 77377
*/
#include <stdio.h>
// Select Below
//#include <stdlib.h>
#include <string.h>
//#include <float.h>
//#include <math.h>
//#include <limits.h>
//Global data section
int n;
char dict[100][51];
char seq[301];
char result[301];
int  rlen;
int  inputlen;
//
char alpha2num(char a)
{
        if(a < 'p')
                return('2'+(a-'a')/3);
        if(a < 't')
                return('7');
        if(a < 'w')
                return('8');
        else if(a <= 'z')
                return('9');
        else
                return('0');
}
int strncmp_keitai(char *wd,char *sq,int c)
{
        int i;
        for(i=0;i<c;i++)
                if(!sq[i] || alpha2num(wd[i])!=sq[i])
                        return(-1);
        return(0);  //matched
}
void print_conv(char * s)
{
        int i,j,len,sp;
        char d2[52];

        if(!s[0])
        {    
                for(i=0;i<rlen;i++)
                        printf("%c",result[i]);
                printf(".\n");
                return;
        }
        for(i=0;i<n;i++)
        {
                len=strlen(&dict[i][0]);
                if(0==strncmp_keitai(&dict[i][0],s,len))
                {
                        if(s==seq)
                        {        strcpy(d2,&dict[i][0]);
                                
                        }
                        else
                        {
                                d2[0]=' ';d2[1]='\0';
                                strcat(d2,&dict[i][0]);
                                
                        }
                        
                        for(j=0;j<strlen(d2);j++)
                                result[rlen+j]=d2[j];
                        rlen += strlen(d2);
                        print_conv(s+len);
                        rlen -= strlen(d2);
                }     
        }
}
print_seq()
{
        printf("SEQ:%s\n",seq);
}
print_dict()
{
        int i;
        for(i=0;i<n;i++)
                printf("%d:%s\n",i,&dict[i][0]);
}
main()
{
        int i;

        while(EOF!=scanf("%d",&n) && n)
        {
                for(i=0;i<n;i++)
                        scanf("%s\n",&dict[i][0]);
                scanf("%s\n",seq);
                inputlen=strlen(seq);
                rlen=0;
                //print_seq();
                //print_dict();
                print_conv(seq);
                printf("--\n");
        }
return(0);
}

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

int main(){
    int n;
    cin >> n;
    int p[n];
    for (int i = 0; i < n; i++) {
        cin >> p[i];
    }

    int ans = 0;
    for (int i = 0; i < n; i++) {
        if ( p[i] != i+1 ) {
            ans++;
        }
    }

    if ( ans == 0 || ans == 2 ) {
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
    int A, B, C;
    cin >> A >> B >> C;
    bool ok = false;
    for (int i = 1; i < B; i++) {
        if (A*i % B == C) ok = true;
    }
    if (ok)cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#define ll long long
using namespace std;

int main() {
	ll n, m;
	ll ans = 0;
	cin >> n >> m;
		if (2 * n > m) {
			ans += m / 2;
		} else {
			ans += n;
			m -= n * 2;
			ans += m / 4;
		}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
import core.bitop, std.algorithm, std.ascii, std.bigint, std.conv, std.math,
    std.functional, std.numeric, std.range, std.stdio, std.string, std.random,
    std.typecons, std.container, std.format;

// dfmt off
T lread(T = long)(){return readln.chomp.to!T();}
T[] lreads(T = long)(long n){return generate(()=>readln.chomp.to!T()).take(n).array();}
T[] aryread(T = long)(){return readln.split.to!(T[])();}
void scan(TList...)(ref TList Args){auto line = readln.split();
foreach (i, T; TList){T val = line[i].to!(T);Args[i] = val;}}
alias sread = () => readln.chomp();enum MOD = 10 ^^ 9 + 7;
alias PQueue(T, alias less = "a<b") = BinaryHeap!(Array!T, less);
// dfmt on

void main()
{
    auto S = sread();
    auto T = "ACGT";
    auto U = "TGCA";
    foreach (i; 0 .. 4)
    {
        if (S[0] == T[i])
        {
            writeln(U[i]);
            return;
        }
    }
}


Measured memory_bytes: 256
import java.util.*;class Main{public static void main(String[]_){int n=1000002,a[]=new int[n],i,j,m;for(i=0;i<n;)a[i]=i++;for(i=1;i++<n/2;){if(a[i]<1)continue;m=0;for(j=i;++j<n;){if(a[j]<1)continue;if(a[j]%i<1)a[j]=0;if(a[j]>0)m=j;}if(a[m]<=i*i)break;}for(i=1,a[i]=j=0;++i<n;)a[i]=a[i]>0?++j:j;for(Scanner S=new Scanner(System.in);S.hasNext();System.out.println(a[S.nextInt()]));}}

Measured memory_bytes: 16000
#include <bits/stdc++.h>
#define REP(i,s,e) for(int i=(s); i<(e);i++)
#define rep(i,n) REP(i,0,n)
#define rep1(i,n) REP(i,1,n)
#define repe(i,n) for(auto &&i:n)
#define all(v) (v).begin(),(v).end()
#define fastcin() cin.tie(0);ios::sync_with_stdio(false)
using namespace std;
using LL = long long;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int INF = 1e9;
const LL LLINF = 1e16;

LL extgcd(LL a, LL b, LL &x, LL &y) {
    if (b == 0) {
        x = 1;
        y = 0;
        return a;
    }
    LL g = extgcd(b, a % b, x, y);
    LL nextx = y, nexty = x-(a/b)*y;
    x = nextx; y = nexty;
    return g;
}

LL fact[200010];
LL invfact[200010];
const LL mod = 1e9 + 7;

LL nCr(int n, int r){
    LL ret = fact[n];
    (ret *= invfact[n-r]) %= mod;
    (ret *= invfact[r]) %= mod;
    return ret;
}

signed main(){
  	cin.tie(0);
    ios::sync_with_stdio(0);
    cout<<fixed<<setprecision(15);

    int H, W, A, B;
    cin >> H >> W >> A >> B;
    fact[0] = 1;
    for(LL i=1; i<=200000; i++){
        fact[i] = (fact[i-1] * i) % mod;
    }
    for(LL i=0; i<=200000; i++){
        LL x, y;
        LL g = extgcd(fact[i], mod, x, y);
        while(x < 0) x += mod;
        x %= mod;
        invfact[i] = x;
    }

    LL ans = 0;
    for(int i=B; i<W; i++){
        LL tmp = nCr((H-A-1)+i, H-A-1);
        (tmp *= nCr((A-1)+(W-i-1), A-1)) %= mod;
        (ans += tmp) %= mod;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3328
n = int(input())
P, Q = [], []
for i in range(0, n):
	a, b = map(int, input().split())
	P.append([a, b])
	Q.append([b, a])
P.sort()
Q.sort()
dist = 20000**2+20000**2
for p in range(0, n-1):
	temp = (P[p][0]-P[p+1][0])**2+(P[p][1]-P[p+1][1])**2
	if temp<dist: dist = temp
for q in range(0, n-1):
	temp = (Q[q][0]-Q[q+1][0])**2+(Q[q][1]-Q[q+1][1])**2
	if temp<dist: dist = temp
print(dist)



Measured memory_bytes: 126032
import java.util.*;

public class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int A[] = new int[N];
		Map<Integer, Integer> map = new HashMap<Integer, Integer>();
		long ans = 1;
		for(int i = 0; i < N; i++) {
			A[i] = sc.nextInt();
			if(A[i] > N - 1) {
				System.out.println(0);
				return;
			}
			if(N % 2 == 1) {
				if(map.containsKey(A[i])){
					if(map.get(A[i]) == 1 && A[i] != 0) {
						map.put(A[i], 2);
						ans = ans * 2 % 1000000007;
					} else {
						System.out.println(0);
						return;
					}
				} else {
					map.put(A[i], 1);
				}
			} else {
				if(A[i] == 0) {
					System.out.println(0);
					return;
				}
				if(map.containsKey(A[i])){
					if(map.get(A[i]) == 1) {
						map.put(A[i], 2);
						ans = ans * 2 % 1000000007;
					} else {
						System.out.println(0);
						return;
					}
				} else {
					map.put(A[i], 1);
				}
			}
		}
		System.out.println(ans);
	}
}


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

using namespace std;
typedef long long ll;
const ll inf = (1 << 30) - 1;
const ll infll = (1LL << 61) - 1;
const ll mod = 1e9 + 7;
#define REP(i, o, n) for (ll i = o; i < n; i++)
#define rep(i, n) REP(i, 0, n)

ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }

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

void actual() {
    ll a, b;
    cin >> a >> b;
    string imp = "IMPOSSIBLE";

    if ((a + b) % 2 != 0) {
        cout << imp << endl;
    } else {
        ll k = 1;
        while (true) {
            if (abs(a - k) == abs(b - k)) {
                cout << k << endl;
                break;
            }
            k++;
        }
    }
}

int main() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    actual();
    return 0;
}


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

int main() {
  int a,b,c,d;
  cin>>a>>b>>c>>d;
  while(1){
    c-=b;
    if(c<=0){
      cout<<"Yes"<<endl;
      break;
    }
    a-=d;
    if(a<=0){
      cout<<"No"<<endl;
      break;
    }
  }
}

Measured memory_bytes: 3608
#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
#include <iterator>
using namespace std;

bool check(const vector<string>& s)
{
    int h = s[0].size();
    int w = s.size();

    map<string, vector<int> > index;
    for(int i=0; i<h; ++i){
        string t(w, ' ');
        for(int j=0; j<w; ++j)
            t[j] = s[j][i];
        index[t].push_back(i);

        reverse(t.begin(), t.end());
        index[t].push_back(i);
    }

    bool isSame = false;
    for(auto& p : index){
        auto& v = p.second;
        if(v.size() % 2 != 0)
            return false;
 
        sort(v.begin(), v.end());
        v.erase(unique(v.begin(), v.end()), v.end());
 
        if(v.size() % 2 != 0){
            if(isSame)
                return false;
            isSame = true;
        }

    }
    return true;
}

bool solve(const vector<string>& s, vector<bool>& isUsed, vector<int>& index)
{
    int n = s.size();
    if(index.empty() && n % 2 != 0){
        for(int i=0; i<n; ++i){
            index.push_back(i);
            isUsed[i] = true;
            if(solve(s, isUsed, index))
                return true;
            isUsed[i] = false;
            index.pop_back();
        }
        return false;
    }

    int i = 0;
    while(i < n && isUsed[i])
        ++ i;

    if(i == n){
        vector<string> t(n);
        for(int j=0; j<n; ++j){
            if(j % 2 == 0)
                t[j/2] = s[index[n-1-j]];
            else
                t[n-1-j/2] = s[index[n-1-j]];
        }
        return check(t);
    }

    index.push_back(i);
    isUsed[i] = true;
    for(int j=i+1; j<n; ++j){
        if(!isUsed[j]){
            index.push_back(j);
            isUsed[j] = true;
            if(solve(s, isUsed, index))
                return true;
            isUsed[j] = false;
            index.pop_back();
        }
    }
    isUsed[i] = false;
    index.pop_back();

    return false;
}

int main()
{
    int h, w;
    cin >> h >> w;
    vector<string> s(h);
    for(int i=0; i<h; ++i)
        cin >> s[i];

    vector<int> index;
    vector<bool> isUsed(h, false);
    if(solve(s, isUsed, index))
        cout << "YES" << endl;
    else
        cout << "NO" << endl;

    return 0;
}


Measured memory_bytes: 256
let split str delim =
  let rec doit s acc =
    match
      try Some (String.index s delim)
      with _ -> None
    with
    | None -> s :: acc
    | Some i ->
        let s1 = String.sub s 0 i in
        let s2 = String.sub s (i + 1) (String.length s - String.length s1 - 1) in
        doit s2 (s1 :: acc)
  in
  List.rev (doit str [])

let distance (x1, y1) (x2, y2) =
  sqrt ((x1 -. x2)*.(x1 -. x2) +. (y1 -. y2)*.(y1 -. y2))

let () =
  let l = read_line () in
  match List.map float_of_string (split l ' ') with
  | [] | [_] | _::_::[] | _::_::_::[] -> exit 1
  | x1 :: y1 :: x2 :: y2 :: _ -> Printf.printf "%f\n" (distance (x1, y1) (x2, y2))

Measured memory_bytes: 2212
from heapq import*
import sys
r=sys.stdin.readline
def g(n,E,S,G):
 F=[1e7]*-~n;F[S]=0;H=[[0,S]]
 while H:
  c,u=heappop(H)
  if u==G:return c
  for f,v in E[u]:
   t=c+f
   if t<F[v]:F[v]=t;heappush(H,[t,v])
 return-1
def s(n,k):
 E=[[]for _ in[0]*-~n]
 for _ in[0]*k:
  f=r();p=map(int,f[2:].split())
  if'0'==f[0]:print(g(n,E,*p))
  else:c,d,e=p;E[c]+=[(e,d)];E[d]+=[(e,c)]
for e in iter(r,'0 0\n'):s(*map(int,e.split()))


Measured memory_bytes: 6308
#include <iostream>
#include <string>
#include <map>
using namespace std;
int main(){
  int n;
  while(cin >> n, n){
    string s;
    map<char , int> M;
    M['l'] = 0;
    M['r'] = 0;
    bool f = false;
    int ans = 0;
    for(int i = 0; i < n; ++i){
      cin >> s;
      if(s[1] == 'u') ++M[s[0]];
      if(s[1] == 'd') --M[s[0]];
      if((!f) && M['l'] && M['r']){
	f = true;
	++ans;
      }
      if(f && M['l'] == 0 && M['r'] == 0){
	++ans;
	f = false;
      }
    }
    cout << ans << endl;
  }
  return 0;
}

Measured memory_bytes: 3116
#include <iostream>
#include <sstream>
#include <string>
#include <cstring>
#include <vector>
#include <algorithm>
#include <tuple>
#include <queue>
#include <set>
#include <cstdio>
#include <climits>
#include <cmath>
#include <array>
#include <functional>
#include <sstream>
#include <list>
#include <set>
const int MOD=1000000007;
const int INF=1000000000;
using namespace std;
typedef long long ll;
typedef vector<int> vi;
const double eps=1e-9;
const int inf=1e9;
typedef pair<int,int> P;

int n;
int syaku[100010];
int main(int argc,char const* argv[])
{
  cin >> n;
  memset(syaku,0,sizeof(syaku));
  for(int i=0;i<n;i++)
    {
      int l,r;
      cin >> l >> r;
      syaku[l]++;
      syaku[r+1]--;
    }
  for(int i=1;i<100010;i++)
    {
      syaku[i]+=syaku[i-1];
    }
  int ans=0;
  for(int i=0;i<=n+1;i++)
    {
      if((i-1)<=syaku[i])
	{
	  ans=i-1;
	}
    }
  cout << ans << endl;
  return 0;
}



Measured memory_bytes: 3468
#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
const int INF=1e9,MOD=1e9+7,ohara=1e6+10;
const ll LINF=1e18;
using namespace std;

#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(int i=(a);i<(b);i++)
#define rrrep(i,a,b) for(int i=(a);i>=(b);i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout<<(x)<<endl
#define doublecout(a) cout<<fixed<<setprecision(15)<<a<<endl;
#define Cerr(x) cerr<<(x)<<endl
#define fi first
#define se second
#define P pair<ll,ll> 
#define m_p make_pair
#define V vector<ll> 
#define U_MAP unordered_map<ll,ll>

ll n,cnt,ans,a,b,c,d,tmp,tmpp,m,h,w,y,sum,pos;
ld doua;
int dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};
//int dy[]={-1,0,1,-1,1,-1,0,1};
//int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"),s;
bool fl;
struct edge{int to,cost;};
ll x[1000][1000];
map<ll,ll> rui;

//-------------------------↓↓↓↓↓↓------------------------

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

    cin>>n>>d;
    rep(i,n)rep(j,d)cin>>x[i][j];
    cnt=1;
    rep(i,ohara){
        rui[cnt*cnt]=1;
        cnt++;
        if(cnt==1000)break;
    }
    rep(i,n){
        rrep(j,i+1,n){
            if(i==j)continue;
            ll dis=0;
            rep(k,d){
                dis+=abs(x[i][k]-x[j][k])*abs(x[i][k]-x[j][k]);
            }
            if(rui[dis])ans++;
        }
    }
    Cout(ans);
    return 0;
}


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

// @@ !! LIM()

int main(/* int argc, char *argv[] */) {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout << setprecision(20);

  ll x, a, b; cin >> x >> a >> b;
  if (abs(x - a) < abs(x - b)) {
    cout << "A\n";
  }else {
    cout << "B\n";
  }

  return 0;
}



Measured memory_bytes: 3644
// A

#include <bits/stdc++.h>
using ll = long long;
using namespace std;
ll mod=1e9+7;
#define pa(x,n) for(ll i=0;i<n;i++){cout<<(x[i])<<" \n"[i==n-1];};

int main(){
  int K,X;
  cin>>K>>X;
  if (K*500 >= X) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int N = Integer.parseInt(sc.next());
        long T = Long.parseLong(sc.next());
        long[] t = new long[N];
        long stop = 0;
        
        t[0] = Long.parseLong(sc.next());
        for(int i=1; i<N; i++) {
            t[i] = Long.parseLong(sc.next());
            if(t[i] - t[i-1] > T) {
                stop += t[i] - t[i-1] - T;
            }
        }
        long sum = t[N-1]+T;
        System.out.println(sum - stop);
        
    }   
}


Measured memory_bytes: 50328
#include<bits/stdc++.h>
#define INF 1e9
using namespace std;
typedef pair<char,int> P;
P L[60000],R[60000];
int partition(P A[], int p, int r){
    int i;
    P t,x;
    x=A[r];
    i=p-1;
    for(int j=p;j<r;j++){
        if(A[j].second<=x.second){
            i++;
            swap(A[i],A[j]);
        }
    }
    swap(A[i+1],A[r]);
    return i+1;
}

void quickSort(P A[], int p, int r){
    if(p<r){
        int q=partition(A,p,r);
        quickSort(A,p,q-1);
        quickSort(A,q+1,r);
    }
    return ;
}

void merge(P C[], int left, int mid, int right){
    int n1=mid-left;
    int n2=right-mid;
    for(int i=0;i<n1;i++){
        L[i]=C[left+i];
    }
    for(int i=0;i<n2;i++){
        R[i]=C[mid+i];
    }
    L[n1].second=R[n2].second=INF;
    int i=0,j=0;
    for(int k=left;k<right;k++){
        if(L[i].second<=R[j].second){
            swap(C[k],L[i]);
            i++;
        }
        else{
            swap(C[k],R[j]);
            j++;
        }
    }
}
void mergeSort(P C[], int left, int right){
    if(left+1<right){
        int mid=(left+right)/2;
        mergeSort(C,left,mid);
        mergeSort(C,mid,right);
        merge(C,left,mid,right);
    }
    return ;
}

int main(){
    P A[100000],C[100000];
    int n;
    cin>>n;
    char a;
    int b;
    for(int i=0;i<n;i++){
        cin>>a>>b;
        A[i].first=a;
        A[i].second=b;
        C[i].first=a;
        C[i].second=b;
    }
    quickSort(A,0,n-1);
    mergeSort(C,0,n);
    bool flag=true;
    for(int i=0;i<n;i++){
        if(A[i]!=C[i]) flag=false;
    }
    if(flag) cout<<"Stable"<<endl;
    else cout<<"Not stable"<<endl;
    for(int i=0;i<n;i++){
        cout<<A[i].first<<" "<<A[i].second<<endl;
    }
    
    return 0;
}



Measured memory_bytes: 5444
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;

public class Main {
	static boolean debug = false;

	public static void main(String[] args) throws IOException {

		UserScanner scan = new UserScanner();
		PrintWriter pwriter = new PrintWriter(System.out);

		Geometry geom = new Geometry();

		int q = scan.nextInt();
		for (int i = 0; i < q; i++) {
			int x0 = scan.nextInt();
			int y0 = scan.nextInt();
			int x1 = scan.nextInt();
			int y1 = scan.nextInt();
			geom.setBaseLine(new Point(x1 - x0, y1 - y0));
			int x2 = scan.nextInt();
			int y2 = scan.nextInt();
			int x3 = scan.nextInt();
			int y3 = scan.nextInt();
			Point ans = geom.rotateBaseX(new Point(x3 - x2, y3 - y2), true);
			if (ans.x == 0)
				pwriter.println("1");
			else if (ans.y == 0)
				pwriter.println("2");
			else
				pwriter.println("0");
		}
		pwriter.flush();

		scan.close();
		System.exit(0);
	}
}

class Point {
	public double x, y;

	public Point(double x, double y) {
		this.x = x;
		this.y = y;
	}

}

class Geometry {
	double sin, cos;

	public void setBaseLine(Point v) {
		double t2 = v.x * v.x + v.y * v.y;
		sin = v.y / Math.sqrt(t2);
		cos = v.x / Math.sqrt(t2);
	}

	public boolean isSameLine(Point p0, Point p1, Point p2) {
		if ((p1.x - p0.x) * (p2.y - p0.y) == (p2.x - p0.x) * (p1.y - p0.y))
			return true;
		else
			return false;
	}

	public Point rotateBaseX(Point p, boolean direction) {
		if (direction)
			return new Point(round(p.x * cos + p.y * sin), round(-p.x * sin + p.y * cos));
		else
			return new Point(round(p.x * cos - p.y * sin), round(p.x * sin + p.y * cos));
	}

	private double round(double d) {
		return (double) Math.round(d * 1000000000) / 1000000000;
	}

}

class UserScanner {
	private final InputStream in = System.in;
	private final byte[] buffer = new byte[1024];
	private int ptr = 0;
	private int buflen = 0;

	private boolean read() throws IOException {
		ptr = 0;
		buflen = in.read(buffer);
		if (buflen <= 0)
			return false;
		else
			return true;
	}

	private byte getByte() throws IOException {
		if (ptr >= buflen)
			read();
		if (isCtlSpace(buffer[ptr])) {
			return -1;
		} else
			return buffer[ptr++];
	}

	private void skipCtlSpace() throws IOException {
		if (ptr >= buflen)
			read();
		if (isCtlSpace(buffer[ptr])) {
			ptr++;
			skipCtlSpace();
		}
	}

	private boolean isCtlSpace(byte b) {
		if (b <= ' ' || b > '~')
			return true;
		else
			return false;
	}

	public void close() throws IOException {
		in.close();
	}

	public String next() throws IOException {
		skipCtlSpace();
		StringBuilder sb = new StringBuilder();
		byte b;
		while ((b = getByte()) != -1) {
			sb.appendCodePoint(b);
		}
		return sb.toString();
	}

	public int nextInt() throws IOException {
		skipCtlSpace();
		int n = 0;
		boolean minus = false;
		byte b;
		while ((b = getByte()) != -1) {
			if (b == '-')
				minus = true;
			else {
				n *= 10;
				n += (b - '0');
			}
		}
		if (minus)
			return n * -1;
		else
			return n;
	}
}

Measured memory_bytes: 25640
n = int(input())
list = []
for i in range(1, n+1):
    s, p = input().split()
    p = int(p)
    dict = {}
    dict["i"] = i
    dict["s"] = s
    dict["p"] = p
    list.append(dict)

tmp = sorted(list, key=lambda x:x['p'], reverse=True)
ans = sorted(tmp, key=lambda x:x['s'])
for a in ans:
    print(a["i"])


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

#define rep(i, n) for (int i = 0; i < (n); i++)
#define REP(i, init, n) for (int i = init; i < (n); i++)

using namespace std;
using ll = long long int;
using P = pair<int, int>;
using T = tuple<int, int, int>;
using edge = struct
{
    int to, cost;
};

const int MOD = 1e9 + 7;
const int iINF = 1e9;
const long long int llINF = 1e18;
const double PI = acos(-1.0);

const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

int main()
{
    string input;

    stack<int> sta;

    while (cin >> input)
    {
        if (input[0] == '+')
        {
            int a, b;
            a = sta.top();
            sta.pop();
            b = sta.top();
            sta.pop();
            sta.push(b + a);
        }
        else if (input[0] == '-')
        {
            int a, b;
            a = sta.top();
            sta.pop();
            b = sta.top();
            sta.pop();
            sta.push(b - a);
        }
        else if (input[0] == '*')
        {
            int a, b;
            a = sta.top();
            sta.pop();
            b = sta.top();
            sta.pop();
            sta.push(b * a);
        }
        else
        {
            sta.push(stoi(input));
        }
    }

    cout << sta.top() << endl;

    return 0;
}


Measured memory_bytes: 3176
#include <stdio.h>

#define KI_MAX (1 << 19) /* 524288 */

int ki[KI_MAX * 2 - 1];

int nyan(int a, int b) {
	return a >= b ? a : b;
}

void ki_add(int idx, int value) {
	int pos = (KI_MAX - 1) + idx;
	ki[pos] = nyan(ki[pos], value);
	do {
		pos = (pos - 1) / 2;
		ki[pos] = nyan(ki[pos * 2 + 1], ki[pos * 2 + 2]);
	} while (pos > 0);
}

int ki_get_i(int idx, int qs, int qe, int ss, int se) {
	if (qe <= ss || se <= qs) { /* 完全に外れている */
		return 0;
	} else if (qs <= ss && se <= qe) { /* クエリがセグメントに完全に含まれる */
		return ki[idx];
	} else {
		int sm = ss + (se - ss) / 2;
		int left = ki_get_i(idx * 2 + 1, qs, qe, ss, sm);
		int right = ki_get_i(idx * 2 + 2, qs, qe, sm, se);
		return nyan(left, right);
	}
}

int ki_get(int qs, int qe) {
	return qs < qe ? ki_get_i(0, qs, qe, 0, KI_MAX) : 0;
}

int N, K;
int A[KI_MAX];

#define LIMIT 312345

int main(void) {
	int i;
	if (scanf("%d%d", &N, &K) != 2) return 1;
	for (i = 0; i < N; i++) {
		if (scanf("%d", &A[i]) != 1) return 1;
	}
	for(i = N - 1; i >= 0; i--) {
		int saisyo = A[i] - K;
		int saidai = A[i] + K;
		if (saisyo < 0) saisyo = 0;
		if (saidai > LIMIT) saidai = LIMIT;
		ki_add(A[i], ki_get(saisyo, saidai + 1) + 1);
	}
	printf("%d\n", ki_get(0, LIMIT + 1));
	return 0;
}


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

int main(){
        int N;
        cin >> N;
        ll b_s = 0;
        vector<int> S(N);
        rep(i,N){
                int a,b;
                cin >> a >> b;
                b_s += b;
                S.at(i) = a + b;
        }
        sort(S.rbegin(),S.rend());
        ll ans = -b_s;
        for(int i = 0; i < N; i += 2) {
                ans += S.at(i);
        }
        cout << ans << endl;
}


Measured memory_bytes: 640
R,G,B,N = map(int,input().split())
r_max = N // R + 1
g_max = N // G + 1
ans = 0
for r in range(r_max):
    r_num = R * r
    for g in range(g_max):
        g_num = G * g
        b_num = N - r_num - g_num
        if b_num >= 0:
            if b_num % B == 0:
                ans += 1
                # print(r_num,g_num,b_num)
print(ans)


Measured memory_bytes: 40812
N = int(input())
A, B = map(int, input().split())
P = list(map(int, input().split()))

P.sort()
count = 0
res = 0
while True:
    flag = True
    start = 0
    end = A
    for i in range(N):
        if start < P[i] <= end:
            P[i] = 0
            count += 1
            if count == 1:
                start = A
                end = B
                
            elif count == 2:
                start = B
                end = 10 ** 5

        if count == 3:
            res += 1
            count = 0
            flag = False
            break
            
    if flag:
        break
        
print(res)

Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <stack>
using namespace std;
#define REP(i,a,n) for(int i = a; i < n; ++i)
#define EPS 0.0001

string str;
stack<char> s;
int main() {
	cin >> str;
	REP(i, 0, str.size()) {
		switch (str[i]) {
		case 'S':
			s.push(str[i]);
			break;
		case 'T':
			if (!s.empty() && s.top() == 'S') {
				s.pop();
			} else {
				s.push('T');
			}
			break;
		}
	}
	cout << s.size() << endl;
	return 0;
}

Measured memory_bytes: 644
#include <stdio.h>

int main(){
    int house_status[5][4][11];

    int i,j,k;

    for(i=1; i<=4; i++){
        for(j=1; j<=3; j++){
            for(k=1; k<=10; k++){
                house_status[i][j][k] = 0;
            }
        }
    }
    int n;
    int b, f, r, v;
    char op;
    scanf("%d", &n);
    for(i=0; i<n; i++){
        op = getchar();
        scanf("%d %d %d %d", &b, &f, &r, &v);
        house_status[b][f][r] += v;
    }
    for(i=1; i<=4; i++){
        for(j=1; j<=3; j++){
            for(k=1; k<=10; k++){
                printf(" %d", house_status[i][j][k]);
                //else printf("%d", house_status[i][j][k]);
            }
            printf("\n");
        }
        if(i!=4)printf("####################\n");
        else ;
    }
}



Measured memory_bytes: 2044
#include<iostream>
#include<algorithm>
#include<string>
#include<cstdlib>
#include<map>
#include<iomanip>
#include<sstream>
#include<vector>
#include<stack>
#include<queue>
#include<math.h>
using namespace std;

struct edge{
	long long int from,to,cost;
};
struct dots{
	queue<long long int>que;
	queue<long long int>que2;
	long long int dots_cost;
	
};
int no[200005]={};
edge ed[200005];
dots dot[200005];
void dfs(long long int now,long long int now_cost){
	if(no[now]==0){
		dot[now].dots_cost=now_cost;
		no[now]=1;
		if(!dot[now].que.empty()){
			while(!dot[now].que.empty()){
				dfs(dot[now].que.front(),dot[now].que2.front()+now_cost);
				dot[now].que.pop();
				dot[now].que2.pop();
			}
		}
	}
	return;
}

int main() {
	long long int n;
	cin>>n;
	for(int i=1;i<=n-1;i++)
	{
		cin>>ed[i].from>>ed[i].to>>ed[i].cost;
		dot[ed[i].from].que.push(ed[i].to);
		dot[ed[i].from].que2.push(ed[i].cost);
		dot[ed[i].to].que.push(ed[i].from);
		dot[ed[i].to].que2.push(ed[i].cost);	
	}
	dfs(1,0);
	for(int i=1;i<=n;i++){
		
		if(dot[i].dots_cost%2==0){cout<<0<<endl;}
		else{cout<<1<<endl;}
		
	}
}


Measured memory_bytes: 277504
#include <iostream>
#include <iomanip>
#include <vector>
#include <sstream>
#include <string>
using namespace std;

bool is_operator(string s) {
    return (s == "+" || s == "-" || s == "*" || s == "/");
}

double to_f(string s) {
    double f; istringstream iss(s);
    iss >> f;
    return f;
}

int main() {
    string s;
    vector<double> st;
    while (getline(cin, s)) {
        st.clear();
        istringstream iss(s);
        string t; 
        while (iss >> t) {
            if (is_operator(t)) {
                double a = st.back(); st.pop_back();
                double b = st.back(); st.pop_back();
                if (t == "+") {
                    st.push_back(a+b);
                } else if (t == "-") {
                    st.push_back(b-a);
                } else if (t == "*") {
                    st.push_back(a*b);
                } else if (t == "/") {
                    st.push_back(b/a);
                }
            } else {
                st.push_back(to_f(t));
            }
        }
        cout << fixed << setprecision(6) << st.back() << endl;
    }
    return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
using Int = long long;
int PREP = (cin.tie(nullptr), ios::sync_with_stdio(false), cout << fixed << setprecision(12), 0);
//int SEGV = getenv("D") || (exit(system("D= SEGFAULT_SIGNALS=all catchsegv ./prog.exe") >> 8), 0);
int main() {
    Int A, B, C, D; cin >> A >> B >> C >> D;
    cout << max({ A*C, A*D, B*C, B*D }) << endl;
    return 0;
}

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

long N, A, B;
long quotient, reminder, add, sum;

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

	quotient = N / (A + B);
	reminder = N % (A + B);

	add = reminder;

	if (reminder >= A)
	{
		add = A;
	}

	sum = quotient * A + add;

	cout << sum << endl;

	return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
using namespace std;
const int N = 2e5+10;
int n,t,a[N];
int main()
{
	cin>>n>>t;
	for (int i = 0 ; i < n ; i++)
		scanf("%d",&a[i]);

	long long ans = 0;

	for (int i = 1; i < n ;i++)
	{
		ans += min(t, a[i] - a[i-1]);
	}
	ans+=t;
	cout<<ans<<endl;

return 0;
}

Measured memory_bytes: 4440
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int h = sc.nextInt();
        int w = sc.nextInt();
        int[] l = new int[h];
        int[] r = new int[h];
        for (int i = 0 ; i < h ; i++) {
            String s = sc.next();
            for (int j = 0 ; j < w ; j++) {
                if (s.substring(j, j + 1).equals("#")) {
                    l[i] = j;
                    break;
                }
            }
            for (int j = w - 1 ; j >= 0 ; j--) {
                if (s.substring(j, j + 1).equals("#")) {
                    r[i] = j;
                    break;
                }
            }
        }
        sc.close();
        boolean ans = true;
        for (int i = 0 ; i < h - 1 ; i++) {
            if (r[i] != l[i + 1]) {
                ans = false;
            }
        }

        System.out.println(ans ? "Possible" : "Impossible");
    }

}

Measured memory_bytes: 23124
#include<iostream>
#include<cstdio>
#include<cstring>
#define N 110
using namespace std;
int a[N],dp[N][N][N],n,m;
int main(){
	memset(dp,-128/3,sizeof(dp));
	scanf("%d%d",&n,&m);
	for(int i=1;i<=n;i++)
		scanf("%d",&a[i]); 
	dp[0][n+1][0]=0;
	for(int i=0;i<=n+1;i++)
		for(int j=n+1;j>i;j--)
			for(int k=0;k<=m;k++){
				dp[i+1][j][k+1]=max(dp[i+1][j][k+1],dp[i][j][k]+a[i+1]);
				dp[i][j-1][k+1]=max(dp[i][j-1][k+1],dp[i][j][k]+a[j-1]);
				if(a[i+1]<0)
					dp[i+1][j][k+2]=max(dp[i+1][j][k+2],dp[i][j][k]);
				if(a[j-1]<0)
					dp[i][j-1][k+2]=max(dp[i][j-1][k+2],dp[i][j][k]);
			}
	int ans=0;
	for(int i=0;i<=n;i++)
		for(int j=i+1;j<=n+1;j++)
			for(int k=0;k<=m;k++)
				ans=max(ans,dp[i][j][k]);
	cout<<ans;
	return 0;
}

Measured memory_bytes: 5504
#include <algorithm>
#include <cassert>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>

#include <limits.h>

using namespace std;

typedef long long ll;

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

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

int main(void) {
    string S, T;
    cin >> S >> T;
    
    bool ok = true;
    for (int i = 0; i < (int) T.size() - 1; i++) {
        if (S[i] != T[i]) {
            ok = false;
        }
    }

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

    return 0;
}


Measured memory_bytes: 3628
<?php
//ワーシャルフロイド（全点対最短路問題）
//スタート地点１つに対してゴールが２つ。流れるものは水
//故に、単純に $cost[$s][$g1] + $cost[$s][$g2] とするとWA
//スタート〜ある点までは合流道。ある点〜それぞれのゴールまでは二股に分かれて進むイメージ
//また、有向グラフ（一方通行）なので注意。
//と言ってもむしろ$cost[$b][$a] = $cost[$a][$b]というコピーが不要になるので楽。


$file_handle = fopen('php://stdin', "r");
//$file_handle = fopen('aoj2005_in.txt', "r");


function warshall_floyd($cost) {
	global $n;

	for ($i = 1; $i <= $n; ++$i) {
	    for ($j = 1; $j <= $n; ++$j) {
	        for ($k = 1; $k <= $n; ++$k) {
	        	//INFだったらスルー。これで劇的に早くなる。
	        	if ($cost[$j][$i]===INF || $cost[$i][$k]===INF) continue;
	            // j -> kへ行くのにiを経由した方が良いかどうか(cost)
	            $via = $cost[$j][$i] + $cost[$i][$k];
	            if ($via < $cost[$j][$k]) {
	                $cost[$j][$k] = $via;
	            }
	        }
	    }
	}
	return $cost;
}


while(1){
	//ファイル読み込み
	$info = trim(fgets($file_handle));
	$explode = explode(' ', $info);
	$n = $explode[0]; $m = $explode[1]; $s = $explode[2]; $g1 = $explode[3]; $g2 = $explode[4];
	//終了条件
	if ($n==0 && $m==0 && $s==0 && $g1==0 && $g2==0) break;
	
	//初期化
	$cost = array();

	//ワーシャルフロイド準備。
	for ($i=1; $i<=$n; ++$i){
		for ($j=1; $j<=$n; ++$j){
			if ($i === $j){
				$cost[$i][$i] = 0;
			} else {
				$cost[$i][$j] = INF;
			}
		}
	}

	//辺の情報を格納
	for ($i=1; $i<=$m; ++$i){
		$info2 = trim(fgets($file_handle));
		$explode = explode(' ', $info2);
		$a = $explode[0]; $b = $explode[1]; $c = $explode[2];
		$cost[$a][$b] = $c;
	}

	//探索。先に全点対最短路を求めておく必要がある
	$cost = warshall_floyd($cost);
	
	//最小値計算
	$min = INF;
	for($i=1; $i<=$n; ++$i){
		//どこで分岐するのが最も総コストが低いか比較
		//INFのものがあればスルー
		if ($cost[$s][$i]===INF || $cost[$i][$g1]===INF || $cost[$i][$g2]===INF) continue;
		$via = $cost[$s][$i] + $cost[$i][$g1] + $cost[$i][$g2];
		$min = min($min, $via);
	}
	
	//出力
	echo $min;
	echo PHP_EOL;
}

fclose($file_handle);

Measured memory_bytes: 9868
n , m = map(int,input().split())

hyoukou = list(map(int,input().split()))

roadssta = []
roadsfin = []

ten = [1]*n

for i in range(m):
    base = input().split()
    a = int(base[0])
    b = int(base[1])
    if hyoukou[a-1]>hyoukou[b-1]:
        ten[b-1] = 0
    elif hyoukou[a-1]<hyoukou[b-1]:
        ten[a-1] = 0
    else:
        ten[a-1] = 0
        ten[b-1] = 0

print(ten.count(1))

Measured memory_bytes: 20120
#include <iostream>
#include <vector>

using namespace std;

int n, m, a, b, dp[100005];
vector<int> graf[100005];
bool vis[100005];


void dfs(int s)
{
    vis[s]=true;

    for(int i=0; i<graf[s].size(); i++){

        if(!vis[graf[s][i]]){
            dfs(graf[s][i]);
          }

        dp[s]=max(dp[s], dp[graf[s][i]]+1);
    }
}


int main()
{
    cin>>n>>m;
    for(int z=0; z<m; z++){
      cin>>a>>b;
      graf[a].push_back(b);
    }


    for(int i=1; i<=n; i++){
        if(!vis[i]){
            dfs(i);
          }
    }

    int wynik=0;

    for(int i=1; i<=n; i++){
        wynik=max(wynik, dp[i]);
    }
    cout<<wynik;
    return 0;
}


Measured memory_bytes: 8192
use whiteread::parse_line;

fn main() {
    let n: usize = parse_line().unwrap();
    let mut w: Vec<String> = Vec::new();
    let mut ans = "Yes";

    w.push(parse_line().unwrap());
    for _ in 0..n - 1 {
        let wi: String = parse_line().unwrap();
        if w.contains(&wi) || w[w.len() - 1].clone().pop() != wi.chars().next() {
            ans = "No";
            break;
        }
        w.push(wi);
    }
    println!("{}", ans);
}


Measured memory_bytes: 2136
#include<bits/stdc++.h>
#define rep(i,N) for(int i=0;i<(N);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e12;
const int inf = 1e9;
typedef long long ll;
typedef pair<ll,int> P;
typedef set<int> S;
ll h;
int main(){
    cin>>h;
    ll ans=1;
    while(1){
        if(h==1){
            break;
        }
        else{
            h=h/2;
            //cout<<h<<endl;
            ans=ans*2+1;
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>

using namespace std;

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

typedef long long ll;

int w[110];
int v[110];
ll dp[110][100010];

void Main()
{
	int N, W; cin >> N >> W;
	rep(i,N) cin >> w[i] >> v[i];

	rep(i,N) {
		rep(j,100010) {
			dp[i][j] = 1e18;
		}
	}
	dp[0][0] = 0;
	rep(i,N) {
		rep(j,100010) {
			dp[i + 1][j] = dp[i][j];
			if (j >= v[i]) {
				dp[i + 1][j] = min(dp[i][j], dp[i][j - v[i]] + w[i]);
			}
		}
	}
	int res = 0;
	rep(i,N + 1) {
		rep(j,100010) {
			if (dp[i][j] <= W) {
				res = max(res, j);
			}
		}
	}
	cout << res << endl;
}

int main()
{
    cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	Main();
}


Measured memory_bytes: 80128
#include <iostream>
#include <bitset>
#include <string>
#include <algorithm>
#include <cmath>
#include <vector>
#include <map>
using namespace std;
using ll = long long int;
#define REP(i,n) for(int i=0;i<n;i++)

int main()
{
    int H, W;
    cin >> H >> W;
    
    vector<string> S;
    for (int row=1; row <= H; row++)
    {
        string s_i;
        cin >> s_i;
        S.push_back(s_i);
    }
    vector<string> ans(S);

    for (int row = 1; row <= H; row++)
    {
        for (int col = 1; col <= W; col++)
        {
            int count = 0;
            if (S[row-1][col-1] == '.')
            {
                if (row != 1)
                {
                    if (S[row-1-1][col-1] == '#')
                        count++;

                    if (col != 1)
                    {
                        if (S[row-1-1][col-1-1] == '#')
                            count++;
                    }
                    if (col != W)
                    {
                        if (S[row-1-1][col-1+1] == '#')
                            count++;
                    }
                }
                if (row != H)
                {
                    if (S[row-1+1][col-1] == '#')
                        count++;

                    if (col != 1)
                    {
                        if (S[row-1+1][col-1-1] == '#')
                            count++;
                    }
                    if (col != W)
                    {
                        if (S[row-1+1][col-1+1] == '#')
                            count++;
                    }
                }
                if (col != 1)
                {
                    if (S[row-1][col-1-1] == '#')
                        count++;
                }
                if (col != W)
                {
                    if (S[row-1][col-1+1] == '#')
                        count++;
                }
                ans[row-1][col-1] = '0' + count;
            }
        }
    }
    
    for (int row = 1; row <= H; row++)
    {
        for (int col = 1; col <= W; col++)
        {
            cout << ans[row-1][col-1];
        }
        cout << endl;
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n,m,x,y,fd[101010],ct[101010];
bool vis[101010];
pair<int,int>a[101010];
vector<pair<int,int> >v[101010];
vector<int>ans;
int dfs(int x)
{
	vis[x]=true;
	int cnt=ct[x];
	for(int i=0;i<v[x].size();i++)
	{
		if(vis[v[x][i].first]==true)
		{
			continue;
		}
		int z=dfs(v[x][i].first);
		if(z)
		{
			ans.push_back(v[x][i].second);
		}
		cnt^=z;
	}
	return cnt;
}
int main()
{
	cin>>n>>m;
	for(int i=0;i<n;i++)
	{
		cin>>a[i].first>>a[i].second;
	}
	sort(a,a+n);
	ct[0]=a[0].second;
	for(int i=1;i<n;i++)
	{
		ct[i]=a[i-1].second^a[i].second;
	}
	ct[n]=a[n-1].second;
	for(int i=0;i<n;i++)
	{
		fd[i]=a[i].first;
	}
	for(int i=0;i<m;i++)
	{
		cin>>x>>y;
		int aa=lower_bound(fd,fd+n,x)-fd;
		int bb=upper_bound(fd,fd+n,y)-fd;
		v[aa].push_back(make_pair(bb,i));
		v[bb].push_back(make_pair(aa,i));
	}
	for(int i=0;i<n;i++)
	{
		if(!vis[i])
		{
			if(dfs(i))
			{
				cout<<-1<<endl;
				return 0;
			}
		}
	}
	cout<<ans.size()<<endl;
	sort(ans.begin(),ans.end());
	for(int i=0;i<ans.size();i++)
	{
		cout<<ans[i]+1<<' ';
	}
	cout<<endl;
	return 0;
}

Measured memory_bytes: 15612
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string S;
  cin >> S;
   
  if ( S == "Sunny" ) {
    cout << "Cloudy" << endl;
  }
  else if ( S == "Cloudy" ){
    cout << "Rainy" << endl;
  }
  else {
    cout << "Sunny" << endl;
  }
}


Measured memory_bytes: 256
#pragma warning disable
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System;
using System.Collections;
using static System.Math;
using static System.Console;
class E { static void Main() => new J(); }
class J
{
	const int Mod = 1000000007;
	int F() => int.Parse(ReadLine());
	int[] G() => ReadLine().Split(new char[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries).Select(int.Parse).ToArray();
	public J()
	{
		SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
		Solve();
		Out.Flush();
	}
	void Solve()
	{
		var I = G();
		var d = I[2] - I[1];
		if (d <= 0) WriteLine("delicious");
		else if (d <= I[0]) WriteLine("safe");
		else WriteLine("dangerous");
	}
	long GCD(long a, long b)
	{
		var n = (ulong)Abs(a); var m = (ulong)Abs(b);
		if (n == 0) return (long)m; if (m == 0) return (long)n;
		int zm = 0, zn = 0;
		while ((n & 1) == 0) { n >>= 1; zn++; }
		while ((m & 1) == 0) { m >>= 1; zm++; }
		while (m != n)
		{
			if (m > n) { m -= n; while ((m & 1) == 0) m >>= 1; }
			else { n -= m; while ((n & 1) == 0) n >>= 1; }
		}
		return (long)n << Min(zm, zn);
	}
}

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

using namespace std;

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

    vector<int> a(n);
    for(auto &x: a) cin >> x;

    sort(a.begin(), a.end());

    long ma = a[n-1], mi = a[0];

    long r = ma - mi;
    for(int i=1; i<n-1; i++) {
        r += max(a[i], -a[i]);
    }
    cout << r << endl;

    for(int i=1; i<n-1; i++) {
        long aa = a[i];
        if(aa > 0) {
            cout << mi << ' ' << aa << endl;
            mi -= aa;
        } else {
            cout << ma << ' ' << aa << endl;
            ma -= aa;
        }
    }
    cout << ma << ' '<< mi << endl;
}


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

const int INF = 1e9;
const int MAX_V = 100;

struct edge { int to, cap, rev; };

vector<edge> G[MAX_V];
bool used[MAX_V];

void addEdge(int from, int to, int cap){
  G[from].push_back((edge) {to, cap, static_cast<int>(G[to].size())});
  G[to].push_back((edge) {from, 0, static_cast<int>(G[from].size()) - 1});
}

int dfs(int v, int t, int f) {
  if(v == t) return f;
  used[v] = true;
  for(int i = 0; i < G[v].size(); i++){
    edge &e = G[v][i];
    if(!used[e.to] && e.cap > 0) {
      int d = dfs(e.to, t, min(f, e.cap));
      if (d > 0) {
        e.cap -= d;
        G[e.to][e.rev].cap += d;
        return d;
      }
    }
  }
  return 0;
}

int maxFlow(int s, int t) {
  int flow = 0;
  while(true) {
    memset(used, 0, sizeof(used));
    int f = dfs(s, t, INF);
    if( f == 0 ) return flow;
    flow += f;
  }
}


int main () {
  int V, E;
  cin >> V >> E;

  for(int i = 0; i < E; i++){
    int u, v, c;
    cin >> u >> v >> c;
    addEdge(u, v, c);
  }

  cout << maxFlow(0, V-1) << endl;
  return 0;
}



Measured memory_bytes: 3204
#include<stdio.h>
#include<math.h>

int main( void )
{
        double x1 = 0, y1 = 0, x2 = 0, y2 = 0, x3 = 0, y3 = 0;
        double px = 0, py = 0, r = 0;
        int n = 0, i = 0;
        double a = 0, b = 0, c = 0, d = 0, e = 0, f = 0, g = 0, h = 0;

        scanf("%d",&n);

        for(i=0; i < n; i++)
        {

                scanf("%lf %lf %lf %lf %lf %lf", &x1, &y1, &x2, &y2, &x3, &y3);

                a = (x1 * x1) - (x2 * x2);
                b = x1 - x2;
                c = (y1 * y1) - (y2 * y2);
                d = y1 - y2;

                e = (x1 * x1) - (x3 * x3);
                f = x1 - x3;
                g = (y1 * y1) - (y3 * y3);
                h = y1 - y3;

                py = ( ( f * (a + c) ) - ( b * (e + g) ) )/(2 * ((d * f) - (b * h)));
                px = (h * (a + c) - (e + g) * d) / (2 * ((b * h) - (f * d)));
                r  = sqrt(((px - x1) * (px - x1)) + ((py-y1)*(py-y1)));

                printf("%0.3f %0.3f %0.3f\n", px, py, r);

        }
        return 0;
}

Measured memory_bytes: 664
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) throws NumberFormatException, IOException {
		BufferedReader buff = null;
		buff = new BufferedReader(new InputStreamReader(System.in));

		String[] box = buff.readLine().split(" ");
		int[] num = new int[box.length];
		int count = -1;

		for(int i = 0; i < box.length; ++i){
			num[i] = Integer.parseInt(box[i]);
		}

		while(++count >= 0){
			for(int i = 0; i < box.length; ++i){
				for(int j = i + 1; j < box.length; ++j){
					// 整列
					if(num[i] > num[j]){
						int pre = num[i];
						num[i] = num[j];
						num[j] = pre;
					}
				}
			}

			if(num[0] == num[1] && num[1] == num[2]){
				break;
			}

			if(num[2] - num[0] >= 2){
				num[0] += 2;
			} else {
				++num[0];
				++num[1];
			}
		}

		System.out.println(count);
	}
}


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

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> P;
typedef long long ll;

#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(c) reverse((c).begin(),(c).end())

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

const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int INT_INF = 2147483647;
const long long LL_INF = 1LL<<60;
const long long MOD = 1000000007;

#define CLR(a) memset((a), 0 ,sizeof(a))

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

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

int main(void){
    int A,B; cin >> A >> B;
    cout << (A*B%2 ? "Yes" : "No") << endl;
    return 0;
}

Measured memory_bytes: 256