akhauriyash/Code-Regression huggingface dataset:
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskA solver = new TaskA();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskA {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int k = in.nextInt();
            int dr = in.nextInt();
            if (k >= 10)
                out.println(dr);
            else
                out.println(dr + 100 * (10 - k));
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

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

    }
}



Measured memory_bytes: 21460
#include <bits/stdc++.h>
#define rep(i,n)for(long long i=0;i<(n);i++)
using namespace std;
using P=pair<long long,long long>;
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
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; }
 
const ll MOD=1e9+7;
const ll INF=1e18;
const int MAX=510000;
const double pi=acos(-1);
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);  
  
  COMinit();
  int n;
  cin >> n;
  int a[n+1];
  map<int,int>mp;
  rep(i,n+1){
    cin>>a[i];
    mp[a[i]]++;
  }
  int l=-1,r=-1;
  for(auto p:mp){
    if(p.second==2){
      rep(i,n+1){
        if(a[i]==p.first){
          if(l==-1)l=i;
          else r=i;
        }
      }
    }
  }
  
  for(int k=1;k<=n+1;k++){
    cout << (COM(n+1,k)-COM(l+n-r,k-1)+MOD)%MOD<< endl;
  }
  
}


Measured memory_bytes: 18304
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>

using namespace std;

int main() {
    long long n,k,ans=0;
    long long max,min;
    cin >> n>>k;
    for (long long i = k; i <= n+1; i++) {
      max=(n+n-i+1)*i/2;
      min=i*(i-1)/2;
      ans=ans+max-min+1;
    }
    if(k==n+1){
      cout <<1;
    }
    else cout << ans%1000000007;
}

Measured memory_bytes: 3604
#include<iostream>
using namespace std;
int main(){
  int m,n;
  while(cin >> m >> n){
    if(m==0&&n==0) break;
    int index[n];
    int max = 1500000;
    int min = 0;
    for(int i=0;i<n;i++){
      cin >>  index[i];
      min = index[i] > min ? index[i] : min;
    }
    int tyuou = 0;
    while(min!=max){
      tyuou = (max + min) / 2;
      int sum = 0;
      int count = 1;
      for(int i=0;i<n;i++){
        if(sum+index[i]>tyuou){
          count++;
          sum = index[i];
        } else {
          sum += index[i];
        }
      }
      if(count>m){
        min = tyuou + 1;
      } else {
        max = tyuou;
      }
    }
    cout << max << endl;
  }
}



Measured memory_bytes: 3012
using System;
using System.Linq;
class Problem
{
    static void Main()
    {
        int[] num = Console.ReadLine().Split().Select(int.Parse).ToArray();
        int a = num[0];
        int b = num[1];
        if (b % a == 0)
        {
            Console.WriteLine(b + a);
        }
        else
        {
            Console.WriteLine(b - a);
        }
    }
}

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

struct Graph{
	vector<int> point,seen;
	vector<int> cnt;
	vector<vector<int>> e;
	
	Graph(int n) : e(n,vector<int>()),cnt(n),point(n),seen(n) {}
	void dfs(int v,int &np){
		seen.at(v) = 1;
		np += point.at(v);
		for(auto nv:e.at(v)){
			if(seen.at(nv)==1) continue;
			dfs(nv,np);
		}
		cnt.at(v) = np;
		np -= point.at(v);
		return;
	}
};

int main() {
	int n,q;
	cin >> n >> q;
	Graph graph(n);
	for(int i=0; i<n-1; i++){
		int a,b;
		cin >> a >> b;
		a--;
		b--;
		graph.e.at(a).push_back(b);
		graph.e.at(b).push_back(a);
	}
	for(int i=0; i<q;i++){
		int p,q;
		cin >> p >> q;
		p--;
		graph.point.at(p) += q;
	}
	int np{};
	graph.dfs(0,np);
	
	for(int i=0; i<n; i++) cout << graph.cnt.at(i) << ' ';
	cout << endl;
}

Measured memory_bytes: 23168
#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;

typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;
typedef pair <ll, ll> pll;
typedef pair <int, int> pii;

typedef tree <ll, null_type, less <ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
// order_of_key(val): returns the number of values less than val
// find_by_order(k): returns an iterator to the kth largest element (0-based)

#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define all(a) a.begin(), a.end()
#define sz(a) (ll)(a.size())
#define endl "\n"

template <class Ch, class Tr, class Container>
basic_ostream <Ch, Tr> & operator << (basic_ostream <Ch, Tr> & os, Container const& x) 
{
    os << "{ ";
    for(auto& y : x) 
    {
        os << y << " ";
    }
    return os << "}";
}

template <class X, class Y>
ostream & operator << (ostream & os, pair <X, Y> const& p) 
{
    return os << "[" << p.ff << ", " << p.ss << "]";
}

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

    return gcd(b, a%b);
}

ll modexp(ll a, ll b, ll c)
{   
    a%=c;

    ll ans = 1;

    while(b)
    {
        if(b&1)
        {
            ans = (ans*a)%c;
        }

        a = (a*a)%c;
        b >>= 1;
    }

    return ans;
}

const ll L = 1e6+5;
const ll mod = 1e9+7;

vector <ll> least_prime_factor(L, 0);

void sieve()
{
    least_prime_factor[0] = 1;
    least_prime_factor[1] = 1;

    for(ll i=2; i<L; i++)
    {
        if(least_prime_factor[i] == 0)
        {
            for(ll j=i; j<L; j+=i)
            {
                least_prime_factor[j] = i;
            }
        }
    }
}

map <ll, ll> m;

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

    sieve();
    
    ll N;
    cin >> N;

    vector <ll> a;

    for(ll i=0; i<N; i++)
    {
        ll t;
        cin >> t;

        a.pb(t);

        map <ll, ll> temp;

        while(t > 1)
        {
            ll f = least_prime_factor[t];
            temp[f]++;
            t /= f;
        }   

        for(auto j: temp)
        {
            m[j.ff] = max(m[j.ff], j.ss);
        }
    }

    ll l = 1;

    for(auto i: m)
    {
        l *= modexp(i.ff, i.ss, mod);
        l %= mod;
    }

    ll ans = 0;

    for(ll i=0; i<N; i++)
    {
        // ans += (l/a[i]);
        ans += ((l * modexp(a[i], mod-2, mod))%mod);
        // ans %= mod;
    }

    cout << ans%mod << endl;

    return 0;
}

