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

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

typedef int _loop_int;
#define REP(i,n) for(_loop_int i=0;i<(_loop_int)(n);++i)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

#define CHMIN(a,b) a=min((a),(b))
#define CHMAX(a,b) a=max((a),(b))

// mod
const ll MOD = 1000000007ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

// floating
typedef double Real;
const Real EPS = 1e-11;
#define EQ0(x) (abs(x)<EPS)
#define EQ(a,b) (abs(a-b)<EPS)
typedef complex<Real> P;

int n,m;
// g[pos][type] -> vi
unordered_map<int,vi> g[125252];
unordered_set<int> colors[125252];
unordered_map<int,int> dist[125252];

int main(){
  scanf("%d%d",&n,&m);
  REP(i,m){
    int p,q,c;
    scanf("%d%d%d",&p,&q,&c);
    --p;--q;
    g[p][c].push_back(q);
    g[q][c].push_back(p);
    colors[p].insert(c);
    colors[q].insert(c);
  }
  // dist,pos,company
  deque<pair<int,pii>> Q;
  const int NICO = 830252521;
  Q.push_back(make_pair(0,pii(0,NICO)));
  dist[0][NICO] = 0;
  while(!Q.empty()){
    pair<int,pii> P = Q.front(); Q.pop_front();
    int d = P.first;
    int p = P.second.first;
    int c = P.second.second;
    if(c==NICO){
      // get train
      for(const int& com:colors[p]){
        if(dist[p].count(com)!=0 && d+1>=dist[p][com])continue;
        dist[p][com] = d+1;
        Q.push_back(make_pair(d+1,pii(p,com)));
      }
    }else{
      // continue train or ride off
      for(const int& to:g[p][c]){
        if(dist[to].count(c)!=0 && d>=dist[to][c])continue;
        dist[to][c] = d;
        Q.push_front(make_pair(d,pii(to,c)));
      }
      if(dist[p].count(NICO)==0 || d<dist[p][NICO]){
        dist[p][NICO] = d;
        Q.push_front(make_pair(d,pii(p,NICO)));
      }
    }
  }
  if(dist[n-1].count(NICO)==0){
    dist[n-1][NICO] = -1;
  }
  printf("%d\n",dist[n-1][NICO]);
  return 0;
}


Measured memory_bytes: 100352
import java.util.Scanner;

class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt();
        int y = sc.nextInt();
        int prize = 0;
        if(x == 3)
            prize = 100000;
        else if(x == 2)
            prize = 200000;
        else if(x == 1)
            prize = 300000;
        if(y == 3)
            prize += 100000;
        else if(y == 2)
            prize += 200000;
        if(y == 1)
            prize += 300000;
        if(x == 1 && y == 1)
            prize += 400000;
        System.out.println(prize);
        sc.close();
    }
}

Measured memory_bytes: 21844
import java.util.Scanner;
import java.util.List;
import java.util.ArrayList;
import java.util.Collections;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    List<Double> list = new ArrayList<Double>();
    for (int i = 0, n = sc.nextInt(); i < n; i++)
      list.add(sc.nextDouble());
    Collections.sort(list);
    while (list.size() > 1) {
      list.set(0, (list.get(0) + list.get(1)) / 2);
      list.remove(1);
    }
    System.out.println(list.get(0));
  }
}

Measured memory_bytes: 23380
#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <math.h>
#include <iomanip>
using namespace std;

#define ll long long int
#define MOD 1000000007
#define INF 1e9 + 1
#define fast ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define vi vector<int>
#define vl vector<long>
#define vll vector<long long>
#define pb push_back

double p[3000];
double dp[3000][3000];  //global arrays are zero initialised by default.

int main() {
	fast
	int t=1;
	// cin>>t;
	while(t--) {
	    int n;
	    cin>>n;
	    for(int i = 0; i < n; i++) cin>>p[i];
	    
	//     cout<<"************\n";
	// for(int i = 0; i <= n; i++) {
	//     	for(int j = 0; j <= n; j++) {
	//     		cout<<dp[i][j]<<" ";
	//     	}
	//     	cout<<"\n";
	//     }
	//    cout<<"****************\n";



	    //BASE case
	    dp[0][0] = 1;
	    for(int i = 1; i <= n; i++)  dp[0][i] = 0;
	    //----
	    
	    for(int i = 1; i <= n; i++) {  //there'll be atmost n tosses.
	        for(int j = 0; j <= i; j++) { //number of heads can atmost be the number of tosses.
	            if(j) dp[i][j] += dp[i-1][j-1] * p[i-1];
	            dp[i][j] += dp[i-1][j] * (1 - p[i-1]);
	        }
	    }

	    // for(int i = 0; i <= n; i++) {
	    // 	for(int j = 0; j <= n; j++) {
	    // 		cout<<dp[i][j]<<" ";
	    // 	}
	    // 	cout<<"\n";
	    // }
	    
	    double ans = 0;
	    for(int i = 0; i <= n; i++) {
	        if(i > n - i) ans += dp[n][i];
	    }
	    
	    cout<<setprecision(9)<<ans<<"\n";
	}
	return 0;
}


Measured memory_bytes: 68992
#include <stdio.h>
#include <ctype.h>
#define MAX 100
int main(void) {
    char a[MAX], b[MAX], c[MAX], turn='a';
    int ai=0, bi=0, ci=0;
    scanf("%s%s%s", a, b, c);
    while(1) {
        if(turn=='a') {
            if(a[ai]=='\0')break;
            turn=a[ai];
            ai++;
        }else if(turn=='b') {
            if(b[bi]=='\0')break;
            turn=b[bi];
            bi++;
        }else if(turn=='c') {
            if(c[ci]=='\0')break;
            turn=c[ci];
            ci++;
        }
    }
    printf("%c\n", toupper(turn));
    return 0;
}


Measured memory_bytes: 128
from functools import reduce
def gcd (a, b):
    if a < b:
        a, b = b, a
    
    if b == 0:
        return a
    return gcd(b, a % b)

def lcm (a, b):
    return a * b // gcd(a, b)

n = int(input())
t = []
for i in range(n):
    t.append(int(input()))

print(reduce(lcm, t))

Measured memory_bytes: 3572
//Littleboy123 Template 1.7
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;

//pragmas

// #pragma comment(linker, "/stack:200000000")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
// #pragma GCC target ("avx2")
// #pragma GCC optimization ("O3")t
// #pragma GCC optimization ("unroll-loops")


typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef long long int ll;
typedef pair<ll, ll> pll;
typedef unsigned long long int ull;
typedef long double ld;
typedef unsigned long long ull;

const long double pi = acos(-1.0);

#define FOR(a,b,c) for(ll (a)=(b);(a)<(c);++(a))
#define FORE(a,b,c) for(ll (a)=(b);(a)<=(c);++(a))
#define FORN(a,b,c) for(ll (a)=(b);(a)>(c);--(a))
#define FORNE(a,b,c) for(ll (a)=(b);(a)>=(c);--(a))
#define TC(n) cout << "Case #" << (n) << ": "
#define DEBUG(x) cout << "DEBUG " << #x << ' ' << x << '\n';
#define MEM(a,b) memset((a), (b), sizeof((a)))
#define MAX(a,b) (a) = max((a), (b))
#define MIN(a,b) (a) = min((a), (b))
#define nl '\n'
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define ordered_set tree<ll, null_type,less_equal<ll>, rb_tree_tag,tree_order_statistics_node_update>

void init(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
}

void infile(){
    freopen("fenwick.out", "r", stdin);
}

void outfile(){
    freopen("fenwick.out", "w", stdout);
}

ll modex(ll a, ll b, ll mod){
    if(b == 0)
        return 1;
    if(b == 1)
        return a;
    ll tmp = modex(a, b/2LL, mod);
    tmp = (tmp * tmp) % mod;
    if(b & 1LL)
        tmp = (tmp * a) % mod;
    return tmp;
}

//End of template

int main(){
    init();

    ll n, x, t;
    cin >> n >> x >> t;
    cout << (ll)((n+x-1)/x) * t << endl;
    return 0;
}


Measured memory_bytes: 3608
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<cmath>
#include<cstring>
#include<string>
#include<iostream>
#include<map>
using namespace std;
long long x,y,sum;
int main(){
	scanf("%lld%lld",&x,&y);
	sum=1;
	int h;
	for(int i=1;i<=10000;i++){
		sum=sum*2;
		if((y/x)>=sum&&(y/x)<sum*2){
			h=i+1;
			break;
		}
	}
	if(y/x<2) printf("1\n");
	else printf("%d\n",h);
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<stdlib.h>
#include<utility>
#include<functional>
#include<cfenv>
#include<cmath>
#include<string>
#include<queue>
#include<stack>
#include<map>
#include<set>

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define vint vector<int>
#define vvint vector<vint>
#define P pair<ll,ll>
#define INT_MAX 2147483647
#define MOD 1000000007
#define PI 3.14159265358979323846
#define all(a) (a).begin(),(a).end()
using namespace std;
typedef long long ll;

#define MAX 1000000000000


int main(void) {
	int x; cin >> x;
	int k = 0;
	int now = 0;
	while (true) {
		now += x;
		now %= 360;
		k++;
		if (now== 0) {
			break;
		}
	}

	cout << k << endl;
	return 0;
}

Measured memory_bytes: 3632
import string

N = int(input())

alph = string.ascii_lowercase

def f(N):
    ans = []
    while N > 0:
        k = N % 26
        ans.append(alph[k-1])
        if N == 26:
            break
        if k == 0:
            N -= 26
        N = N // 26

    return "".join(ans[::-1])

print(f(N))


Measured memory_bytes: 9972
import java.util.*;

public class Main {
    private static class Point {
        int x, y, pair;

        public Point(int x, int y) {
            this.x = x;
            this.y = y;
            this.pair = -1;
        }
    }

    int map[][];
    Point r[], b[];

    public void main(Scanner sc) {
        int n = sc.nextInt();
        r = new Point[n];
        b = new Point[n];
        for (int i = 0; i < n; i++) {
            r[i] = new Point(sc.nextInt(), sc.nextInt());
        }
        for (int i = 0; i < n; i++) {
            b[i] = new Point(sc.nextInt(), sc.nextInt());
        }

        map = new int[n][n];
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < n; j++) {
                if ((r[i].x < b[j].x) && (r[i].y < b[j].y)) {
                    map[i][j] = 1;
                }
            }
        }

        int ans = 0;
        for (int i = 0; i < n; i++) {
            ans += (foo(i, n, new BitSet()) ? 1 : 0);
        }
        System.out.println(ans);
    }

    private boolean foo(int v, int n, BitSet bs) {
        for (int i = 0; i < n; i++) {
            if ((map[v][i] != 1) || (bs.get(i))) {
                continue;
            }

            bs.set(i);
            if (b[i].pair == -1 || foo(b[i].pair, n, bs)) {
                b[i].pair = v;
                return true;
            }
        }

        return false;
    }

    public static void main(String[] args) throws Exception {
        try (Scanner sc = new Scanner(System.in)) {
            new Main().main(sc);
        } catch (Exception e) {
            throw e;
        }
    }
}


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

int main() {
    double A,B,H,M;
    cin >> A >> B >> H >> M;
    double A_ang, B_ang;
    A_ang = 30.0 * H + 0.5 * M;
    B_ang = 6.0 * M;
    if(B_ang > A_ang) swap(A_ang,B_ang);
    double theta = abs(A_ang - B_ang);
    if(theta >= 180.0) theta = 360.0 - theta;
    const double PI = acos(-1);
    theta = theta * PI / 180.0;
    double ans = A*A + B*B - 2*A*B*cos(theta);
    ans = sqrt(ans);
    cout << fixed;
    cout << setprecision(20);
    cout << ans << '\n';
    return 0;
}

Measured memory_bytes: 4212
#include<stdio.h>
int main(){
  int h,w,bool=1;
  while(bool){
    scanf("%d %d",&h,&w);
    if(h==0 && w==0)break;
    else{
      for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
          if(i%2==0){
            if(j%2==0){
              printf("#");
            }else{
              printf(".");
            }
          }else{
            if(j%2==0){
              printf(".");
            }else{
              printf("#");
            }
          }

        }
        putchar('\n');
      }
      putchar('\n');
    }
  }
}



Measured memory_bytes: 2076
n = int(input())
 
a = [int(input()) for i in range(n)]
ma1 = max(a)
ma2 = a.count(ma1)
 
for i in range(n):
    if a[i] == ma1:
        if ma2 == 1:
            a[i] = 1
            print(max(a))
            a[i] = ma1
        else:
            print(ma1)
    else:
        print(ma1)

Measured memory_bytes: 68568
array = readlines.map(&:chomp)
n = array[0].to_i
points = array[1].chomp.split(" ").map(&:to_i)

sum = 0
points.each do |v|
  sum += v
end

assembly = (sum / n.to_f).round