Measured memory_bytes: 8832
#include<iostream>
#include<cstdio>
#include<queue>
#include<cmath>
#include<algorithm>
#include<map>
#include<cstring>
#define For(i,j,k) for(int i=j;i<=k;++i)
#define Dow(i,j,k) for(int i=k;i>=j;--i)
#define ll long long
using namespace std;
inline ll read()
{
	ll t=0,f=1;char c=getchar();
	while(c<'0'||c>'9')	{if(c=='-')	f=-1;c=getchar();}
	while(c<='9'&&c>='0')	t=t*10LL+c-48LL,c=getchar();
	return t*f;
}
int n,m;
char s[1001][1001];
int main()
{
	n=read();m=read();
	For(i,1,n)	
		scanf("%s",s[i]+1);	
	For(i,1,n)
	{
		putchar('#');
		if(i&1)
			For(j,2,m-1)	putchar('#');
		else
			For(j,2,m-1)	if(s[i][j]=='#')	putchar('#');else	putchar('.');
		puts(".");
	}
	puts("");
	For(i,1,n)
	{
		putchar('.');
		if(!(i&1))	
			For(j,2,m-1)	putchar('#');
		else
			For(j,2,m-1)	if(s[i][j]=='#')	putchar('#');else	putchar('.');
		putchar('#');
		puts("");
	}
}

Measured memory_bytes: 1280
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef std::pair<int,int> pair2;
typedef std::pair<int,pair2> pair3;
const ll INF = 1LL<<60;

int main(){
    ll N;
  cin >>N;
  ll h[N];
  for(ll i=0;i<N;i++){
  cin >>h[i];
  }
ll dp[N];
  for(ll i=1;i<N;i++){dp[i]=INF;}
  dp[0]=0;

  for(ll i=0;i<N;i++){
	dp[min(i+1,N)]=min(dp[min(i+1,N)],dp[i]+abs(h[min(i+1,N)]-h[min(i,N)]));
	dp[min(i+2,N)]=min(dp[min(i+2,N)],dp[i]+abs(h[min(i+2,N)]-h[min(i,N)])); 
 // cout<<i<<";"<<dp[i]<<endl;
  }
  //  cout<<dp[i]<<endl;
    
  
  cout<<dp[N-1]<<endl;
  
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
 
int main(){
	cin.tie(0),ios::sync_with_stdio(false);
	int64_t x; cin>>x;
	int64_t ans=x/11*2;
	if(int y=x%11){
		if(y>6)++ans;
		++ans;
	}
	cout<<ans<<"\n"s;
}

Measured memory_bytes: 3648
#include<iostream>
#include<algorithm>
#include<string>
#include<cstring>
#include<cstdlib>
#include<queue>
#include<vector>
#include<map>
#include<cmath>
#include<list>
#include<set>
using namespace std;
#define fr first
#define sc second
#define INFTY 1000000
typedef pair< int,int > Pt;
typedef pair< pair<Pt,Pt>,int > P;
Pt A,B;
int h,w,dx[]={0,1,0,-1,0},dy[]={1,0,-1,0,0};
char mas[20][20];
int used[20][20][20][20][11];
string pattern;
pair<int,Pt> bfs();
bool judge(int,int);
int main(){
  while(cin >> h >> w && h){
    for(int i=0;i<h;i++){
      for(int j=0;j<w;j++){
        cin >> mas[i][j];
        if(mas[i][j] == 'A') A = Pt(i,j);
        else if(mas[i][j] == 'B') B = Pt(i,j);
      }
    }
    cin >> pattern;
    pair<int,Pt> ans = bfs();
    if(ans.fr == -1) cout << "impossible" << endl;
    else cout << ans.fr << " " << ans.sc.fr << " " << ans.sc.sc << endl;
  }
}
pair<int,Pt> bfs(){
  map<char,int> tmp;
  tmp['5'] = 4,tmp['8'] = 3,tmp['6'] = 0,tmp['4'] = 2,tmp['2'] = 1;
  queue<P> que;
  memset(used,-1,sizeof(used));
  que.push(P(make_pair(A,B),-1));
  while(!que.empty()){
    P p = que.front();
    que.pop();
    if(p.fr.fr == p.fr.sc){
      return (make_pair(used[p.fr.fr.fr][p.fr.fr.sc][p.fr.sc.fr][p.fr.sc.sc][p.sc]+1,Pt(p.fr.fr.fr,p.fr.fr.sc)));
    }
    int cnt = (p.sc + 1) % pattern.size();
    int bx = p.fr.sc.fr + dx[tmp[pattern[cnt]]];
    int by = p.fr.sc.sc + dy[tmp[pattern[cnt]]];
    if(!judge(bx,by)) bx = p.fr.sc.fr , by = p.fr.sc.sc;
    for(int i=0;i<5;i++){
      int ax = p.fr.fr.fr + dx[i] , ay = p.fr.fr.sc + dy[i];
      if(!judge(ax,ay) || mas[ax][ay] == '#') ax = p.fr.fr.fr , ay = p.fr.fr.sc;
      if(used[ax][ay][bx][by][cnt] == -1){
        que.push(P(make_pair(Pt(ax,ay),Pt(bx,by)),cnt));
        used[ax][ay][bx][by][cnt] = used[p.fr.fr.fr][p.fr.fr.sc][p.fr.sc.fr][p.fr.sc.sc][p.sc] + 1;
      }
    }
  }
  return make_pair(-1,Pt(0,0));
}
bool judge(int x,int y){
  return (x >= 0 && x < h && y >= 0 && y < w ? true : false);
}

Measured memory_bytes: 8116
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;
const int M = 1e7;
int si[] = {-1, 0, 1, 0};
int sj[] = {0, -1, 0, 1};

int main(){
  int x,y;
  cin >> x >> y;

  if (x == 1 && y == 1){ 
    cout << 1000000 << endl;
    return 0;
  }

  int ans = 0;
  if (x == 1) ans += 300000;
  if (x == 2) ans += 200000;
  if (x == 3) ans += 100000;  
  if (y == 1) ans += 300000;
  if (y == 2) ans += 200000;
  if (y == 3) ans += 100000;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3624
import java.util.*;

class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int A = Integer.parseInt(sc.next());
        long B = Long.parseLong(sc.next());
        long N = Long.parseLong(sc.next());
        long amari = N % B;
        if(N < B) {
            System.out.println(floor(A*N/B) - (A * floor(N/B)));
        }else {
            if(floor(A/B) - A * floor(1/B) >= floor(A) - A * floor(1)) {
                System.out.println(floor((A * (B-1))/B) - A * floor((B-1)/B));
            }else if(floor(A/B) - A * floor(1/B) < floor(A) - A * floor(1)) {
                if(floor((A * (N - amari - 1))/B) - A * floor((N - amari - 1)/B) < floor((A * N) / B) - A * floor(N/B)) {
                    System.out.println(floor((A * N) / B) - A * floor(N/B));
                }else {
                    System.out.println(floor((A * (N - amari - 1))/B) - A * floor((N - amari - 1)/B));
                }
            }
        }
        
    }
    
    public static long floor(double t) {
        return (long)t;
    }
    
    public static long floor(long t) {
        return (long)t;
    }
}