energy = 0
points.each do |v|
  energy += (v - assembly)**2
end

print(energy)

Measured memory_bytes: 1788
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import sys

A, B, C = map(int, input().split())

if A == B and A != C:
    print("Yes")
elif B == C and B != A:
    print("Yes")
elif C == A and C != B:
    print("Yes")
else:
    print('No')


Measured memory_bytes: 2940
n = gets.chomp.split(" ").map(&:to_i)

a = [];
n[0].times{
    s = gets.chomp.split("")
    a << s  
}

b = [];
n[1].times{
    s = gets.chomp.split("")
    b << s 
}

catch :out do
    for i in (0...n[0]-(n[1]-1)) do 
        for j in (0...n[0]-(n[1]-1)) do 
            
            chk = []
            
            k = 0 
            n[1].times{
                
                chk << a[j+k].slice(i...i+n[1])
                
            k += 1 
            }
            
            if chk == b
                puts "Yes"
                throw :out
            else 
            end 
        end 
    end 
    
    puts "No"

end 

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

typedef long long ll;
#define rep(i, n) for(int i = 0;i < (n);i++)
#define repr(i, n) for(int i = (n);i >= 0;i--)
#define repf(i, m, n) for(int i = (m);i < (n);i++)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1;} return 0;}
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1;} return 0;}
int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0};
//////////////////////////////////////////////////


int main() {
    int n, x, y;
    cin >> n >> x >> y;
    x--;
    y--;
    
    vector<int> ans(n);
    int d;
    rep(i,n-1) repf(j,i+1,n) {
        d = min(j-i, min(abs(i-x)+1+abs(j-y), abs(i-y)+1+abs(j-x)));
        ans[d]++;
    }
    repf(i,1,n) {
        cout << ans[i] << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <fstream>
#include <numeric>
#include <unordered_set>
#include <sstream>
#include <cassert>
#include <tuple>
#include <iomanip>
#include <random>
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <ctime>
#include <deque>
#include <queue>
#include <chrono>
#include <stack>
#include <string>
#include <bitset>
#include <unordered_map>
#include <cstdio>
#include <limits>
#include <vector>
#include <climits>
#include <cstring>
#include <cstdlib>

using namespace std;

#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x.size())
#define pb push_back
#define pii pair <int, int>
#define print(x) for(auto it : x) cout << it << ' ';
#define endl "\n" // TODO: remove
#define int long long

const int N = (1e6) + 322;
const int inf = (int)(2e9);
const int mod = (int)(1e9) + 7; // check modulo

int a[N], n, cnt[N];

void solve() {
    cin >> n;
    for(int i = 1; i <= n; ++i) cin >> a[i];
    sort(a + 1, a + n + 1, greater<int>());
    int res = a[1];
    int pos = 2;
    for(int i = 3; i <= n; ++i) {
        res += a[pos];
        cnt[pos]++;
        if (cnt[pos] == 2) pos++;
    }
    cout << res;
}

signed main () {
    ios_base :: sync_with_stdio(false);
    cin.tie(NULL);
//    int test; cin >> test;
//    for(int t = 1; t <= test; ++t) {
        solve();
//    }
    return 0;
}


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

using ll =  long long;
using pint =  pair<int,int>;

#define INF 99999999
#define rep(i,n) for(int (i)=0,temp=(int)(n);(i)<temp;++(i)) 
#define repi(i,start,end) for(int (i)=(start),temp=(int)(end);i<(end);++(i))
#define rfor(v,x) for(const auto& (x) : (v)) //xは値を表す
#define all(x) (x).begin(),(x).end()
#define SORT(v, n) sort((v), (v)+(n))
#define vsort(v) sort((v).begin(), (v).end())
#define vfsort(v,lambda) sort(all((v)),(lambda))
#define vint vector<int>
#define vvint vector<vector<int>> //vvint v(n,vint(n))のように宣言できる
#define vin(v) rep(i,(v).size()) {cin >> (v)[i];}
//最終奥義(使うときはINFも書き換えろ!!)
//#define int long long
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int ctoi(char c) {return c-'0';}
//lambda式 -> [&](int x, int y){return x<y;}
//vector内の重複を削除-> v.erase(unique(all(v)),v.end());

signed main(void){
  int a,b,c;cin>>a>>b>>c;
  if(a==b&&b!=c||b==c&&c!=a||c==a&&a!=b){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }

}


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

// #define int long long
#define rep(i, n) for (long long i = (long long)(0); i < (long long)(n); ++i)
#define reps(i, n) for (long long i = (long long)(1); i <= (long long)(n); ++i)
#define rrep(i, n) for (long long i = ((long long)(n)-1); i >= 0; i--)
#define rreps(i, n) for (long long i = ((long long)(n)); i > 0; i--)
#define irep(i, m, n) for (long long i = (long long)(m); i < (long long)(n); ++i)
#define ireps(i, m, n) for (long long i = (long long)(m); i <= (long long)(n); ++i)
#define SORT(v, n) sort(v, v + n);
#define REVERSE(v, n) reverse(v, v+n);
#define vsort(v) sort(v.begin(), v.end());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) long long(x.size())

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vs = vector<string>;
using vpll = vector<pair<ll, ll>>;
using vtp = vector<tuple<ll,ll,ll>>;
using vb = vector<bool>;

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 ll INF = 1e9;
const ll MOD = 1e9+7;
const ll LINF = 1e18;



signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  ll n,h; cin>>n>>h;
  vll a(n),b(n);
  rep(i,n) cin>>a[i]>>b[i];
  sort(a.rbegin(),a.rend());
  sort(b.rbegin(),b.rend());
  
  ll maxa=a[0];
  ll cnt=0;
  rep(i,n){
    if(maxa<b[i]){
      h-=b[i];
      cnt++;
      if(h<=0){
        cout<<cnt<<endl;
        return 0;
      }
    }else break;
  }
  
  cnt+=(h+maxa-1)/maxa;
  cout<<cnt<<endl;
  
}

Measured memory_bytes: 1792
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <queue>
#include <vector>
#include <utility>
#define EPS 1e-10
using namespace std;
typedef long long ll;
struct Point{
	double x,y;
	Point(double x = 0.0,double y = 0.0): x(x),y(y) {}
	Point operator + (Point p){
		return Point(x + p.x,y + p.y);
	}
	Point operator - (Point p){
		return Point(x - p.x,y - p.y);
	}
	Point operator * (double lambda){
		return Point(x * lambda,y * lambda);
	}
	Point operator / (double lambda){
		return Point(x / lambda,y / lambda);
	}
	double norm(){
		return x * x + y * y;
	}
	double abs_(){
		return sqrt(norm());
	}
	bool operator == (const Point &p)const
	{
		return abs(x - p.x) < EPS && abs(y - p.y) < EPS;
	}
	bool operator < (const Point &p)const
	{
		if(abs(x - p.x) < EPS) return y < p.y;
		else return x < p.x;
	}
};
typedef Point Vector;
struct Segment{
	Point p1,p2;
	Segment(Point p1 = Point(),Point p2 = Point()): p1(p1),p2(p2) {}
};
typedef Segment Line;
struct Circle{
	Point c;
	double r;
	Circle(Point c = Point(),double r = 0.0): c(c),r(r) {}
};
typedef vector<Point> Polygon;
double dot(Vector a,Vector b){
	return a.x * b.x + a.y * b.y;
}
double det(Vector a,Vector b){
	return a.x * b.y - b.x * a.y;
}
Point crossPoint(Line a,Line b){
	double r = det(b.p2 - b.p1,a.p1 - b.p1) / det(a.p2 - a.p1,b.p2 - b.p1);
	return a.p1 + (a.p2 - a.p1) * r;
}
int main(){
  int t;
  scanf("%d",&t);
  while(t--){
    Segment s1,s2;
    scanf("%lf%lf%lf%lf",&s1.p1.x,&s1.p1.y,&s1.p2.x,&s1.p2.y);
    scanf("%lf%lf%lf%lf",&s2.p1.x,&s2.p1.y,&s2.p2.x,&s2.p2.y);
    Point A = crossPoint(s1,s2);
    printf("%.10f %.10f\n",A.x,A.y);
  }
  return 0;
}


Measured memory_bytes: 3252
// {{{
// vim:filetype=cpp foldmethod=marker foldmarker={{{,}}}
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <climits>
#include <complex>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#define ALL(A)		(A).begin(),(A).end()
#define DUMP(A)    cout<<#A<<"="<<(A)<< endl
#define SIZE(A)    (int)((A).size())
#define MP  make_pair
#define PB  push_back
using namespace std;
typedef long long ll;

int vx[]={1,0,-1,0},vy[]={0,1,0,-1};
// }}}

typedef pair<int,int> P;
vector<vector<P> > edge;
int main(){
    int n,m;
    for(;;){
        scanf("%d\n",&n);
        if(n==0) break;
        scanf("%d\n",&m);
        int a,b,d;
        edge=vector<vector<P> >(n,vector<P>());
        for(int i=0;i<m;i++){
            scanf("%d,%d,%d\n",&a,&b,&d);
            d=d/100-1;
            edge[a].PB(MP(d,b));
            edge[b].PB(MP(d,a));
        }
        vector<bool> isvis(n,false);
        priority_queue<P,vector<P>,greater<P> > pq;
        int ret=0;
        pq.push(MP(0,0));
        while(!pq.empty()){
            int d=pq.top().first,at=pq.top().second;
            pq.pop();
            if(isvis[at]) continue;
            isvis[at]=true;
            ret+=d;
            for(int i=0;i<edge[at].size();i++){
                if(!isvis[edge[at][i].second]){
                    pq.push(edge[at][i]);
                }
            }
        }
        printf("%d\n",ret);
    }
}

Measured memory_bytes: 0
package main

import (
	"fmt"
	"sort"
)

func main() {
	var x, y, z, K, cake int
	fmt.Scan(&x, &y, &z, &K)

	var one [1000]int
	var two, three []int
	for i := 0; i < x; i++ {
		fmt.Scan(&one[i])
	}
	for i := 0; i < y; i++ {
		fmt.Scan(&cake)
		for j := 0; j < x; j++ {
			two = append(two, cake+one[j])
		}
	}
	sort.Sort(sort.Reverse(sort.IntSlice(two)))
	for i := 0; i < z; i++ {
		fmt.Scan(&cake)
		for j := 0; j < K && j < x*y; j++ {
			three = append(three, cake+two[j])
		}

	}
	sort.Sort(sort.Reverse(sort.IntSlice(three)))
	for i := 0; i < K; i++ {
		fmt.Println(three[i])
	}

}


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

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

using namespace std;

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

    string s;
    cin >> s;
    if (s[0] == s[1] || s[1] == s[2] || s[2] == s[3]) cout << "Bad" << '\n';
    else cout << "Good" << '\n';
}

Measured memory_bytes: 256
#include <iostream>
#include <complex>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <numeric>
#include <cstring>
#include <ctime>
#include <cstdlib>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <cmath>
#include <bitset>
#include <cassert>
#include <queue>
#include <stack>
#include <deque>
#include <random>
#include <iomanip>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef pair<int,int> P;
const ll MOD=1000000007;
const ll MAX_N=500010;
const ll INF=1<<18;
vector<vector<int> > G(200100);
vector<int> cnt(200100,0);
vector<bool> done(200100,false);

void dfs(int c, int u){
    cnt[u]+=c;
    done[u]=true;
    //cout<<"debug"<<endl;
    for(int v:G[u]){
        if(!done[v]){
            dfs(cnt[u],v);
        }
    }
    return;
}

int main(){
    int n,q;
    cin>>n>>q;
    for(int i=0;i<n-1;i++){
        int a,b;
        cin>>a>>b;
        a--; b--;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    for(int i=0;i<q;i++){
        int p,x;
        cin>>p>>x;
        p--;
        cnt[p]+=x;
    }
    dfs(0,0);
    for(int i=0;i<n;i++){
        cout<<cnt[i]<<" ";
    }
    cout<<endl;

}

Measured memory_bytes: 24376
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <iostream>
#include <math.h>
#include <assert.h>
#include <vector>
#include <map>

using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
static const double EPS = 1e-9;
static const double PI = acos(-1.0);

#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, s, n) for (int i = (s); i < (int)(n); i++)
#define FOREQ(i, s, n) for (int i = (s); i <= (int)(n); i++)
#define FORIT(it, c) for (__typeof((c).begin())it = (c).begin(); it != (c).end(); it++)
#define MEMSET(v, h) memset((v), h, sizeof(v))

#include <complex>
#include <vector>

typedef complex<double> Point;

static const double INF = 1e+1;

struct Line : public vector<Point> {
  Line() {;}
  Line(Point a, Point b) { push_back(a); push_back(b); }
};

struct Circle {
  Point p;
  double r;
  Circle() {;}
  Circle(Point p, double r) : p(p), r(r) {;}
};

vector<Point> tangentCP(const Circle &c, const Point &p) {
  vector<Point> ret;
  Point vect = c.p - p;
  double d = abs(vect);
  double l = sqrt(norm(vect) - c.r * c.r);
  if (isnan(l)) { return ret; }
  Point v1 = vect * Point(l / d,  c.r / d);
  Point v2 = vect * Point(l / d, -c.r / d);
  ret.push_back(v1);
  if (l > EPS) {
    ret.push_back(v2);
  }
  return ret;
}


struct Interval {
  double start;
  double end;
  Interval() {;}
  Interval(double s, double e) : start(s), end(e) {;}
  bool operator<(const Interval &rhs) const {
    return start < rhs.start;
  }
};

int n, k;
vector<Interval> interval;
map<double, double> memo[1550];

double calc(double start, int index, int rest) {
  if (start < interval[index].start) { start = interval[index].start; }
  if (memo[rest].count(start)) { return memo[rest][start]; }
  if (start >= PI || index == n || rest == 0) { return 0.0; }
  if (interval[index + 1].start <= start) { return calc(start, index + 1, rest); }
  double ret = calc(interval[index].end, index + 1, rest - 1) + interval[index].end - start;
  if (rest < n - index) {
    ret = max(ret, calc(start, index + 1, rest));
  }
  return memo[rest][start] = ret;
}

int main() {
  scanf("%d %d", &n, &k);
  Point center = Point(0, 0);
  REP(i, n) {
    double x, y, r;
    scanf("%lf %lf %lf", &x, &y, &r);
    Point p(x, y);
    Circle c = Circle(p, r);
    vector<Point> tangent = tangentCP(c, center);
    double start = arg(tangent[1]);
    double end = arg(tangent[0]);
    if (start < 0.0 && end < 0.0) { start = 0.0; end = 0.0; }
    if (start <= 0.0) { start = 0.0; }
    if (end < 0.0) { end = PI; }
    interval.push_back(Interval(start, end));
  }
  REP(i, interval.size()) {
    REP(j, interval.size()) {
      if (i == j) { continue; }
      if (interval[j].start <= interval[i].start && interval[i].end <= interval[j].end) {
        interval.erase(interval.begin() + i);
        i--;
        break;
      }
    }
  }
  n = interval.size();
  sort(interval.begin(), interval.end());
  interval.push_back(Interval(PI, PI));
  double ans = calc(0.0, 0, k) / PI;
  printf("%.8f\n", ans);
}

Measured memory_bytes: 18000
import sys, itertools

N = input()


def count(n3, n5, n7):
    r = [3] * n3 + [5] * n5 + [7] * n7
    s = map(lambda x: int("".join(map(str,x))), set(itertools.permutations(r)))
    return len([x for x in s if x <= N])


def comb(n):
    cnt = 0
    for a in range(1, 10):
        for b in range(1, 10):
            for c in range(1, 10):
                if a+b+c==n:
                    cnt+=count(a,b,c)
    return cnt

r = 0
for n in range(3, 10):
    r+=comb(n)
print(r)

Measured memory_bytes: 3204
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define o(a) cout << a << endl
#define int long long
using namespace std;
typedef pair<int, int> P;

signed main(){
    string r[4] = {"dream", "dreamer", "erase", "eraser"};
    string s, t = "";
    cin >> s;
    bool f = true;
    int i = s.size() - 1;
    while(i >= 0){
        string t1 = s.substr(i - 4, 5);
        // cout << t1 << endl;
        if(t1 == r[0] || t1 == r[2]){
            i -= 5;
            continue;
        }
            string t2 = s.substr(i - 5, 6);
            // cout << t2 << endl;
            if(t2 == r[3]){
                i -= 6;
                continue;
            }
            string t3 = s.substr(i - 6, 7);
            if(t3 == r[1]){
                i -= 7;
                continue;
            }
            f = false;
            break;
        }
    cout << (f ? "YES" : "NO") << endl;
}

Measured memory_bytes: 512
#include <cstdio>
#define R register

const int MAXN = 1e6+9, MAXM = 3e6+9;
int n, d[MAXN], pd[MAXN];
int lst[MAXN], nxt[MAXM], to[MAXM], tot = 1;
char vis[MAXM>>1];

inline int rd() {
	R int a; R char c; R bool f = 0;
	while (c = getchar(), c < 48 && c != 45);
	c == 45 ? (a = 0, f = 1) : a = c - 48;
	while (c = getchar(), c >= 48) a = a * 10 + c - 48;
	return f ? -a : a;
}

inline void add(R int u, R int v) {
	to[++tot] = v, nxt[tot] = lst[u], lst[u] = tot, ++d[u];
	to[++tot] = u, nxt[tot] = lst[v], lst[v] = tot, ++d[v];
}

void dfs(R int x) {
	for (R int &i = lst[x]; i; i = nxt[i])
		if (!vis[i >> 1]) {
			vis[i >> 1] = 1 + (x + n == to[i]);
			dfs(to[i]);
		}
}

int main() {
	R int i, fa;
	n = rd();
	for (i = 1; i <= n; i++)
		fa = rd(), add(i, ~fa ? fa : 0);
	for (i = 1; i <= n; i++)
		fa = rd(), add(i + n, ~fa ? fa + n : 0);
	for (i = 1; i <= n; i++)
		if ((d[i] & 1) != (d[i + n] & 1)) {
			puts("IMPOSSIBLE"); return 0;
		}
		else if(d[i] & 1)
			add(i, i + n), pd[i] = tot >> 1;
	dfs(0); puts("POSSIBLE");
	for (i = 1; i <= n; i++)
		printf("%d ", !pd[i] ? 0 : vis[pd[i]] == 1 ? 1 : -1);
	return 0;
}

Measured memory_bytes: 24960
# 未完成　要素と個数を別にしてソートすればいける？
N, M = map(int, input().split())
A = [int(x) for x in input().split()]
cardnumberlist = []
card_dict = {}
for i in range(N):
    if A[i] in card_dict:
        card_dict[A[i]] += 1
    else:
        card_dict[A[i]] = 1
        cardnumberlist.append(A[i])

for j in range(M):
    B, C = map(int, input().split())
    if C in card_dict:
        card_dict[C] += B
    else:
        card_dict[C] = B
        cardnumberlist.append(C)
ans = 0
cardnumberlist = sorted(cardnumberlist, reverse=True)
# print(cardnumberlist)
# print(card_dict)
numofcard = 0
for h in range(N):
    #print(h)
    if numofcard + card_dict[cardnumberlist[h]] > N:
        ans += cardnumberlist[h] * (N - numofcard)
        break
    else:
        ans += cardnumberlist[h] * card_dict[cardnumberlist[h]]
        numofcard += card_dict[cardnumberlist[h]]
print(ans)


Measured memory_bytes: 32064
#![allow(unused_macros, unused_imports, dead_code, non_snake_case)]

use std::io;

fn read_line() -> String {
    let mut s = String::new();
    io::stdin().read_line(&mut s).unwrap();
    s
}

macro_rules! from_line {
    ($($a:ident : $t:ty),+) => {
        $(let $a: $t;)+
        {
            let _line = read_line();
            let mut _it = _line.trim().split_whitespace();
            $($a = _it.next().unwrap().parse().unwrap();)+
            assert!(_it.next().is_none());
        }
    };
}

fn main() {
    loop {
        from_line!(x:u32);
        if x == 0 { break; }
        let mut ans = 0;
        for i in 2..x+1 {
            if i * (i + 1) / 2 > x { break; };
            if i % 2 > 0 {
                if x % i == 0 && x / i > i / 2 {
                    ans += 1;
                }
            } else {
                if x * 2 % i == 0 && x * 2 / i % 2 > 0 && x / i >= i / 2 {
                    ans += 1;
                }
            }
        }
        println!("{}", ans)
    }
}



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

int main() {

  int N, K, x, d;
  cin >> N >> K;
  d = 0;
  for (int i = 0; i < N; i++) {
    cin >> x;
    int tmp = min(K-x,x);
    d += tmp;
  }
  d *= 2;
  cout << d << endl;

}

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

r=[[0 for _ in range(10)] for __ in range(10)]

for i in range(1,n+1):
    q=i%10
    p = i
    while p>=10:
        p //=10
    r[p][q] +=1
res=0
for i in range(1,10):
    for j in range(1,10):
        res += r[i][j]*r[j][i]
print(res)

Measured memory_bytes: 41324
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
#define rep(i,n) for(int i = 0; i < ((int)(n)); i++)   // 0-indexed昇順

int main() {
    int N;
    cin >> N;
    vector<ll> A(N);
    vector<ll> BA(N);
    ll sum = 0;
    rep(i, N) {
        ll B;
        cin >> B;
        A.at(i) = B;
        BA.at(i) = B - i;
        sum += B;
    }
    sort(BA.begin(), BA.end());
    int M = BA.at(N / 2);
    ll sum2 = 0;
    rep(i,N) {
        sum2 += abs(A.at(i) - (M + i));
    }
    printf("%ld\n", sum2);
}

Measured memory_bytes: 3328
import java.util.Scanner;

public class Main {

	public static void main(String[] args) { //GRAPH IS BIDIRECTIONAL
		Scanner input = new Scanner(System.in);
		int N = input.nextInt();
		int X = input.nextInt();
		int Y = input.nextInt();
		int[] dp = new int[N];
		for (int START = 1; START<=N; START++) {
			for (int END = START+1; END<=N; END++) {
				/*if (X>=START&&Y<=END) {
					int index = X-START;
					index+=END-Y;
					index++;
					dp[index]++;
					//System.out.println(START+","+END+" = "+index);
				}
				else {
					dp[END-START]++;
					//System.out.println(START+","+END+" = "+(END-START));
				} */ 
				int curIndex = END-START;
				curIndex = Math.min(curIndex, AB(START,X)+AB(END,Y)+1);
				dp[curIndex]++;
			}
		}
		for (int i = 1; i < N; i++) {
			System.out.println(dp[i]);
		}
	}	
	public static int AB(int A, int B) {
		return Math.abs(A-B);
	}
}

Measured memory_bytes: 22996
#include <cstdio>
#include <algorithm>
#include <iostream>
using namespace std;
static const int MAX = 100001;
int arr[MAX];

int main() {

    int N, k;
    long long global_max, current_max;
    for (; ;) {
        scanf("%d %d", &N, &k);
        if (N == 0 && k == 0) break;
        current_max = 0;
        for (int i = 0; i < k; i++) {
            scanf("%d", &arr[i]);
            current_max += arr[i];
        }
        global_max = current_max;
        for (int i = k; i < N; i++) {
            std::scanf("%d", &arr[i]);
            current_max += arr[i] - arr[i-k];
            global_max = max(global_max, current_max);
        }
        std::cout << global_max << std::endl;
    }
    return 0;
}



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

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define REP(i,k,n) for(int i = k; i < n; i++)
//#define sum(start, end) accumulate(start, end, 0)
#define mmax(start, end) *max_element(start, end)
#define mmin(start, end) *min_element(start, end)
#define pb push_back
#define ALL(x) (x).begin(), (x).end()

typedef long long ll;
typedef string str;

using namespace std;
template <class T = ll> T in() { T _in; cin >> _in; return (_in); }


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

    string N = in<string>();

    int cnt = 1;
    REP(i, 1, N.size()) {
        if(N[i] == N[i-1])
            cnt++;
        else
            cnt = 1;

        if (cnt == 3) break;
    }

    if(cnt == 3)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;

    return 0;
}