Measured memory_bytes: 35624
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <complex>
#include <set>
using namespace std;

int main(){
    int n;
    string s;
    cin >> n >> s;
    vector<int> W;
    vector<int> E;
    int i = 0;
    int min = 999999;
    int count = 0;
    if(s[i] == 'W'){
        W.push_back(1);
        E.push_back(0);
    }else{
        W.push_back(0);
        E.push_back(1);
    }
    for(i = 1; i < n; i++){
        if(s[i] == 'W'){
            W.push_back(W[i-1] + 1);
            E.push_back(E[i-1]);
        }else{
            W.push_back(W[i-1]);
            E.push_back(E[i-1] + 1);
        }
    }
    for(i = 0; i < n; i++){
        count = 0;
        if(i == 0){
            count = E[n-1] - E[i];
        }else if(i == n-1){
            count = W[n-2] - 0;
        }else{
            count = W[i-1] - 0 + E[n-1] - E[i];
        }
        if(min > count){
            min = count;
        }
    }
    cout << min << endl;
}

Measured memory_bytes: 3960
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <limits.h>
#include <string.h>
int main()
{
    int X , Y , Z;
    scanf("%d %d %d",&X,&Y,&Z);
    int A,B,C;
    A=X;
    B=Y;
    C=Z;

    X=Y;
    Y=A;


    Z=X;
    X=C;
 printf("%d %d %d",X,Y,Z);


    return 0;
}


Measured memory_bytes: 128
import java.util.Scanner;

public class Main {
  public static void main(String[] args){
    new Main();
  }
  public Main(){
    Scanner sc = new Scanner(System.in);
    while(true){
      int n = sc.nextInt();
      if(n==0)break;
      int[] a = new int[n];
      for(int i=0;i<n;i++){
        a[i] = sc.nextInt();
      }
      int ans = 1000000000;
      for(int mask=0;mask<(1<<n);mask++){
        int gonta = 0;
        int ponta = 0;
        for(int i=0;i<n;i++){
          if( ((mask>>i)&1) == 1 ) gonta += a[i];
          else ponta += a[i];
        }
        ans = Math.min(ans,Math.abs(ponta-gonta));
      }
      System.out.println(ans);
    }
  }
}

Measured memory_bytes: 28432
#include <stdio.h>

int main() {
  int i, j, k;
  int n, x, count;

  while (1) {
    scanf ("%d %d", &n, &x);
    if ( n == 0 && x == 0) break;

    count = 0;
    for (i = 1 ; i <= n-2 ; i++) {
      for (j = i+1 ; j <= n-1 ; j++) {
        for (k = j+1 ; k <= n ; k++) {
          if (x == i + j + k)
              count++;
        }
      }
    }

    printf ("%d\n", count);
  }

  return 0;
}

Measured memory_bytes: 600
fun main(args:Array<String>) {
    val num = (1..2).map { readLine()!! }
    val maxLen = num.map { it.length }.max()!!
    val (a,b) = num.map { it.padStart(maxLen, '0') }
    if(a > b) {
        println("GREATER")
    } else if(a < b) {
        println("LESS")
    } else {
        println("EQUAL")
    }
}


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

#define rep(i,k,n) for(int (i)=(k);(i)<(n);(i)++)
#define max(a,b) (a)>(b)?(a):(b)
#define min(a,b) (a)<(b)?(a):(b)
#define llong long long

int main(){
	llong A,V; scanf("%lld %lld",&A,&V);
	llong B,W; scanf("%lld %lld",&B,&W);
	llong T; scanf("%lld",&T);
  	llong dist;
  	if( A-B < 0 ) dist = B-A;
  	else dist = A-B;
	if( dist <= (V-W)*T ) printf("YES");
	else printf("NO");
	return 0;
}


Measured memory_bytes: 1728
n,m = map(int,input().split())
li = [[0,0] for _ in range(n+1)]

ans = 0
pena = 0
for i in range(m):
    p,s = input().split()

    if s=="WA":
        li[int(p)][0] += 1
    else:
        if li[int(p)][1] == 0:
            ans += 1
            pena += li[int(p)][0]
            li[int(p)][1] = 1

print(ans,pena)


Measured memory_bytes: 13172
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;++i)
typedef long long ll;
struct Point{int x,y,id;};
bool linkx(Point &p1,Point &p2){
	return p1.y==p2.y ? p1.x<p2.x : p1.y<p2.y;
}
bool linky(Point &p1,Point &p2){
	return p1.x==p2.x ? p1.y<p2.y : p1.x<p2.x;
}

#define all(a) a.begin(),a.end()

typedef pair<ll,int> edge;//cost,to id
#define INF LLONG_MAX

#define SIZE 400010

int main(void){
	int M,N,K,X,Y;
	cin>>M>>N>>K;
	vector<edge> g[SIZE];
	vector<Point> vp(K+1);
	vector<ll> dp(SIZE);
	rep(i,K){
		cin>>X>>Y;
		vp[i]={X,Y,i};
	}
	vp[K]={M,N,K};

	//push switch
	rep(i,K){
		g[vp[i].id*2].push_back({1,vp[i].id*2+1});
		g[vp[i].id*2+1].push_back({1,vp[i].id*2});
	}

	//linkx
	sort(all(vp),linkx);
	rep(i,K){
		if(vp[i].y==vp[i+1].y){
			Point p1=vp[i],p2=vp[i+1];
			int cost=abs(p1.x-p2.x);
			g[p1.id*2].push_back({cost,p2.id*2});
			g[p2.id*2].push_back({cost,p1.id*2});
		}
	}

	//linky
	sort(all(vp),linky);
	if(vp[0].x!=1){
		cout<<-1<<endl;
		return 0;
	}

	rep(i,K){
		if(vp[i].x==vp[i+1].x){
			Point p1=vp[i],p2=vp[i+1];
			int cost=abs(p1.y-p2.y);
			g[p1.id*2+1].push_back({cost,p2.id*2+1});
			g[p2.id*2+1].push_back({cost,p1.id*2+1});
		}
	}

	rep(i,K*2+2)dp[i]=INF;
	priority_queue<edge,vector<edge>,greater<edge>> q;
	dp[vp[0].id*2+1]=vp[0].y-1;
	q.push({dp[vp[0].id*2+1],vp[0].id*2+1});

	while(q.size()){
		edge u=q.top(); q.pop();
		int id=u.second;
		if(id>=2*K){
			cout<<u.first<<endl;
			return 0;
		}
		if(dp[id] < u.first)continue;
		for(auto e:g[id]){
			if(dp[e.second] > dp[id]+e.first){
				dp[e.second] = dp[id]+e.first;
				q.push({dp[e.second],e.second});
			}
		}
	}
	cout<<-1<<endl;
	return 0;
}