Measured memory_bytes: 256
from collections import Counter, defaultdict
import sys
sys.setrecursionlimit(10 ** 5 + 10)
# input = sys.stdin.readline
from math import factorial
import heapq, bisect
import math
import itertools


import queue
from collections import deque




def main():
    high, width = map(int, input().split())
    data = [input().split() for i in range(high)]

    for i in range(high):
        for j in range(width):
            if data[i][j] == 'snuke':
                print('{}{}'.format(chr(j + 65), i + 1))






if __name__ == '__main__':
    main()



Measured memory_bytes: 38508
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vector<int>> vvi;
const int MOD = 1e9 + 7;
const int INF = 2e9;
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; }
int GCD(int x, int y) { return y ? GCD(y, x % y) : x; }
int LCM(int x, int y) { return x * y / GCD(x, y); }

int main(){
    int n;
    cin >> n;
    vector<double> v(n);
    for (int i = 0; i < n; i++){
        cin >> v[i];
    }
    sort(v.begin(), v.end());
    double ans = (v[0]+v[1])/2;
    for (int i = 2; i < n; i++){
        ans = (ans + v[i]) / 2;
    }
    cout << ans << endl;
}

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

int main() {
    int N;
    cin >> N;
    for(int i = 0; i < N; i++) {
        int x;
        cin >> x;
        if(x%2) continue;
        if(x%3 != 0 && x%5 != 0) {
            cout << "DENIED" << endl;
            return 0;
        }
    }
    cout << "APPROVED" << endl;
}


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