Measured memory_bytes: 51792
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <climits>
#include <bitset>
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<pair<int,int>> vpii;
typedef vector<vector<int>> vvi;
typedef vector<vector<char>> vvc;
typedef vector<vector<string>> vvs;
#define rep(i,n) for(int i=0;i<n;i++)
#define fin(ans) cout<<(ans)<<endl
#define P 1000000007
#define STI(s) atoi(s.c_str())//string to int
#define mp(p,q) make_pair(p,q)
#define Sort(a) sort(a.begin(),a.end())
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 = INT_MAX;
const long long LLINF = 1LL<<60;
//g++ -std=c++1z temp.cpp
//./a.exe
    
int main(void){ios::sync_with_stdio(false);cin.tie(0);
//////////////////////////////////////////////////////
    
int s1,s2,s3;
cin >> s1 >> s2 >> s3;
if (s1 ==5&&s2 ==5&&s3 ==7)
{
    cout << "YES" << endl;
}else if (s1 ==5&&s3 ==5&&s2 ==7)
{
    cout << "YES" << endl;
}else if (s3 ==5&&s2 ==5&&s1 ==7)
{
    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){
    	Scanner scan = new Scanner(System.in);
      	int n = scan.nextInt();
      	int d = scan.nextInt();
      	int sight = 2 * d + 1;
      	int ans = (n / sight) ;
      	if(n % sight == 0) {
        	System.out.print(ans);
        }
      	else {
        	System.out.print(ans + 1);
        }
    }
}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
#ifdef ENABLE_DEBUG_OUTPUT
#define DEBUG_LOG(s) cout << s << endl;
#else
#define DEBUG_LOG(s) void();
#endif

int lcs(string a, string b) {
    vector<vector<int>> dp(a.size(), vector<int>(b.size(), 0));
    //init
    dp[0][0] = (a[0] == b[0]);
    for (auto i = 1; i < (int)a.size(); i++) dp[i][0] = dp[i - 1][0] or (a[i] == b[0]);
    for (auto i = 1; i < (int)b.size(); i++) dp[0][i] = dp[0][i - 1] or (a[0] == b[i]);
    // dp
    for (auto i = 1; i < (int)a.size(); i++) {
        for (auto j = 1; j < (int)b.size(); j++) {
            if(a[i] == b[j]) dp[i][j] = dp[i - 1][j - 1] + 1;
            else dp[i][j] = max(dp[i - 1][j], dp[i][j - 1]);
        }
    }

//    for (auto i = 0; i < (int)b.size(); i++) {
//        for (auto j = 0; j < (int)a.size(); j++) {
//            cout << dp[j][i] << " ";
//        }
//        cout << endl;
//    }
    return dp[a.size() - 1][b.size() - 1];
}

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

    for (auto i = 0; i < q; i++) {
        string x, y; cin >> x >> y;
        cout << lcs(x, y) << endl;
    }

    return 0;
}


Measured memory_bytes: 6860
using System;
using System.Text;
using System.Collections.Generic;
using System.Collections;
using static System.Math;
using System.Linq;
using static System.Array;

namespace ConsoleApp2
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = long.Parse(Console.ReadLine());
            //var c = Console.ReadLine();
            var A = Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToArray();
            var sum = 0L;
            for (int i = 0; i < N; i++)
            {
                sum ^= A[i];
            }

            var ans = new long[N];
            for (int i = 0; i < N; i++)
            {
                ans[i] = (sum ^ A[i]);
            }



            Console.WriteLine(String.Join(" ",ans));
            


        }
    }

}


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

//conversion
//------------------------------------------
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();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef long long LL;
typedef pair<int, int> PII;
typedef pair<LL,LL> PLL;
typedef map<int,int> MII;
typedef queue<int> QI;
typedef queue<PII> QPII;
typedef stack<int> SI;
typedef stack<PII> SPII;
typedef deque<int> DI;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
typedef vector<bool> VB;
typedef vector<VB> VVB;
typedef vector<double> VD;
typedef vector<VD> VVD;
typedef vector<string> VS;
typedef vector<VS> VVS;
typedef vector<char> VC;
typedef vector<VC> VVC;
typedef vector<PII> VPII;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define PF push_front
#define POB pop_back()
#define POF pop_front()
#define MP make_pair
#define SZ(a) int((a).size())
#define SQ(a) ((a)*(a))
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define LB lower_bound
#define UB upper_bound
#define SORTR(c) sort((c).begin(), (c).end(), greater<int>())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define FORR(i,a,b) for(int i = (b-1);i>=a;i--)
#define REPR(i,n) RFOR(i,0,n)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const LL INF = INT_MAX;
const LL LINF = LLONG_MAX;
const LL MOD = 1e9+7;
const LL MODD = 998244353;

//other
//-------------------------------------------
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define FI first
#define SE second

//memo
// setprecision()

VI dx = {1,0,-1,0,1,1,-1,-1};
VI dy = {0,1,0,-1,1,-1,1,-1};

LL Gcd(LL a, LL b) {
  return __gcd(a,b);
}

LL Lcm(LL a, LL b) {
  LL abd = Gcd(a,b);
  LL x = a / abd, y = b / abd;
  
  return x*y*abd;
}


LL RepSqu(LL N, LL P, LL M) {
  if(N == 0) {
    return 0;
  }
  
  if(P == 0) {
    return 1;
  }
  if(P%2 == 0) {
    LL t = RepSqu(N, P/2, M);
    return t*t % M;
  }
  return (N * RepSqu(N, P-1, M)) % M;
}


int main() {
  
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  int L;
  cin >> L;
  
  double B = (double)L/(double)3;
  
  cout << setprecision(9) << B*B*B << endl;
  
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
struct Fast { Fast() { cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20);} } fast;

vector<int> E(vector<int> a){
    return {a[3], a[1], a[0], a[5], a[4], a[2]};
}
vector<int> W(vector<int> a){
    return E(E(E(a)));
}
vector<int> S(vector<int> a){
    return {a[4], a[0], a[2], a[3], a[5], a[1]};
}
vector<int> N(vector<int> a){
    return S(S(S(a)));
}
random_device rnd;
int main() {
    int counter = 0;
    vector<int> cu(6);
    vector<int> cu2(6);
    for (int i = 0; i < 6; i++){    
        cin >> cu[i];
    }
    for (int i = 0; i < 6; i++){
        cin >> cu2[i];
    }
    

    while (1) {
        int k = rnd() % 2;
        if (k % 2) {
            cu = E(cu);
        } else {
            cu = S(cu);
        }
        if (cu == cu2) {
            cout << "Yes" << endl;
            break;
        }
        counter++;
        if (counter == 1000000) {
            cout << "No" << endl;
            break;
        }
    }
}