void solve(long long A, long long B){
    cout << (A - 1) * (B - 1) << '\n';
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    long long A;
    scanf("%lld",&A);
    long long B;
    scanf("%lld",&B);
    solve(A, B);
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
/*#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
/*template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
*/typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll,ll> pl;
typedef pair<int,int> pii;

#define LOCAL 0
#define dbg(x) cout << #x << " is " << x << "\n"
#define gll(x) scanf("%d",&x)
#define gll2(x,y) scanf("%d%d",&x,&y)
#define gll3(x,y,z) scanf("%d%d%d",&x,&y,&z)
#define gllarr(arr,n) f(i,n) gll(arr[i]);
#define sz(x) ((int)x.size())
#define s(x) sort(x.begin(),x.end())
#define all(v) v.begin(),v.end()
#define rs(v) { s(v) ; r(v) ; }
#define r(v) {reverse(all(v));}
#define pb push_back
#define f(i,n) for(int i=0;i<n;i++)
#define fr(i,n) for(int i=n-1;i>=0;i--)
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define repr(i,a,b) for(int i=a;i>=b;i--)

const ll mod = 1000000007;
const ll inf = (ll)1e17;
const ld eps = 1e-12;
const ll N = (int)1e5 + 5;
const ll LOGN = 19;
const ld PI = 3.14159265358979323846;
ll mul(ll a, ll b, ll m = mod) { return (ll)(a * b) % m;}
ll add(ll a, ll b, ll m = mod) { a += b; if(a >= m) a -= m; if(a < 0) a += m; return a;}
ll power(ll a, ll b, ll m = mod) { if(b == 0) return 1; if(b == 1) return (a % m); ll x = power(a, b / 2, m); x = mul(x, x, m); if(b % 2) x = mul(x, a, m); return x;}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    if (LOCAL) {
        freopen("C:\\Users\\Dishant\\Desktop\\Collection-DEV c++\\input.txt", "r", stdin);
        freopen("C:\\Users\\Dishant\\Desktop\\Collection-DEV c++\\output.txt", "w", stdout);
    }
    int n, k;
    cin>>n>>k;
    if(n % k) cout<<1;
    else cout<<"0";
    return 0;
}

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