Measured memory_bytes: 3244
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var a, b int

func readVariables() {
	a, b = nextInt(), nextInt()
}

func main() {
	readVariables()
	if a > b {
		a, b = b, a
	}
	for i := 0; i < b; i++ {
		fmt.Print(a)
	}
	fmt.Println()
}

var scanner *bufio.Scanner

func init() {
	scanner = bufio.NewScanner(os.Stdin)
	scanner.Split(bufio.ScanWords)
}
func nextInt() int {
	if !scanner.Scan() {
		panic("No more token.")
	}
	num, err := strconv.Atoi(scanner.Text())
	if err != nil {
		panic("nextInt(): cannot convert to int: " + scanner.Text())
	}
	return num
}


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

int main() {
    int64_t N, K;
    cin >> N >> K;

    vector<int64_t> L(K), R(K);
    for (int64_t i = 0; i < K; i++) {
        cin >> L[i] >> R[i];
    }

    int64_t ans = 0;
    constexpr int64_t MOD = 998244353;

    vector<int64_t> dp(N, 0);
    dp[0] = 1;
    for (int64_t i = 0; i < N; i++) {
        //配る
        for (int64_t j = 0; j < K; j++) {
            if (i + L[j] < N) {
                (dp[i + L[j]] += dp[i]) %= MOD;
            }
            if (i + R[j] + 1 < N) {
                (dp[i + R[j] + 1] += MOD - dp[i]) %= MOD;
            }
        }

        if (i > 0) {
            (dp[i + 1] += dp[i]) %= MOD;
        }
    }

    cout << dp[N - 1] << endl;
}

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

#define ALL(g) (g).begin(),(g).end()
#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i, x, n) for(int i = x; i >= n; i--)
#define rrep(i, n) RREP(i,n,0)
#define pb push_back
#define show_table(n, k, table) rep(i,n){ rep(j,k) cout << table[i][j] << " "; cout << endl;}

using namespace std;

template<class T> inline void chmax(T& a,T const& b){a=max(a,b);}
template<class T> inline void chmin(T& a,T const& b){a=min(a,b);}

using ll = long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;

// 変数ダンプ先。coutかcerr
#define DUMPOUT cout
 
// 提出時はコメントアウト
#define DEBUG_
 
#ifdef DEBUG_
#define DEB
#else
// DEB と打つとデバッグ時以外はコメントアウトになる
#define DEB /##/
#endif
 
// 変数ダンプ用マクロ。デバッグ時以外は消滅する
// 引数はいくつでもどんな型でも可（ストリーム出力演算子があればOK）
#define dump(...) DEB DUMPOUT<<"  "; \
DUMPOUT<<#__VA_ARGS__<<" :["<<__LINE__<<":"<<__FUNCTION__<<"]"<<endl; \
DUMPOUT<<"    "; \
dump_func(__VA_ARGS__)
 
// デバッグ用変数ダンプ関数
void dump_func() {
    DUMPOUT << endl;
}
template <class Head, class... Tail>
void dump_func(Head&& head, Tail&&... tail)
{
    DUMPOUT << head;
    if (sizeof...(Tail) == 0) {
        DUMPOUT << " ";
    }
    else {
        DUMPOUT << ", ";
    }
    dump_func(std::move(tail)...);
}
 
// vector出力
template<typename T>
ostream& operator << (ostream& os, vector<T>& vec) {
    os << "{";
    for (int i = 0; i<vec.size(); i++) {
        os << vec[i] << (i + 1 == vec.size() ? "" : ", ");
    }
    os << "}";
    return os;
}
 
const int mod=1e9+7,INF=1<<30;
const double EPS=1e-12,PI=3.1415926535897932384626;
const ll lmod = 1e9+7,LINF=1LL<<60;

int main(){
  // cin.tie(0);
  // ios::sync_with_stdio(false);
  int N; scanf("%d",&N);
  vl x(N),y(N);
  rep(i,N){
    scanf("%lld%lld",&x[i],&y[i]);
    if(x[i]>y[i]) swap(x[i],y[i]);
  }
  vi ind(N);
  iota(ind.begin(),ind.end(),0);
  sort(ind.begin(),ind.end(),[&](int l,int r){return x[l]<x[r];});
  ll ma = 0LL, mi = LINF;
  ll ans;
  ll rma = 0LL, bma = x[ind[N-1]], rmi = LINF, bmi = x[ind[0]];
  rep(i,N){
    // ma       -> r, mi       -> b
    // large(y) -> r, small(x) -> b
    chmax(rma,y[i]);
    chmin(rmi,y[i]);
  }
  ans = (rma - rmi) * (bma - bmi);
  chmin(rmi,x[ind[0]]);
  chmax(rma,x[ind[N-1]]);
  ll nxt1 = LINF, nxt2 = 0;
  ll bmi2 = LINF;
  for(auto i:ind){
    chmin(bmi2,nxt1);
    chmax(bma,nxt2);
    nxt1 = nxt2 = y[i];
    bmi = min(x[i],bmi2);
    // dump(bmi,bma);
    // dump(rmi,rma);
    chmin(ans,(rma - rmi) * (bma - bmi));
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 4096
def main():
    import math

    A,B = (int(i) for i in input().split())

    eight = math.ceil(A / 0.08)
    ten = math.ceil(B / 0.1)
    #print(eight, ten)
    ans = max(eight, ten)
    ans8 = math.floor(ans * 0.08)
    ans10 = math.floor(ans * 0.1)
    #print(ans8, ans10)
    if ans8 == A and ans10 == B:
        print(ans)
    else:
        print(-1)


if __name__ == '__main__':
    main()


Measured memory_bytes: 38384
#include <stdio.h>
#define M 101
int main(){
    int n,i,d[M];
    
    scanf("%d",&n);
    for(i=1;i<=n;i++){
        scanf("%d",&d[i]);
    }
    for(i=n;i>=1;i--){
        if(i==1)printf("%d",d[i]);
        else printf("%d ",d[i]);
    }
    printf("\n");
    return 0;
}


Measured memory_bytes: 2116
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstring>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <vector>

#define mod 1000000007
#define INF2 9999999999
#define INF (1 << 30)
#define rep(i, n) for(int(i) = 0; (i) < (n); (i)++)

using namespace std;
using ll = __int64_t;

int dx[] = {1, 0, -1, 0};
int dy[] = {0, 1, 0, -1};
int DX[] = {1, 1, 0, -1, -1, -1, 0, 1};
int DY[] = {0, -1, -1, -1, 0, 1, 1, 1};

bool comp(const pair<int, ll>& p1, const pair<int, ll>& p2){
    return p1.second > p2.second;
}

void solve(){
    int n, m;
    int l[100005], r[100005];
    int lmax=0, rmin=INF;

    cin >> n >> m;
    for(int i = 0; i < m; i++){
        cin >> l[i] >> r[i];
        lmax = max(lmax, l[i]);
        rmin = min(rmin, r[i]);
    }
    cout << max((rmin - lmax + 1), 0) << endl;
}

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

Measured memory_bytes: 1024
// include
#include <iostream>
#include <algorithm>

// using namespace 
using namespace std;

// typedef
typedef unsigned long long ull;
typedef unsigned int uint;
typedef pair<int, int> PII;

// macro
#define REP(index, num) for (auto index = 0; index < num; index++)
#define FOR(index, num) for (auto index = 1; index <= num; index++)

#define MAX_NUM 110
#define INF (int)1e9

// global
int N;
int A, B;
int P[MAX_NUM];

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

  int lowerA = 0;
  int upperAp1LowerB = 0;
  int upperBp1 = 0;

  REP(nId, N)
  {
    cin >> P[nId];

    if (P[nId] <= A)
      lowerA++;
    else if (A + 1 <= P[nId] && P[nId] <= B)
      upperAp1LowerB++;
    else if (B + 1 <= P[nId])
      upperBp1++;
  }

  int minVal = min(lowerA, min(upperAp1LowerB, upperBp1));

  cout << minVal << endl;

}


Measured memory_bytes: 256
#include<map>
#include<iostream>
#include<iomanip>
//#include<conio.h>
#include<algorithm>
#include<vector>
#include<set>
#include<cmath>
#include<stdio.h>
#include<fstream>
#include<assert.h>
#include<time.h>
#include<queue>
#include<deque>
#include<stack>
#include<list>
#include<sstream>
#include<string.h>
#define mp make_pair
#define ll long long
#define all(v) v.begin(),v.end()
#define memset(a,b) memset(a,b,sizeof(a))
using namespace std;
const int INF=1e9;
inline void write(int x){
    if(x<0) putchar('-'),x=-x;
    if(x>9) write(x/10);
    putchar(x%10+'0');
}
inline void rd(int &val){
    int x=0;
    int f=1;
    char ch=getchar();
    while((ch<'0'||ch>'9')&&ch!='-') ch=getchar();
	if(ch=='-'){
		f=-1;
		ch=getchar();
	}
    while(ch>='0'&&ch<='9'){
        x=x*10+ch-'0';
        ch=getchar();
    }
    val=x*f;
}
int x,y;
bool ok=1;
int can[1005][1005],n,m;
int dp[1005];
int col[1005],cha,best;
int cnt[3],add,ta,tb;
inline int rds(int x){return ((x-1)*x)/2;}
inline bool dfs(int x,int co){
//	cout<<x<<' '<<co<<endl;
	if(col[x]==(!co)) return 0;
	if(col[x]==co) return 1;
	col[x]=co;
    cnt[co]++;
	for(int i=0;i<n;i++) if(can[x][i]) if(!dfs(i,!co)) return 0;
	return 1;
}
int main(){
	ios_base::sync_with_stdio(false);
	int i,j,x,y;
	cin>>n>>m;
	memset(can,1);
	for(i=0;i<=n;i++) can[i][i]=0;
	for(i=0;i<m;i++){
		cin>>x>>y;
		x--,y--;
		can[x][y]=0;
		can[y][x]=0;
	}
	memset(col,-1);
	dp[0]=1;
	for(i=0;i<n;i++){
		if(col[i]==-1){
//			for(j=1;j<=n;j++) cout<<col[j]<<' ';
//			cout<<endl;
			cnt[0]=0;
			cnt[1]=0;
			if(!dfs(i,0)) ok=0;
			if(cnt[0]>=cnt[1]) swap(cnt[0],cnt[1]);
	        add+=cnt[0];
    	    cha=cnt[1]-cnt[0];
    	    for(j=n;j>=cha;j--){
  //  	    	cout<<j<<' ';
    	    	if(dp[j-cha]) dp[j]=1;
			}
//			cout<<endl;
		}
	}
//	for(i=1;i<=n;i++) cout<<dp[i]<<' ';
//	cout<<endl;
	best=n*n;
	for(i=0;i<=n;i++){
		if(dp[i]){
        	ta=add+i,tb=n-ta;
        	best=min(best,rds(ta)+rds(tb));
    	}
	}
	if(!ok) cout<<-1<<endl;
	else cout<<best<<endl;
	return 0;
}

Measured memory_bytes: 4224
import java.util.Scanner;

public class Main {
	
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		String s=sc.next();
		String t=sc.next();
		int a=0;
		for (int i=0; i<s.length(); ++i) if (s.charAt(i)!=t.charAt(i)) ++a;
		System.out.println(a);
		sc.close();
	}

}