int main(){
  int N, M;
  cin >>N >>M;
  
  int num[3]={0,0,0};
  int s[M], c[M];
  bool flag =true;
  for (int i=0; i<M; i++){
    cin >>s[i] >>c[i];
    num[s[i]-1] = c[i];
    for(int j=0; j<i; j++){
      if(s[i] == s[j] && c[i] !=c[j]) flag=false;
    }
    if(s[i]==1 && c[i]==0 && N!=1) flag=false;
  }
   if(flag){
     if(num[0]==0 && N>1) num[0]=1;
     for (int i=0; i<N; i++){
       cout << num[i];
     }
     cout <<endl;
   }else{
       cout <<-1 <<endl;
   }
}



Measured memory_bytes: 256
from fractions import gcd
MOD = 10**9 + 7
H, W, T = map(int, input().split())
ga, gb = gcd(H, T), gcd(W, T)
H //= ga
W //= gb
ans = (pow(2, H, MOD) + pow(2, W, MOD) - 1 + pow(2, gcd(H, W), MOD) - 2) % MOD
print(pow(ans, ga*gb, MOD))


Measured memory_bytes: 64748
using System;
using System.Collections.Generic;//list用
using System.Text.RegularExpressions;//正規表現用
using System.Text;//StringBuilder用
using System.Collections;//ハッシュテーブル用
using System.Linq;


class Program
{
    Hashtable ht = new Hashtable();
    static List<int> s = new List<int>();
    static long result;
    static int K;
    StringBuilder strresult= new StringBuilder("");//Append(str ○○)関数で文字を追加していく
static string tmp;


    static void Main()
    {
        //Modular mo = new Modular();//素数で割った余りを出せで使う★使い方：Modular型で宣言すると、その時点でのその素数で割った余りを保持する変数になる（powべき乗、Fac累乗、nCr組み合わせも関数として存在）()内は初期値
        //Node no = new Node<>();//UnionFind★Find関数で根っこの値を返す（根っこの値が一緒なら同グループ）、Unite関数で二つの木をくっつける
        //Permutation pe = new Permutation<>();//配列＆リストを並べ替えた場合の全ケースを出力★All関数でリスト形式で返す。
        //Treap tr = new Treap<>();//平衡二分木★Insert()関数で挿入、FindIndex()関数で該当する大きさの物が入るべき配列番号を返す。
        // delegate int CFunc();//下関数に使うデリゲータ。コイツと同じ引数と戻り値で関数作って、下の評価式の部分に関数名※（）いらないを入れる。
        //PriorityQueue pr = new PriorityQueue<>(評価式);//優先度付キュー★Enqueue()で格納、Dequeue()で取りだし。引数は評価式（大と小のどちらが優先か）。
        Read1();
        Read2();
        if(K>=3200){}else{tmp="red";}

        Console.WriteLine(tmp);
    }


    static void Read1()
    {
        string tmp = Console.ReadLine();
        K = int.Parse(tmp);
    }

    static void Read2()
    {
        tmp = Console.ReadLine();
    }


    static long Gcd(long a, long b)
    {
        var v = new[] { a, b };
        while (v[1] != 0) { v = new[] { v[1], v[0] % v[1] }; }
        return v[0];
    }

    static long Lcm(long a, long b)
    {
        return a / Gcd(a, b) * b;
    }


}

Measured memory_bytes: 13140
import java.util.*;
public class Main {
    static Scanner sc = new Scanner(System.in);
    static int n, X, Y;
    static char[][]field;
    static int[]dx = {-3, -2, -1, 1, 2, 3}, dy = {-3, -2, -1, 1, 2, 3};
    public static void main(String[] args) {
        while(read()){

        }
    }

    static boolean read(){
        if(!sc.hasNext())return false;
        n = sc.nextInt();sc.nextLine();
        for(int i = 1; i <= n; i++ ){
            field = new char[8][8];
            for(int j = 0; j < 8; j++){
                field[j] = sc.next().toCharArray();
            }
            X = sc.nextInt()-1;
            Y = sc.nextInt()-1;
            sc.nextLine();
            solve(X, Y);
            print(i);
        }
        return true;
    }