Measured memory_bytes: 41116
#include<bits/stdc++.h>
using namespace std;
char a,b;
int main()
{
  a=getchar();
  while (a!=EOF)
  {
    b=getchar();
    if (a=='A'&&b=='C')
    {
      printf("Yes\n");
      return 0;
    }
    a=b;
  }
  printf("No\n");
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define Fast_IO ios::sync_with_stdio(false);
#define fir first
#define sec second
#define mod 998244353
#define ll long long
inline int read()
{
	char ch=getchar(); int nega=1; while(!isdigit(ch)) {if(ch=='-') nega=-1; ch=getchar();}
	int ans=0; while(isdigit(ch)) {ans=ans*10+ch-48;ch=getchar();}
	if(nega==-1) return -ans;
	return ans;
}
typedef pair<int,int> pii;
int add(int x,int y){return x+y>=mod?x+y-mod:x+y;}
int sub(int x,int y){return x-y<0?x-y+mod:x-y;}
int mul(int x,int y){return 1LL*x*y%mod;}

signed main()
{
#ifdef __LOCAL__
	freopen("in.txt","r",stdin);
#endif
	int x,y;
	cin>>x>>y;
	if(x>=10)
	{
		cout<<y<<endl;
	}
	else
	{
		cout<<y+100*(10-x)<<endl;
	}
#ifdef __LOCAL__
	cout<<"Time Used : "<<clock()<<endl;
#endif
	return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vs = vector<string>;
using msi = map<string, int>;
using mii = map<int, int>;
using psi = pair<string, int>;
using pii = pair<int, int>;
using vlai = valarray<int>;
#define rep(i,n) for(int i=0;i<n;i++)
#define range(i,s,n) for(int i=s;i<n;i++)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define fs first
#define sc second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define INF 1E9
#define EPS 1E-9
#define MOD 1000000007
#define PI 3.1415926535897932384

std::ostream &operator<<(std::ostream &out, const vector<int> &tgt)
{
	string s;
	for (int i = 0; i<tgt.size(); i++) {
		s += (to_string(tgt[i]) + ((i != tgt.size() - 1) ? " " : ""));
	}
	out << s;
	return out;
}

int main() {
	int a, b, c, d;
	cin >> a >> b >> c >> d;
	bool s = ((abs(a - b) <= d&&abs(c - b) <= d)||(abs(c - a) <= d));
	cout << (s ? "Yes" : "No") << endl;
}


Measured memory_bytes: 256
n,d=map(int,input().split())
x=[list(map(int,input().split())) for i in range(n)]
z=0
for i in range(n):
    for j in range(n):
        if i==j:
            continue
        y=0
        for k in range(d):
            y+=(x[i][k]-x[j][k])**2
        if y**0.5==int(y**0.5):
            z+=1
print(z//2)

Measured memory_bytes: 3188
R, C = map(int, input().split())
spred_sheet = []
sum_row = [0 for i in range(C+1)]
for i in range(R):
    input_line = list(map(int, input().split()))
    input_line = input_line + [sum(input_line)]
    spred_sheet.append(input_line)
    for j in range(C+1):
        sum_row[j] += input_line[j]
spred_sheet.append(sum_row)
for i in range(R+1):
    for j in range(C+1):
        print("{}".format(spred_sheet[i][j]), end="")
        if j == C:
            print()
        else:
            print(" ", end="")


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

int main() {
    int n; cin>>n;
    double sum_p=0;
  
    double dp[3000][3000];
    double p[3000];
    for(int i=1;i<=n;i++){
      cin>>p[i];
      
    }
    
   dp[0][0]=1;
   for(int i=1;i<=n;i++){
       for(int j=0;j<=i;j++){
          if(j==0) dp[i][j]=dp[i-1][j]*(1-p[i]);
          else   dp[i][j]=dp[i-1][j]*(1-p[i])+dp[i-1][j-1]*p[i]; 
       

       }
    }
   dp[0][0]=0;

       for(int j=0;j<=n;j++){
         if(j>n-j)sum_p+=dp[n][j]; 

    }
  printf("%.10lf\n", sum_p);
}

Measured memory_bytes: 70400
#include <bits/stdc++.h>
 using namespace std;
 using pii = pair<int, int>;
 using ll = long long;
 #define rep(i, j, n) for(int i = j; i < (int)(n); i++)
 const ll MOD = 1000000007;
 const ll INFL = (1LL << 60);
 const int INFI = (1 << 30);

 int main() {
   int N; cin >> N;
   vector<int> a(N), ans(N, 0);
   rep(i, 0, N) cin >> a.at(i);

   rep(i, 0, 30) {
     int cnt = 0;
     rep(j, 0, N) {
       if (a.at(j) & (1 << i)) cnt++;
     }

     if (cnt % 2 == 0) {
        rep(j, 0, N) {
          if (a.at(j) & (1 << i)) ans.at(j) |= (1 << i);
        }
     }
     else {
       rep(j, 0, N) {
         if (!(a.at(j) & (1 << i))) ans.at(j) |= (1 << i);
       }
     }
   }

   rep(i, 0, N - 1) cout << ans.at(i) << " ";
   cout << ans.back() << endl;
 }


Measured memory_bytes: 4828
#!/usr/local/bin/python3
import math

def get_distance(p1, p2):
    return math.hypot(p1[0] - p2[0], p1[1] - p2[1])

N = int(input())
points = []
for i in range(N):
    p = str(input()).split(" ")
    points.append((int(p[0]), int(p[1])))

total_dist = 0
for i in range(N):
    for j in range(i,N):
        total_dist += get_distance(points[i], points[j])

print(2*total_dist/N)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
int main(){
	long long int n,a,b,n1;
    cin>>n>>a>>b;
    if(n%(a+b)==0){
    	cout<<(a*(n/(a+b)));
	}else {
		if(n%(a+b)<=a){
			cout<<(a*(n/(a+b))+n%(a+b));
		}else {
			cout<<(a*(n/(a+b))+a);
		}
	}
} 

Measured memory_bytes: 256
import java.util.*;
public class Main{
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		char a[][] = new char[n + 1][];
		int sum = 0, d = 0, cnt = 0;
		for(int i = 0;i <= n;i++){
			a[i] = sc.next().toCharArray();
		}
		for(int i = 1;i <= n;i++){
out1:		for(int j = 0;j < a[i].length;j++){
				if(a[0][0] == a[i][j]){
					for(int k = j + 1;k < a[i].length;k++){
						if(a[0][1] == a[i][k]){
							d = k - j;
							cnt = 2;
out2:						for(int l = k + d;l < a[i].length;l += d){
								if(a[0][cnt] == a[i][l]) cnt++;
								else break out2;
								if(cnt == a[0].length){
									sum++;
									break out1;
								}
							}
						}
					}
				}
			}
		}
		System.out.println(sum);
	}
}

Measured memory_bytes: 27476
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define INF 1<<30
#define LINF 1LL<<60

/*
<url:>
問題文============================================================

=================================================================

解説=============================================================

================================================================
*/
int main(void) {
	cin.tie(0); ios::sync_with_stdio(false);
    string S; cin >> S;
    string t[4] = {"dream","dreamer", "erase", "eraser"};
    int r = (int)S.length();
    while(true){
        bool f = false;
        for(int i = 0; i < 4;i++){
           // cout << r << " " << t[i].length() << endl;
            if(r < t[i].length()) continue;
           // cout << S.substr(r - t[i].length(),t[i].length()) << endl;
            if(S.substr(r - t[i].length(),t[i].length()) == t[i]){
                r -= t[i].length();
                f = true;
                break;
            }
        }
        if(r == 0){
            cout << "YES" << endl;
            break;
        }
        if(!f){
            cout << "NO" << endl;
            break;
        }
    }
	return 0;
}


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

const int N = 1005;
const int MOD = 1000000007;

int n, m;
char s[N][N];

pair<int, int> st, en;

bool vis[N][N];
int dist[N][N];

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

bool inrange(int x, int y) {
  return x >= 0 && x < n && y >= 0 && y < m;
}

int solve() {
  scanf("%d %d", &n, &m);
  scanf("%d %d", &st.first, &st.second);
  --st.first, --st.second;
  scanf("%d %d", &en.first, &en.second);
  --en.first, --en.second;
  for (int i = 0; i < n; ++i) {
    scanf("%s", s[i]);
  }

  deque<tuple<int, int, int>> dq;
  dq.push_front({0, st.first, st.second});

  memset(dist, -1, sizeof dist);

  while (dq.size()) {
    int d, x, y;
    tie(d, x, y) = dq.front();
    dq.pop_front();

    if (vis[x][y]) continue;
    vis[x][y] = true;
    dist[x][y] = d;

    for (int k = 0; k < 4; ++k) {
      int nx = x + dx[k], ny = y + dy[k];
      if (!inrange(nx, ny)) continue;
      if (s[nx][ny] != '.') continue;
      if (vis[nx][ny]) continue;

      dq.push_front({d, nx, ny});
    }

    for (int xx = -2; xx <= 2; ++xx) {
      for (int yy = -2; yy <= 2; ++yy) {
        int nx = x + xx;
        int ny = y + yy;
        if (!inrange(nx, ny)) continue;
        if (s[nx][ny] != '.') continue;
        if (vis[nx][ny]) continue;

        dq.push_back({d+1, nx, ny});
      }
    }
  }

  // for (int i = 0; i < n; ++i) { for (int j = 0; j < m; ++j) cerr << dist[i][j] << " "; cerr << endl; }

  printf("%d\n", dist[en.first][en.second]);
  return 0;
}

int main() {
  int t = 1;
  // scanf("%d", &t);
  for (int tc = 0; tc < t; ++tc) {
    // printf("Case #%d: ", tc+1);
    solve();
  }
  return 0;
}


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

string c[12]={"C","C#","D","D#","E","F","F#","G","G#","A","A#","B"};
int main() {
  int T,n,m,f,x;
  cin>>T;
  while(T--){
    cin>>n>>m;
    string s[n],t[m];
    for(int i=0;i<n;i++)cin>>s[i];
    for(int i=0;i<m;i++)cin>>t[i];
    f=0;
    for(int k=1;k<3;k++){
      x=n-k;
      for(int i=m-1,p;i>=0;i--){
        if(x<0||x>=n)goto e;
        p=0;
        while(c[p]!=s[x])p++;
        if(t[i]==c[p])x--;
        else if(t[i]==c[(p+1)%12])x-=2;
        else if(t[i]==c[(p+11)%12])x++;
        else goto e;
      }
      if(x==-1)f=1;
    e:;
    }
    cout<<(f?"Yes":"No")<<endl;
  }
  return 0;
}


Measured memory_bytes: 6676
program league
  implicit none
  integer :: n, a(1000,1000) = 0, i, j, l, k(1000) = 1, m = 0
  logical :: used(1000) = .false., change
  read(*,*) n
  do i = 1, n
    read(*,*) a(i,1:n-1)
  end do
  do while (any(k(1:n) < n))
    m = m+1
    used(1:n) = k(1:n) == n
    change = .false.
    do i = 1, n
      if (used(i)) cycle
      j = a(i,k(i))
      if (used(j)) cycle
      if (a(j,k(j)) == i) then
        k(i) = k(i)+1
        k(j) = k(j)+1
        used(i) = .true.
        used(j) = .true.
        change = .true.
      end if
    end do
    if (.not.change) then
      m = -1
      exit
    end if
  end do
  write(*,'(i0)') m
end program league

Measured memory_bytes: 4096
#include <bits/stdc++.h>
 
typedef long long ll;
 
using namespace std;
 
int main(){
	//freopen("input.in","r",stdin);
	//freopen("output.in","w",stdout);
	ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    long long i,j,t,n,d,x,y;
    cin>>n>>d;

    int cnt(0);
    while(n--){
    	cin>>x>>y;
    	if(x*x+y*y<=d*d)cnt++;
    }
    cout<<cnt;
 
	
	
	
 
 
 
 
 
 
 
	return 0;
}

Measured memory_bytes: 3624
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int[] a = new int[n];
    for (int i = 0; i < n; i++) {
      a[i] = sc.nextInt();
    }
    int[] b = new int[n];
    for (int i = 0; i < n; i++) {
      b[i] = sc.nextInt();
    }
    int[] c = new int[n - 1];
    for (int i = 0; i < n - 1; i++) {
      c[i] = sc.nextInt();
    }
    int sum = 0;
    for (int i = 0; i < n; i++) {
      sum += b[a[i] - 1];
      if (i > 0 && a[i] - a[i - 1] == 1) {
        sum += c[a[i - 1] - 1];
      }
    }
    System.out.println(sum);
  }
}


Measured memory_bytes: 20948
#include <bits/stdc++.h>
#define fore(x,a,b) for(int x=a, qwerty=b; x<qwerty; x++)
#define ALL(a) (a).begin(),(a).end()
#define SZ(a) ((int)(a).size())
#define pb push_back
#define FIN ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define fst first
#define snd second
#define mset(a,v) memset((a),(v),sizeof(a))
//#pragma GCC optimize ("O3")
//#pragma GCC target ("sse4")
using namespace std;
typedef long long ll;
const int N=305;
int n;
int a[4];
double dp[N][N][N],nd;
bool vis[N][N][N];
double f(int a,int b, int c){
	if(a+b+c==0)return 0;
	double &r=dp[a][b][c];
	bool &vi=vis[a][b][c];
	if(vi)return r;
	vi=1;
	if(a)r=(1+f(a-1,b,c))*a/nd;
	if(b)r+=(1+f(a+1,b-1,c))*b/nd;
	if(c)r+=(1+f(a,b+1,c-1))*c/nd;
	r+=1-(a+b+c)/nd;
	double D=(a+b+c)/nd;
	r/=D;
	return r;
}
int main(){FIN;
	cin>>n;
	nd=n;
	fore(i,0,n){
		int x;cin>>x;
		a[x]++;
	}
	cout<<fixed<<setprecision(15)<<f(a[1],a[2],a[3])<<"\n";
}

Measured memory_bytes: 246016
#include <bits/stdc++.h>
typedef long long ll; 
const ll mod = 1e9+7;
#define fo(i, n) for (int i = 0; i < n; i++)
#define sc(n) scanf("%d", &n) 
using namespace std;

void solve() {
    ll n, a, b; cin >> n >> a >> b;
    ll complete = n/(a+b);
    ll remaining = n % (a+b);
    cout << complete * a + min(a, remaining);

}

int main() {
    int t = 1;
    //scanf("%d", &t);
    while (t--) {
        solve();
    }
    return 0;
}

Measured memory_bytes: 256