    static void solve(int x, int y){
        field[y][x] = '0';
        for(int i = 0; i < dx.length; i++){
            int nx = x + dx[i];
            int ny = y;
            if( 0 <= nx && nx <= 7 && field[ny][nx] == '1'){
                solve(nx, ny);
            }
        }

        for(int i = 0; i < dy.length; i++){
            int nx = x;
            int ny = y + dy[i];
            if( 0 <= ny && ny <= 7 && field[ny][nx] == '1'){
                solve(nx, ny);
            }
        }

    }
    static void print(int dataSet){
        System.out.println("Data "+dataSet+":");
        for(int i = 0; i < field.length; i++){
            for(int j = 0; j < field[i].length; j++){
                System.out.print(field[i][j]);
            }
            System.out.println();
        }
    }
}

Measured memory_bytes: 0
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
int main(){
    char k;
    cin>>k;
    
    if(k=='A') cout<<'T'<<endl;
    if(k=='C') cout<<'G'<<endl;
    if(k=='G') cout<<'C'<<endl;
    if(k=='T') cout<<'A'<<endl;
        
 return 0;   
}

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

template<typename T>
T pow_int(T a, T n) {
    T res = 1;
    while (n > 0) {
        if (n & 1) res = res * a;
        a = a * a;
        n >>= 1;
    }
    return res;
}
long long  ctoi(char a){
    return a - '0';
}

void solve(string S){
    int length = S.size();
    ll sum= 0;
    for (int i=0;i<(1<<(length-1));i++ ){
        vector<ll> ret(1,0);
        ll cnt = 0;
        for (int j =0;j<length;j++){
            ret[ret.size()-1] += pow_int<ll>(10LL,cnt) * ctoi(S[length-1-j]) ;
            if (i &1<<j){
                ret.push_back(0 );
                cnt = 0;
             }else{
                 cnt++;
             }
        }
        ll inc = accumulate(ret.begin(),ret.end(),0LL);
        //printf("%lld\n",inc);
        sum += inc;
    }
    printf("%lld\n",sum);

}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    string S;
    cin >> S;
    solve(S);
    return 0;
}


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

using namespace std;

#define int long long

main()
{
	multiset <int> s;
	
	int n, m;
	cin >> n >> m;
	
	int sum = 0;
	
	for(int i = 1; i <= n; i++)
	{
		int x;
		cin >> x;
		
		s.insert(-x);
		sum += x;
	}
	
	while(m--)
	{
		int p = *s.begin();
		
		if(p % 2 == 0)
			sum += p / 2;
		else
			sum += p / 2 - 1;
		
		p /= 2;
		
		s.erase(s.begin());
		s.insert(p);
	}
	
	cout << sum;
}

Measured memory_bytes: 4992
//保留所有权利。
#include<iostream>
#include<stdio.h>//printするよ
#include<vector>
#include<algorithm>//辞書順はnext_permutationだよ
#include<set>
#include<string>
#include<sstream>
#include<string.h>
#include<time.h>
#include<random>
#include<cmath>
#include<math.h>
#include<queue>
#include<time.h>
#include<iomanip>
#include<locale>
#include<utility>//swapで数値交換するよ
//END OF LIBRARIES.
#define rt "\n"//改行を最速化させるよ
#define rep(i,n) for(int i=0;i<n;i++)
#define rop(i,n) for(int i=1;i<=n;i++)
#define drep(i,n) for(int i=n-1;0<=i;i--)
#define drop(i,n) for(int i=n;0<i;i--)
#define yes(ans) if(ans)cout<<"yes"<<rt;else cout<<"no"<<rt;
#define Yes(ans) if(ans)cout<<"Yes"<<rt;else cout<<"No"<<rt;
#define YES(ans) if(ans)cout<<"YES"<<rt;else cout<<"NO"<<rt;
#define sec(a,b,ans) if(ans)cout<<a<<rt;else cout<<b<<rt;
#define vcin(s,n) rep(i,n)cin>>s[i];//vcin(配列名),(繰り返し回数)
#define vcin(v) for (int i = 0; i < (v).size(); i++) { cin >> (v)[i]; }
#define sort(s) sort(s.begin(),s.end())
#define reve(s) reverse(s.begin(),s.end())
#define asas int ans=0
#define llcncn llint cnt=0
#define llasas llint ans=0
#define cncn int cnt=0
#define smsm int sum=0
#define str srting
#define v vector
#define please return
#define AC 0//おまじないだよ
#define Rapid cin.tie(0);ios::sync_with_stdio(false)
//END OF DEFINE.
using namespace std;
typedef vector<int> vint;
typedef vector<string> vstr;
typedef vector<char> vcha;
typedef vector<double> vdou;
typedef long long int llint;
typedef pair<int, int> pint;
typedef pair<llint, llint> pllint;
typedef vector<llint> vllint;
typedef vector<pint> vpint;
typedef vector<pair<llint, llint>> vpllint;
typedef vector<vector<int>> vvint;
typedef vector<vector<llint>> vvllint;
typedef vector<vector<string>> vvstr;
typedef vector<vector<pint>> vvpint;
typedef vector<bool> vbool;
//printf("%02d:%02d:%02d\n", h, m, s);・・・2文字は埋める・h、m、ｓ
//END OF TYPEDEF.

//最大公約数（GCD）を求めるよ
//最小公倍数（LCM）は＜＜　A × B ÷ GCD　 ＞＞で求まるよ

long long GCD(long long a, long long b) {
	if (b == 0) return a;
	else return GCD(b, a % b);
}
long long LCM(long long a, long long b) {
	return a * b / GCD(a, b);
}

//for A以上B未満でI探索 for (int I = A; i <= B; i++)

//string s = to_string(i);

//char→小文字のほうが大きい数値　　&&　その差は32

//大文字→小文字 文字列のn文字目を大文字で出力→ (char)toupper(a[0])

int a = 0, b = 0, c = 0, x = 0, y = 0, z = 0, n = 0, sum = 0, i = 0;
string s = ""; asas; cncn;

int main(void) {
	cin >> a >> b >> c;
	Yes(c >= a && c <= b);
	please AC;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
const int mod=998244353;
int f[3005][3005];
signed main(){
	int a,b,c,d;
	cin>>a>>b>>c>>d;
	f[a][b]=1;
	for(int i=a;i<=c;++i)
		for(int j=b;j<=d;++j){
			if(i==a&&j==b) continue;
			f[i][j]=(f[i-1][j]*j%mod+f[i][j-1]*i%mod)%mod-f[i-1][j-1]*(i-1)%mod*(j-1)%mod;
			f[i][j]=(f[i][j]+mod)%mod;
		}
	cout<<f[c][d];
	return 0;
}

Measured memory_bytes: 73884