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

int sums[100005];

int main(int argc, char *argv[]) { ios::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);
  int n,k;cin>>n>>k;string s;cin>>s;

  vector<int> cnt;
  if(s[0]=='0')cnt.push_back(0);
  char c=s[0];
  int t=0;
  for(int i=0;i<n;i++){
    if(s[i]!=c){
      cnt.push_back(t);c=s[i];t=1;
    }else{
      t++;
    }
  }
  cnt.push_back(t);
  if(s[s.size()-1]=='0')cnt.push_back(0);
  for(int i=0;i<cnt.size();i++){
    if(i)sums[i]+=sums[i-1];
    sums[i] += cnt[i];
  }
  int ans=0;
  t=0;
  for(int i=0;i<cnt.size();i+=2){
    int p = i-(2*k+1);
    if(p<0){
      ans=max(ans,sums[i]);
      continue;
    }else{
      ans=max(ans,sums[i]-sums[p]);
    }
  }
  cout<<ans<<endl;
  return 0;
}


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


using namespace std;

bool ans[1005];
int x;


void pd()
{
    for(int i = 1; i < 100; i++)
    {
        for(int j = 2; j < 100; j++)
        {
            int f = pow(i,j);
            if(f <= 1000)
            {
                ans[f]=1;
            }
            else 
                break;
        }
    }
}


int main()
{
    pd();
    cin >> x;
    for(int i = x; i >= 1; i--)
    {
        if(ans[i] == 1)
        {
            cout << i << endl;
            return 0;
        }
    }
    return 0;
}


Measured memory_bytes: 384
#include<cstdio>
#include<cstring>
#include<algorithm>
#define N 100010
#define ll long long
using namespace std;
int n, map[N][4], b[4], w1[N], w2[N], flag1[N], flag2[N], x, pos[N], s[N];
ll sum1, sum2;
inline char gc(){
	static char now[1<<16], *S, *T;
	if(S==T){T=(S=now)+fread(now, 1, 1<<16, stdin); if(S==T)return EOF;}
	return *S++;
}
inline int read(){
	int x=0, f=1; char ch=gc();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1; ch=gc();}
	while(ch>='0'&&ch<='9'){x=x*10+ch-'0'; ch=gc();}
	return x*f;
}
inline void ins(int x){for(int i=x; i<=n; i+=i&(-i))s[i]++;}
inline int cs(int x){int s1=0; for(int i=x; i; i-=i&(-i))s1+=s[i]; return s1;}
int main(){
	n=read();
	for(int i=1; i<=3; i++)
		for(int j=1; j<=n; j++)map[j][i]=read();
	for(int i=1; i<=n; i++){
		for(int j=1; j<=3; j++)b[j]=map[i][j];
		if(b[1]>b[3])swap(b[1], b[3]);
		if(b[1]+1!=b[2]||b[2]+1!=b[3]){printf("No"); return 0;}
		if(b[3]%3){printf("No"); return 0;}
		x=b[3]/3; if((x^i)&1){printf("No"); return 0;}
		if(i&1){w1[(i+1)>>1]=(x+1)>>1; flag1[(i+1)>>1]=map[i][3]==b[3]?0:1;}
		else{w2[i>>1]=x>>1; flag2[i>>1]=map[i][3]==b[3]?0:1;}
	}
	sum1=0; for(int i=1; i<=(n+1)/2; i++)sum1+=flag1[i];
	sum2=0; for(int i=1; i<=n/2; i++)sum2+=flag2[i];
	for(int i=1; i<=(n+1)/2; i++)pos[w1[i]]=i; for(int i=1; i<=(n+1)/2; i++)w1[i]=pos[i];
	for(int i=1; i<=n/2; i++)pos[w2[i]]=i; for(int i=1; i<=n/2; i++)w2[i]=pos[i];
	memset(s, 0, sizeof(s));
	for(int i=(n+1)/2; i; i--){sum2+=cs(w1[i]-1); ins(w1[i]);}
	memset(s, 0, sizeof(s));
	for(int i=n/2; i; i--){sum1+=cs(w2[i]-1); ins(w2[i]);}
	if((!(sum1&1))&&(!(sum2&1)))printf("Yes"); else printf("No");
	return 0;
}

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

using namespace std;

#define ll long long
#define vi  vector<int>
#define vvi vector<vi>
#define pi  pair<int,int>
#define mp  make_pair
#define pb  push_back
#define MOD 1e9 + 7
#define PAI  3.1415
#define all(x) (x).begin(),(x).end()
#define chmax(x,y) x = max(x,y)
#define chmin(x,y) x = min(x,y)
#define pr(x) cout << x << endl
#define Endl endl
#define rep(i,n) for(int i = 0 ; i < n; i++)

const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
const int ddx[8] = {-1,0,1,-1,1,-1,0,1};
const int ddy[8] = {-1,-1,-1,0,0,1,1,1};
const int inf = 99999999;
const ll linf = 1LL << 62;

ll gcd(ll a,ll b){
  if(a < b)swap(a , b);
  if(a % b != 0) gcd(b, a%b);
  return b;
}

ll lcm(ll a,ll b){
  if(a < b)swap(a , b);
  return (a/gcd(a , b)) * b;
}

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

  vi v(100005, 0);
  string s; cin >> s;
  s = 'B' + s;

  for(int i = 1; i < s.length(); i++)
  {
    if(s[i - 1] == 'A' and s[i] == 'C'){
      s[i-1] = 'a';
    }
  }

  for(int i = 0; i < s.length(); i++)
  {
    if(s[i] == 'a')
      v[i] += 1;
    if(i != 0)
      v[i] += v[i-1];
  }
  
  for(int i = 0; i < q; i++)
  {
    int l, r; cin >> l >> r;
    pr(v[r - 1] - v[l-1]); 
  }

  return 0;
}

Measured memory_bytes: 1404
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define Would
#define you
#define please

const int cm = 1 << 17;
char cn[cm], *ci = cn + cm, ct;
inline char getcha() {
	if (ci - cn == cm) { fread(cn, 1, cm, stdin); ci = cn; }
	return *ci++;
}
inline int getint() {
	int A = 0;
	if (ci - cn + 16 > cm) while ((ct = getcha()) >= '0') A = A * 10 + ct - '0';
	else while ((ct = *ci++) >= '0') A = A * 10 + ct - '0';
	return A;
}

const int dm = 1 << 21;
char dn[dm], *di = dn;

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


	int N = getint();
	int A[500001];
	*A = getint();
	int d[500000];
	rep(i, N) {
		*(d + i) = getint();
		*(A + i + 1) = min(*(A + i), abs(*(A + i) - *(d + i)));
	}
	int B[500000];
	*(B + N - 1) = 1;
	for(int i = N - 1; i >= 1; i--) {
		if (*(B + i) >= 1e9 || *(B + i) * 2 <= *(d + i)) *(B + i - 1) = *(B + i);
		else *(B + i - 1) = *(B + i) + *(d + i);
	}
	int Q = getint();
	char n[3] = { 'N', 'O', '\n' };
	char y[4] = { 'Y', 'E', 'S', '\n' };
	rep(i, Q) {
		int q = getint();
		q--;
		if (*(A + q) < *(B + q)) {
			memcpy(di, n, 3);
			di += 3;
		}
		else {
			memcpy(di, y, 4);
			di += 4;
		}
	}

	fwrite(dn, di - dn, 1, stdout);

	cin >> N;
	
	Would you please return 0;
}

Measured memory_bytes: 9600
#include<stdio.h>
#define INF 1000000
int edge[101][101],mincost[101],used[101],V;

int prim(void);
int min(int,int);

int main(void){
  int e,i,j,a,b,cost;

  while(scanf("%d %d",&V,&e),V,e){
    for(i=0;i<V;i++){
      for(j=0;j<V;j++){
	edge[i][j]=edge[j][i]=INF;
      }
    }
    
    for(i=0;i<e;i++){
      scanf("%d %d %d",&a,&b,&cost);
      edge[a][b]=edge[b][a]=cost;
    }
    printf("%d\n",prim());
}
  return 0;
}

int prim(void){
  int i,u,v;
  for(i=0;i<V;i++){
    mincost[i]=INF;
    used[i]=0;
  }
  
  mincost[0]=0;
  int res=0;
  
  while(1){
    v=-1;
    
    for(u=0;u<V;u++)
      if(!used[u] && (v==-1 || mincost[v]>mincost[u]))v=u;
    
    if(v==-1)break;
    used[v]=1;
    res+=mincost[v];
    
    for(u=0;u<V;u++)
      mincost[u]=min(mincost[u],edge[v][u]);
  }
  
  return res;
}

int min(int x,int y){
  return x<y?x:y;
}

Measured memory_bytes: 0
#include <iostream>
#include <vector>
#include<algorithm>
#include <string>
#include <cmath>
#include<queue>
#define PI 3.141592653589793238
#define ll long long
using namespace std;

int main()
{
	string s1, s2;

	cin >> s1 >> s2;

	s2 += s1;

	cout << s2;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <limits>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <complex>

using namespace std;

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

#define INF (INT_MAX/3)
#define PI (2*acos(0.0))
#define EPS (1e-8)

typedef long long ll;
typedef unsigned long long ull;

int main(){
  ios_base::sync_with_stdio(0);
  int n, k;
  while(cin >> n >> k, n || k){
    vector<int> arr(n, 0);
    for(int i = 0; i < n; i++) cin >> arr[i];
    int sum = 0, ans = 0;
    for(int i = 0; i < k; i++) sum += arr[i];
    ans = sum;
    for(int i = 1; i + k - 1 < n; i++){
      sum -= arr[i-1];
      sum += arr[i+k-1];
      ans = max(ans, sum);
    }
    cout << ans << endl;
  }
  return 0;
}

Measured memory_bytes: 1532
#include <stdio.h>
#include <stdlib.h>

int S[100];
int top=0;

void initialize();
int isEmpty();
int isFull();
void push(int x);
int pop();

int main(void){

	char a[100];
	int b,c;

	
	for(;;){
	
		if(scanf("%s",a)==EOF) break;
		
		else if(a[0]=='+') {
		
			b=pop()+pop();
			push(b);
		
		}
		
		else if(a[0]=='-') {
		
			b=pop();
			c=pop();
			push(c-b);
		
		}
		
		else if(a[0]=='/') {
		
			b=pop();
			c=pop();
			push(c/b);
		
		}
		
		else if(a[0]=='*') {
		
			b=pop()*pop();
			push(b);
		
		}
		
		else{
		
			b=atoi(a);
			//printf(" %d",b);
			push(b);
		
		}
		
	}
	
	printf("%d\n",pop());
	

}

int isEmpty(){
	if(top==0) return 1;
	else return 0;
}

int isFull(){
	if(top >= 100){
		return 1;
	}
	else return 0;
}
	
void push(int x){
	if (isFull()==1){
		printf("Error(Over Flow)\n");
		printf("%d",top);
		exit(0);
	}
	else{
		top++;
		S[top] = x;
		//printf("%d %d ",top,S[top]);
	}
}


int pop(){
	if (isEmpty()==1){
		
		printf("Error(Under flow)  top=%d",top);
		exit(0);
	}
	else {
		top--;
		return S[top+1];
	}
}


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

namespace ConsoleApp
{
    class Program
    {
        static void Main(string[] args)
        {
            var ss = Console.ReadLine().Split();
            var N = int.Parse(ss[0]);
            var M = int.Parse(ss[1]);

            var maxL = 1;
            var minR = N;
            for (int i = 0; i < M; i++)
            {
                ss = Console.ReadLine().Split();
                var L = int.Parse(ss[0]);
                var R = int.Parse(ss[1]);

                maxL = Math.Max(L, maxL);
                minR = Math.Min(R, minR);
            }

            var num = minR - maxL + 1;
            if (num >= 0)
                Console.WriteLine(minR - maxL + 1);
            else
                Console.WriteLine(0);
        }
    }
}

Measured memory_bytes: 15184
#include <cmath>
#include <cstdio>
#include <vector>
#include <list>
#include <iostream>
#include <algorithm>
#include <sstream>
#include <stack>
#include <fstream>
#include <queue>
#include <iomanip>
#include <iterator>
#include <map>
#include <unordered_map>
#include <set>
#define fast ios_base::sync_with_stdio(false)
#define ll long long int
#define ld long double
#define vi vector<ll>
#define vvi vector<vi >
#define pi pair<ll,ll>
#define vvpi vector<vector<pi > >
#define vpi vector<pi >
#define vppi vector<pair<ll,pi > >
#define vs vector<string>
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define pb push_back
#define eb emplace_back
#define mkp make_pair
#define fs first
#define se second
#define crz(v,n) v.clear(),v.resize(n+1,0)
#define print(v) for(ll it=0;it<v.size();it++) cout<<v[it]<<" ";cout<<endl
#define printp(v) for(ll it=0;it<v.size();it++) cout<<v[it].first<<" "<<v[it].second<<endl
using namespace std;
int main(){
	ll n,i,h,s=0;cin>>h>>n;vi v(n);
	for(i=0;i<n;i++) cin>>v[i],s+=v[i];
	if(s<h) cout<<"No\n"; else cout<<"Yes\n";
}



Measured memory_bytes: 1024
n = int(input())
S = []
H = []
C = []
D = []

for i in range(n):
    mark, number = (x for x in input().split())
    if(mark == "S"): S.append(int(number))
    elif(mark == "H"): H.append(int(number))
    elif(mark == "C"): C.append(int(number))
    elif(mark == "D"): D.append(int(number))

for mark in ["S", "H", "C", "D"]:
    for number in range(1, 14):
        if(mark == "S" and (number in S) == False): print("S", number)
        if(mark == "H" and (number in H) == False): print("H", number)
        if(mark == "C" and (number in C) == False): print("C", number)
        if(mark == "D" and (number in D) == False): print("D", number)


Measured memory_bytes: 5612
//#define LOCAL
using System;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Collections.Generic;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Diagnostics;
using static System.Math;   
using MethodImplAttribute = System.Runtime.CompilerServices.MethodImplAttribute;
using MethodImplOptions = System.Runtime.CompilerServices.MethodImplOptions;

public static class P
{
    public static void Main()
    {
#if LOCAL
        var rng = new Random();
        while (true)
        {
            var k = rng.Next(1, 100000);
            var n = rng.Next(1, 1000000000);
            Solve(k, n);
            Console.WriteLine("end validate");
        }
#else

        var nk = Console.ReadLine().Split().Select(int.Parse).ToArray();
        int n = nk[0];
        long k = nk[1];
        var res = Solve(n, k);
        if (res == null)
        {
            Console.WriteLine(-1);
            return;
        }
        Console.WriteLine(string.Join("\n", res.Select(x => $"{x.Item1} {x.Item2} {x.Item3}")));
#endif
    }

    public static Tuple<long, long, long>[] Solve(int n, long k)
    {
        var cands = Enumerable.Range((int)k, 3 * n).Select(x => (long)x).ToArray();
        var prevSum = cands.Take(n * 2).Sum();
        var afterSum = cands.Skip(n * 2).Sum();
        
        //2k <= n + 1であれば合法
        if (prevSum > afterSum)
        {
            if (2 * k <= n + 1) throw new Exception();
            return null;
        } 
        var mother = cands.Skip(n).Take(n).ToArray();

        var a = cands.Take(n / 2).Reverse().Concat(cands.Take(n).Skip(n / 2).Reverse()).ToArray();
        var b = mother.Where(x => x % 2 == 1).Concat(mother.Where(x => x % 2 == 0)).ToArray();
        var c = cands.Skip(n * 2).ToArray();

        var res = a.Concat(b).Concat(c).ToArray();

        if (res.Distinct().Count() != 3 * n)
            throw new Exception();
      
        if (res.Min() != k)
            throw new Exception();

        if (res.Max() != k + 3 * n - 1)
            throw new Exception();

        try
        {
            for (int i = 0; i < n; i++)
                if (a[i] + b[i] > c[i]) throw new Exception();
        }
        catch
        {
            var minstack = new Stack<int>(Enumerable.Range((int)k, n).Reverse());
            return Enumerable.Range(0, n).Select(x => new Tuple<long, long, long>(c[x] - b[x], b[x], c[x])).OrderBy(x => x.Item1)
                .Select(x => new Tuple<long, long, long>(minstack.Pop(), x.Item2, x.Item3)).ToArray();
        }

        return Enumerable.Range(0, n).Select(x => new Tuple<long, long, long>(a[x], b[x], c[x])).ToArray();
    }
}

Measured memory_bytes: 46028
N = int(input())
W = [input().strip() for _ in range(N)]
is_already_said = [W[0]]
ans = 'Yes'
for word in W[1:]:
    if is_already_said[-1][-1] != word[0] or word in is_already_said:
        ans = 'No'
        break
    is_already_said.append(word)
print(ans)

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

typedef long long int lld;

/*
g++ -std=c++11 a-frog.cpp -o k
*/
int main() {
    int N;
    cin >> N;
    int h[N];
    for(int i = 0; i < N; i++) {
        cin >> h[i];
    }
    
    int c[N];
    c[0] = 0;
    if(N >= 2)
        c[1] = abs(h[1] - h[0]);
    for(int i = 2; i < N; i++) {
        c[i] = min(
                abs(h[i] - h[i-1]) + c[i-1],
                abs(h[i] - h[i-2]) + c[i-2]
        );
    }
    cout << c[N-1] << endl;

    return 0;
}


Measured memory_bytes: 1024
import java.io.*;
import java.util.StringTokenizer;

public class Main {

    public static void main(String[] args) throws IOException {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskB solver = new TaskB();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskB {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int t = in.nextInt();
            String s = in.next();
            if (s.length() <= t){
                out.print(s);
            } else {
                out.println(s.substring(0,t) + "...");
            }
        }

        private static int naib(int a, int b) {
            return a / (nod(a, b)) * b;
        }

        private static int nod(int a, int b) {
            while (a != 0 && b != 0) {
                if (a > b) {
                    a = a % b;
                } else {
                    b = b % a;
                }
            }
            return a + b;
        }
    }


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

        public Long nextLong() {
            return Long.parseLong(next());
        }

    }
}


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

using namespace std;

typedef unsigned int ui;
typedef long long ll;
typedef unsigned long long ull;

constexpr int MAXN = 21, MOD = 1000000007;

int dp[1 << MAXN];
int order[1 << MAXN];

int reduce(int x) {
	return x >= MOD ? x - MOD : x;
}

int main() {
	int N;
	cin >> N;
	dp[0] = 1;
	for(int i = 0, j = 0, k = 1; i < N; i++) {
		int compat = 0;
		for(int l = 0; l < N; l++) {
			char a;
			cin >> a;
			compat ^= (a ^ '0') << l;
		}
		for(int l = k; j < l; j++) {
			for(int m = 0, n; m < N; m++) {
				if((n = 1 << m ^ order[j]) < order[j])
					break;
				for(int o = 0, p; o < N; o++)
					if(n > (p = compat & 1 << o ^ n))
						dp[n] = reduce(dp[n] + dp[p]);
				order[k++] = n;
			}
		}
	}
	cout << dp[(1 << N) - 1] << endl;
}


Measured memory_bytes: 16640
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int N,M,L,R;
	cin>>N>>M;
	L=1;
	R=N;
	while(M--)
	{
		int l,r;
		cin>>l>>r;
		L=max(L,l);
		R=min(R,r);
	}
	cout<<max(R-L+1,0);
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <algorithm>
#include <string>
#include <math.h>
#include <limits.h>

using namespace std;

typedef long long ll;
typedef pair<ll, int> P;

ll a[200010];
ll s[200010];

ll ab(ll a1){
    if(a1 < 0) return -a1;
    else return a1;
}


int main(){
    int N;
    cin >> N;
    for(int i = 0; i < N; i++){
        ll x;   cin >> x;
        a[i] = x;
        if(i == 0)  s[i] = x;
        else s[i] = s[i-1]+x;
    }

    int lcut = 1, rcut = 3;
    ll res = LONG_LONG_MAX;
    for(int mcut = 2; mcut <= N-2; mcut++){
        int l = lcut, r = mcut;
        while(r - l > 1){
            int m = (l + r) / 2;
            ll l1 = s[m-1];
            ll l2 = s[mcut-1] - l1;
            if(l1 <= l2){
                l = m;
            }
            else{
                r = m;
            }
        }
        ll l1_res = s[l-1];
        ll l2_res = s[mcut-1] - l1_res;
        ll l_res = LONG_LONG_MAX;
        for(int lx = max(l-2, 0); lx <= min(l, mcut-1); lx++){
            ll l1 = s[lx];
            ll l2 = s[mcut-1] - l1;
            if(l_res > ab(l1 - l2)){
                l_res = ab(l1 - l2);
                l1_res = l1;
                l2_res = l2;
            }
        }


        l = mcut+1, r = N;
        while(r - l > 1){
            int m = (l + r) / 2;
            ll r1 = s[m-1] - s[mcut-1];
            ll r2 = s[N-1] - s[m-1];
            if(r1 <= r2){
                l = m;
            }
            else{
                r = m;
            }
        }

        ll r1_res;
        ll r2_res;
        ll r_res = LONG_LONG_MAX;
        for(int lx = max(l-2, mcut); lx <= min(l, N-1); lx++){
            ll r1 = s[lx] - s[mcut-1];
            ll r2 = s[N-1] - s[lx];
            if(r_res > ab(r1 - r2)){
                r_res = ab(r1 - r2);
                r1_res = r1;
                r2_res = r2;
            }
        }

        ll minim = min(min(l1_res, l2_res), min(r1_res, r2_res));
        ll maxim = max(max(l1_res, l2_res), max(r1_res, r2_res));
        res = min(res, maxim-minim);
    }

    cout << res << endl;


    return 0;
}

Measured memory_bytes: 3328
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
#define fastio() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
int main()
{
    fastio();
    int n;cin>>n;
    int h[n];
    for(int i=0;i<n;i++)
    {
        cin>>h[i];
    }
    int dp[n];
    dp[0]=0;
    dp[1] = abs(h[1]-h[0]);
    for(int i=2;i<n;i++)
    {
        dp[i] = min(dp[i-1]+abs(h[i]-h[i-1]),dp[i-2]+abs(h[i]-h[i-2]));
        // cout<<dp[i]<<endl;
    }
    cout<<dp[n-1]<<endl;

    return 0;
}    

Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <string>
#include <map>
#include <set>
#include <deque>
#include <numeric>
#include <bitset>
#include <iomanip>
#include <cassert>
#include <chrono>
#include <random>
#include <limits>
#include <iterator>
#include <functional>
using namespace std;
 
typedef long long ll;
typedef pair<int, int> P;
typedef pair<int, ll> Pl;
const double PI = 3.1415926535897932;   // acos(-1)
const double EPS = 1e-15;
const int mod = 1e+9 + 7;
const int INF = 1e+9;

ll mod_pow(ll x, int n){
    if(n == 0)      return 1;

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

struct Combination{
    int n;
    vector<ll> fact;
    vector<ll> ifact;

    Combination(int n_){
        n = n_;
        fact = vector<ll>(n + 1);
        ifact = vector<ll>(n + 1);

        fact[0] = 1;
        for(int i = 1; i <= n; ++i){
            fact[i] = (ll)fact[i - 1] * i % mod;
        }

        ifact[n] = mod_pow(fact[n], mod - 2);
        for(int i = n; i > 0; --i){
            ifact[i - 1] = ifact[i] * i % mod;
        }
    }

    ll get_combination(int n, int r){
        if(n < 0 || r < 0 || n < r)     return 0;

        return fact[n] * ifact[r] % mod * ifact[n - r] % mod;
    }
};

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

    ll x, y;
    cin >> x >> y;
    if((x + y) % 3 != 0){
        cout << 0 << endl;
        return 0;
    }
    int num = (x + y) / 3;

    Combination c(700000);
    int n = x - num;
    cout << c.get_combination(num, n) << endl;
}

Measured memory_bytes: 11264
#include<bits/stdc++.h>
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9 + 7;
using namespace std;

//ループマクロ
#define FOR(i , a , b)  for(int i = (a) ; i < (b) ; i++)
#define REP(i , n)      for(int i = 0 ; i < n ; i++)
#define REPR(i , n)     for(int i = n ; 0 <= i ; i--)
#define ROP(i, n)       for(int i = 1 ; i <= n ; i++)

//入出力
#define SCOUT(x) cout << (x) << " "
#define VECCIN(x) for(auto& ele : (x) ) cin >> ele
#define VECOUT(x) for(auto& ele : (x) ) cout << ele << " "; cout << endl;

//その他
#define ALL(obj) (obj).begin() , (obj).end() 
#define SORT(obj) sort(ALL(obj))
#define GSORT(obj) sort(ALL(obj) , greater<int>())
#define P pair<int , int>
#define V vector<int>
#define VLL vector<long long>
#define M map<int, int>
#define S set<int>
#define PQ priority_queue<int>
#define PQG priority_queue<int , V , greater<int>>

int main(void) {

	ios::sync_with_stdio(false);	cin.tie(0);
	int N;  cin >> N;
	ll keep[1001];
	fill(keep, keep + 1001, 0);

	for(int i = 2 ; i <= N ; i++){

			int num = i;
			for(int j = 2 ; j <= 1000 ; j++){

					while(num % j == 0 && num > 1){
						num /= j;
						keep[j] += 1;
					}
			}
	}

	ll ans = 1;
	for(int i = 1 ; i <= 1000 ; i++){
		ans *= (keep[i] + 1);
		ans %= MOD;
	}

	cout << ans << endl;


	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include<math.h>
#include<cctype>
#include <string>
#include <algorithm>
#include <vector>
using namespace std;

int main(){
int q , a, b;
string str  , Meirei , p ,s ,s2;
cin >> str >> q;
for(int i = 0; i < q; i++){
cin >> Meirei >> a >> b;
if(Meirei == "replace"){
  cin >> p;
}
if(Meirei == "print"){
  //str.copy(s ,b - a + 1,a);
  s = str.substr(a,b - a + 1);
  cout << s << endl;
}else if(Meirei == "reverse"){
  reverse(str.begin() +a , str.begin() +b+1);
}else if(Meirei == "replace"){
   str.replace(a, b - a + 1 , p);
}
}
return 0;
}


Measured memory_bytes: 3216
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#define N 4
int ansArr[N][N]={{ 1, 2, 3, 4},
                  { 5, 6, 7, 8},
                  { 9,10,11,12},
                  {13,14,15, 0}};
int x[N*N]={3,0,1,2,3,0,1,2,3,0,1,2,3,0,1,2};
int y[N*N]={3,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3};
int heuristic[N*N][N*N];
int curMinCost=46;
int tempArr[N][N];
void searchMinCost(int[N][N],int,int);
int main(void)
{
  int i,j;
  for(i=0;i<N*N;i++)
    {
      for(j=0;j<N*N;j++)
        {
          heuristic[i][j]=abs(y[i]-y[j])+abs(x[i]-x[j]);
        }
    }
  for(i=0;i<N;i++)
    for(j=0;j<N;j++)
      scanf("%d",&tempArr[i][j]);
  searchMinCost(tempArr,0,0);
  printf("%d\n",curMinCost);
  return 0;
}
void searchMinCost(int tempArr[N][N],int lastMove,int curCost)
{
  int h=0;
  int i,j;
  int blankI,blankJ;
  int index;
  int nextArr[N][N];
  for(i=0;i<N;++i)
    {
      for(j=0;j<N;++j)
        {
          if(tempArr[i][j]==0)
            {
              blankI=i;
              blankJ=j;
            }
          else if(tempArr[i][j]!=ansArr[i][j])
            {
              h+=heuristic[tempArr[i][j]][ansArr[i][j]];
            }
        }
    }
  if(h==0)
    {
      if(curCost<curMinCost) curMinCost=curCost;
      return;
    }
  if(curCost+h>curMinCost) return;
  if(blankI>0&&lastMove!=3)
    {
      memcpy(nextArr,tempArr,sizeof(int)*(N*N));
      index=blankI-1;
      nextArr[blankI][blankJ]=nextArr[index][blankJ];
      nextArr[index][blankJ]=0;
      searchMinCost(nextArr,1,curCost+1);
    }
  if(blankJ>0&&lastMove!=4)
    {
      memcpy(nextArr,tempArr,sizeof(int)*(N*N));
      index=blankJ-1;
      nextArr[blankI][blankJ]=nextArr[blankI][index];
      nextArr[blankI][index]=0;
      searchMinCost(nextArr,2,curCost+1);
    }
  if(blankI<N-1&&lastMove!=1)
    {
      memcpy(nextArr,tempArr,sizeof(int)*(N*N));
      index=blankI+1;
      nextArr[blankI][blankJ]=nextArr[index][blankJ];
      nextArr[index][blankJ]=0;
      searchMinCost(nextArr,3,curCost+1);
    }
  if(blankJ<N-1&&lastMove!=2)
    {
      memcpy(nextArr,tempArr,sizeof(int)*(N*N));
      index=blankJ+1;
      nextArr[blankI][blankJ]=nextArr[blankI][index];
      nextArr[blankI][index]=0;
      searchMinCost(nextArr,4,curCost+1);
    }
}


Measured memory_bytes: 2104
#include <iostream>
#include <queue>

using namespace std;

int main(void) {
    int N, M;
    cin >> N >> M;
    vector< vector<int> > g(N);
    while(M--) {
        int A, B;
        cin >> A >> B;
        --A; --B;
        g[A].emplace_back(B);
        g[B].emplace_back(A);
    }

    vector<int> ans(N, -1);
    ans[0] = 0;
    queue<int> q;
    q.emplace(0);
    while(!q.empty()) {
        int v = q.front();
        q.pop();
        for(auto u: g[v]) {
            if(ans[u] != -1) continue;
            ans[u] = v;
            q.emplace(u);
        }
    }

    cout << "Yes" << endl;
    for(int i=1; i<N; i++) {
        cout << ans[i] + 1 << endl;
    }
    return 0;
}


Measured memory_bytes: 10304
#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <ctime>
#include <climits>
using namespace std;

#define rep(i,a,n) for(int i=a; i<n; i++)
#define repr(i,a,n) for(int i=a; i>=n; i--)
#define pb(a) push_back(a)
#define fr first
#define sc second
#define INF 999999999

#define X real()
#define Y imag()
#define EPS (1e-10)
#define EQ(a,b) (abs((a) - (b)) < EPS)
#define EQV(a,b) ( EQ((a).X, (b).X) && EQ((a).Y, (b).Y) )
#define LE(n, m) ((n) < (m) + EPS)
#define GE(n, m) ((n) + EPS > (m))

typedef vector<int> VI;
typedef vector<VI> MAT;
typedef pair<int, int> pii;
typedef long long int ll;

typedef complex<double> P;
typedef pair<P, P> L;
typedef pair<P, double> C;

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

namespace std {
    bool operator<(const P a, const P b) {
        return a.X != b.X ? a.X < b.X : a.Y < b.Y;
    }
}

int main() {
    int n, m, x, y;
    cin >> n >> m;
    int a[100010];
    fill(a, a+n, 1);
    bool red[100010];
    memset(red, false, sizeof(red));
    red[0] = true;

    rep(i,0,m) {
        cin >> x >> y;
        x--; y--;
        a[x]--; a[y]++;

        // rep(j,0,n) printf("%d ", a[j]);
        // cout << endl;

        if(red[x]) red[y] = true;
        if(a[x] == 0) red[x] = false;
    }

    int ans = 0;
    rep(i,0,n) if(red[i]) ans++;
    cout << ans << endl;
    return 0;
}

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

#define rep(i, n) for (ll i=0;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; }
#define ALL(x) (x).begin(),(x).end()
#define Sort(a) sort(ALL(a))
#define Rev(a) reverse(ALL(a))


using namespace std;
//using ll=long long;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pi;
const long double PI=3.14159265358979323846;


template<class T> bool contain(const std::string& s, const T& v) {
   return s.find(v) != std::string::npos;
}


int main(){

  ll n,a,b;
  cin>>n>>a>>b;

  ll ans=0;
  if(a<=b && n>1){
    ans = (n-2)*(b-a)+1;
  }
  if(n==1 && a==b) ans =1;

  cout<<ans<<endl;
}


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

#include <atcoder/all>
using namespace std;
using namespace atcoder;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(v) (v).begin(), (v).end()
using ll = long long;
constexpr int INF = 1e9;
constexpr long long LINF = 1e18;
constexpr long long MOD = 1e9 + 7;

struct UnionFind {
    vector<int> par, siz;

    UnionFind(int n) : par(n), siz(n, 1) {
        iota(par.begin(), par.end(), 0);
    }

    int root(int x) {
        if (par[x] == x)
            return x;
        else
            return par[x] = root(par[x]);
    }

    void unite(int x, int y) {
        x = root(x);
        y = root(y);
        if (x == y) return;
        if (siz[x] < siz[y]) swap(x, y);
        siz[x] += siz[y];
        par[y] = x;
    }

    bool same(int x, int y) {
        return root(x) == root(y);
    }

    int size(int x) {
        return siz[root(x)];
    }
};

signed main() {
    int n, m;
    cin >> n >> m;
    int a, b;
    UnionFind uf(n);
    rep(i, m) {
        cin >> a >> b;
        a--;
        b--;
        uf.unite(a, b);
    }
    set<int> S;
    rep(i, n) {
        S.emplace(uf.root(i));
    }
    cout << S.size() - 1 << endl;
    return 0;
}

Measured memory_bytes: 7992
from functools import reduce
from operator import itemgetter

N, M = map(int, input().split())
a, b = zip(*(map(int, input().split()) for _ in range(M)))
ts = sorted(zip(a, b), key=itemgetter(1))
ans = reduce(
    lambda acc, t: acc if t[0] < acc[1] else (acc[0] + 1, t[1]),
    ts,
    (0, 0)
)[0]
print(ans)


Measured memory_bytes: 58084
package main

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

var sc = bufio.NewScanner(os.Stdin)

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func getMax(array []int) (int, []int) {
	max := 0
	var other []int
	for i := range array {
		if max < array[i] {
			other = append(other, max)
			max = array[i]
		} else {
			other = append(other, array[i])
		}
	}
	return max, other
}

func check(array []int, max int) string {
	var s int
	for i := range array {
		s += array[i]
	}
	// // TODO Delete before submit
	// fmt.Println("Max:", max)
	// fmt.Println("Sum:", s)
	if max < s {
		return "Yes"
	} else {
		return "No"
	}
}

func main() {
	sc.Split(bufio.ScanWords)
	n := nextInt()
	var array []int
	for i := 0; i < n; i++ {
		array = append(array, nextInt())
	}
	max, others := getMax(array)
	result := check(others, max)
	fmt.Print(result)
}


Measured memory_bytes: 640
#include <stdio.h>

int RS(char s[], int n)
{
	if (n % 2 == 1)
		return 0;
	
	for (int i = 0; i < n/2; i++) {
		if (s[i] != s[i + n/2])
			return 0;
	}
	
	return 1;
}

void PutYN(int n)
{
	if (n)
		puts("Yes");
	else
		puts("No");
}

int main()
{
	int n; char s[101];
	scanf("%d %s", &n, &s);
	
	PutYN(RS(s, n));
}


Measured memory_bytes: 128
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<ctype.h>
#define MAX_ROW 160
#define MAX_COL 160

int main(void){
	int inputR,inputC;           //??\?????°??? R-??????,col-?¨????
	int inputDiag;               //??\??????????§????
	int i,j;                     //???????????¨?????°
	int ansR,ansC;               //??????
	int ansDiag;                 //?????????????§????
	int tempDiag;                //??????????????????????§?????????????
	int diag[MAX_ROW][MAX_COL]={};
	//diag[i][j]???????¨?i,??????j???????????¢???????§??????????????????????
	
	//??????????¨????(?¨????????????¢????????????)
	for(i=1;i<MAX_ROW;i++){
		for(j=i+1;j<MAX_COL;j++){
			if(i!=0 && j!=0) diag[i][j]=i*i+j*j;
		}
	}
	
	//ctrl+d??????????????§?????????
	while(scanf("%d %d",&inputR,&inputC)!=EOF){
		if(inputR+inputC==0)break;    //????????????
		ansR=160;//??????????????§?????§???????????????????????????????????£??\
		
		//??¢?´¢??????????§????????????????????????§????????????input????????§??????????°??????¢???
		inputDiag=inputR*inputR+inputC*inputC; //??\????????????????????¢???????§??????????????????????
		for(i=1;i<MAX_ROW;i++){
			for(j=i+1;j<MAX_COL;j++){
				if(diag[i][j]==inputDiag){     //????§????????????????????????¨???
					if(inputR<i && i<ansR){    //?????????input????????§??????????°???????
						ansR=i;                //???????????????
						ansC=j;                //???????????????
					}
				}
			}
		}
		
		//????§????????????????????????????????????????
		if(ansR==160){
			//??¢?´¢??? ????§????????????????input????????§??????????°??????¢???
			ansDiag=160*160*2;
			for(i=1;i<MAX_ROW;i++){
				for(j=i+1;j<MAX_COL;j++){
					tempDiag=i*i+j*j;
					//??\???????????§??????????????????????????????
					if(inputDiag<tempDiag && tempDiag<ansDiag){
						ansDiag=tempDiag;
						ansR=i;
						ansC=j;
					}
					//?????????????????¨???
					else if(tempDiag==ansDiag){
						if(i<ansR){
							ansR=i;
							ansC=j;
						}
					}
				}
			}
		}
		printf("%d %d\n",ansR,ansC);
	}
	return 0;
}

Measured memory_bytes: 708
#include<cstdio>
#include<algorithm>
using namespace std;
int N;
int main() {
	#ifdef LOACL
	freopen("in.txt","r",stdin);
	freopen("out.txt","w",stdout);
	#endif
	scanf("%d",&N);
	if(N<=1199)puts("ABC");
	else if(1200<=N&&N<2800)puts("ARC");
	else puts("AGC");
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define rep(i,n) for(int i=1;i<=n;++i)
#define YES cout<<"YES"<<endl
#define NO cout<<"NO"<<endl
using namespace std;

int main(){
  int n;
  cin >> n;
  cout << n/3 << endl;
  return 0;
}


Measured memory_bytes: 256
function Main(input) {
	input = parseInt(input);
	let result = "";
	for(let i = 0; i  < input; i++){
      result += "ACL";
    }
  	console.log(result);
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 29652
#include <bits/stdc++.h>
 
using namespace std;
 
#define lli long long int
#define REP(i,s,l) for(lli i=s;i<l;i++)
#define MOD 1000000007
#define DEBUG 0
#define INF (1LL<<50)

lli n;

bool vis[1000100];
lli dp[1000100];
lli df[1000100];
lli dj[1000100];
map<lli,vector<lli>> p;
bool flag;

lli dfs2(lli now,lli cnt){
	if(flag)return INF;
	if(dj[now]==cnt){
		flag=true;
		return INF;
	}
	dj[now]=cnt;
	for(auto e:p[now]){
		if(df[e]>0)continue;
		dfs2(e,cnt);
	}
	df[now]=cnt;
	return INF;
}

lli dfs(lli now){
	if(vis[now])return dp[now];

	for(auto e:p[now]){
		dp[now] = min(dp[now],dfs(e)-1);
	}
	vis[now]=true;
	return dp[now];
}


lli point(lli a,lli b){
	return min(a,b)*n + max(a,b);
}

signed main(){

	cin>>n;

	map<lli,vector<lli>> m;

	REP(i,0,1000100){
		vis[i]=false;
		dp[i]=0;
		df[i]=0;
	}

	REP(i,0,n){
		REP(j,0,n-1){
			lli tmp;
			cin>>tmp;
			m[i].push_back(tmp-1);
		}

		lli beforePoint = point(i,m[i].at(n-2));
		for(lli j=n-3;j>=0;j--){
			lli nowPoint = point(i,m[i].at(j));
			p[nowPoint].push_back(beforePoint);
			beforePoint = nowPoint;
		}
	}
	flag=false;
	REP(i,0,n*n)dfs2(i,i+1);
	if(flag){
		cout<<-1<<endl;
		return 0;
	}

	REP(i,0,n*n)dfs(i);
	lli ans=0;
	REP(i,0,n*n){
		if(DEBUG)cout<<"i="<<i<<" "<<i/n<<" "<<i%n<<" dfs="<<dfs(i)<<endl;
		ans=min(ans,dfs(i));
	}

	cout<<-ans+1<<endl;

	return 0;
}

Measured memory_bytes: 126592
import sys
sys.setrecursionlimit(1000000)

N = int(input())
a = [[0]*3 for i in range(N)]

for i in range(N):
  a[i] = [int(i) for i in input().split()] 

def f(n, i):
  if n ==0:
    return a[0][i]
  i1 = (i+1) % 3
  i2 = (i+2) % 3
  if F[n][i]:
    return F[n][i]
  F[n][i] = max(f(n-1, i1), f(n-1, i2)) + a[n][i] 
  return F[n][i]  

F =[[None]*3 for _ in range(N)]

print(max(f(N-1, 0), f(N-1,1), f(N-1,2)))


Measured memory_bytes: 120640
#include<iostream>
#include<map>
#include<vector>
#include<algorithm>
#include<queue>

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

using namespace std;
using ll = long long int;

vector<vector<int>> cave;
vector<int> done;

void bfs() {
    queue<vector<int>> que;
    que.push({0, 0, 0});
    while(!que.empty()) {
        int pre = que.front()[0], cur = que.front()[1], cnt = que.front()[2];
        que.pop();
        if (done[cur] == -1 || done[cur] > cnt) done[cur] = cnt;
        else continue;
        for (auto next : cave[cur]) {
            if (next == cur || next == pre) continue;
            que.push({cur, next, cnt + 1});
        }
    }
    return;
}

int main(void) {
    int n, m; cin >> n >> m;
    cave.resize(n);
    done.resize(n);
    REP(i, n) done[i] = -1;
    REP(i, m) {
        int a, b;
        cin >> a >> b;
        a--; b--;
        cave[a].push_back(b);
        cave[b].push_back(a);
    }
    bfs();
    //REP(i, n) cout << done[i] << endl;
    bool t = true;
    REP(i, n) if (done[i] == -1) t = false;
    if (t) {
        cout << "Yes" << endl;
        for (int i = 1; i < n; i++) {
            for (int v = 0; v < cave[i].size(); v++) {
                if (done[i] - 1 == done[cave[i][v]]) {
                    cout << cave[i][v] + 1 << endl;
                    break;
                }
            }
        }
    }
    else cout << "No" << endl;
}

Measured memory_bytes: 27944
#include<iostream>
#include<string>
#include<algorithm>
#include <stdio.h>
#include<iostream>
#include<iomanip>
#include<cmath>
#include<array>
#include<vector>
#include<set>
#include <utility>
#include <map>
#include<bitset>

using namespace std;



int main(){
  int a,b,c; cin>>a>>b>>c;
  if(a + b + c >= 22)
    cout << "bust" <<endl;
  else
    cout << "win" <<endl;
}


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

void trace(int A[], int N) {
	for (int i = 0; i < N; i++) {
		if (i > 0)
			cout << " ";
		cout << A[i];
	}
	cout << endl;
}

void insertionSort(int A[], int N) {
	int i, j, v;
	for (i = 1; i < N; i++) {
		v = A[i];
		j = i - 1;
		while (j >= 0 && A[j] > v) {
			A[j + 1] = A[j];
			j--;
		}
		A[j + 1] = v;
		trace(A, N);
	}
}

int main() {
	int N, i;
	int A[100];
	cin >> N;
	for (i = 0; i < N; i++) {
		cin >> A[i];
	}
	trace(A, N);
	insertionSort(A, N);

	return 0;
}


Measured memory_bytes: 3104
import math

x=0.0
y=0.0
d=90.0

while True:
    list = [float(i) for i in raw_input().split(",")]
    if list[0]==0 and list[1]==0:
        break
    x += list[0]*math.cos(math.radians(d))
    y += list[0]*math.sin(math.radians(d))
    d += -list[1]

for i in (x,y):
    print int(i)

Measured memory_bytes: 4444
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); i++)
#define repf(i,a,b) for (int i = (a); i < (b); i++)
#define repi(i,a,b) for (int i = (a); i <= (b); i++)
#define repr(i,a,b) for (int i = (a); i >= (b); i--)
#define all(x) (x).begin(),(x).end()
#define debug(x)  cout << #x << " = " << (x) << endl;
using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int, int>;
using vc = vector<char>;
using vvc = vector<vc>;
using vs = vector<string>;
using tiii = tuple<int, int, int>;

ll sum_digits(ll n) {
  ll s = 0;
  while (n > 0) {
    s += n%10;
    n /= 10;
  }
  return s;
}

int main() {
  int N, A, B; cin >> N >> A >> B;
  int ans = 0;
  repi(i,1,N) {
    if (A<=sum_digits(i) && sum_digits(i)<=B) ans += i;
  }
  cout << ans << endl;
}

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

int g[15][15];

int main() {
  int n;
  cin >> n;
  rep(i,n)rep(j,n) g[i][j] = -1;
  rep(i,n) {
    int m;
    cin>>m;
    rep(j,m) {
      int a, x;
      cin >> a >> x;
      --a;
      g[i][a] = x;
    }
  }
  int ans = 0;
  rep(i,1<<n) {
    vector<int> d(n);
    rep(j,n) if (i>>j&1) {
      d[j] = 1;
    }
    bool ok = true;
    rep(j,n) {
      if (d[j]) {
        rep(k,n) {
          if (g[j][k] == -1) continue;
          if (g[j][k] != d[k]) ok = false;
        }
      }
    }
    if (ok) ans = max(ans, __builtin_popcount(i));
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<set>

using namespace std;

int main()
{
	int H, W;
	cin >> H >> W;

	for (int h = 1; h <= H; h++) {
		for (int w = 1; w <= W; w++) {
			string s;
			cin >> s;
			if (s == "snuke") {
				cout << (char)('A' + w - 1) << h << endl;
				return 0;
			}
		}
	}


}






Measured memory_bytes: 3612
#include <iostream> 
#include <bits/stdc++.h>
#include <vector> 
#include <algorithm> 
#include <string>
#include <cmath>
#include <iomanip> 
#include<climits> 
#include <utility>   
#include <set>
#include <numeric> 
#include <iterator>
#include <map> 
using namespace std; 
#define ll long long int
typedef pair<int,int> p; 
 

int main() {
int n,r;
cin>>n>>r;
if(n>=10)
cout<<r<<endl;
else
{
    cout<<r + 100*(10-n);
}



}

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

void solve(long long A, long long B, long long C, long long X, long long Y)
{
    long long res = 0;
    res = min(A * X + B * Y, A * (X - min(X, Y)) + B * (Y - min(X, Y)) + 2 * C * min(X, Y));
    res = min(res, 2 * C * max(X, Y));

    cout << res << endl;
}

// 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()
{
    long long A;
    scanf("%lld", &A);
    long long B;
    scanf("%lld", &B);
    long long C;
    scanf("%lld", &C);
    long long X;
    scanf("%lld", &X);
    long long Y;
    scanf("%lld", &Y);
    solve(A, B, C, X, Y);
    return 0;
}


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

using namespace std;

const int mod = 1e9 + 7;

template<typename T>
T inverse(T a, T m){
  T u = 0, v = 1;

  while(a){
    T t = m / a;
    m -= t * a; std::swap(a, m);
    u -= t * v; std::swap(u, v);
  }
  
  u %= mod;
  if(u < 0) u += mod;

  return u;
}

template<typename T>
T inverse(T a){
  return inverse(a, (T)mod);
}

void bottom_up(int node, const vector<vector<int>>& to, vector<int>& dec, vector<int>& parent, vector<long long>& dp, const long long* fac){
  dec[node] = 1;
  dp[node] = 1;
  
  for(int next : to[node]){
    if(next == parent[node]) continue;
    
    parent[next] = node;
    
    bottom_up(next, to, dec, parent, dp, fac);
    
    dec[node] += dec[next];
    (dp[node] *= inverse(fac[dec[next]])) %= mod;
    (dp[node] *= dp[next]) %= mod;
  }
  
  (dp[node] *= fac[dec[node] - 1]) %= mod;
}

void top_down(int node, const vector<vector<int>>& to, const vector<int>& dec, const vector<int>& parent, vector<long long>& dp, const long long* fac){
  if(dp[node] < 0) dp[node] += mod;
  
  for(int next : to[node]){
    if(next == parent[node]) continue;
    
    (dp[next] *= dp[node] * inverse(dp[next]) % mod * dec[next] % mod * inverse((long long)to.size() - dec[next]) % mod) %= mod;
    
    top_down(next, to, dec, parent, dp, fac);
  }
}

int main(){
  int N;
  cin >> N;
  
  vector<vector<int>> to(N);
  
  for(int i = 0; i < N - 1; i++){
    int a, b;
    cin >> a >> b;
    a--; b--;
    
    to[a].push_back(b);
    to[b].push_back(a);
  }
  
  long long fac[N + 1];
  fac[0] = 1;
  for(int i = 1; i <= N; i++) fac[i] = fac[i - 1] * i % mod;
  
  vector<long long> dp(N);
  vector<int> dec(N);
  vector<int> par(N, -1);
  
  bottom_up(0, to, dec, par, dp, fac);
  top_down(0, to, dec, par, dp, fac);
  
  for(int k = 0; k < N; k++){
    cout << dp[k] << endl;
  }
  
  return 0;
}

Measured memory_bytes: 19456
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        boolean flag = false;
        for (int i=0;i<=N/4;i++){
            for (int j=0;j<=N/7;j++){
                if (4*i + 7*j == N){
                    System.out.println("Yes");
                    System.exit(0);
                }
            }
        }
        System.out.println("No");
    }
}


Measured memory_bytes: 21076
n = gets.to_i
g = Array.new(n+1){ [] }

n.times do |i|
  u,k,*v = gets.split.map(&:to_i)
  g[u] += v if k > 0
end

d = Array.new(n+1, 0)
f = Array.new(n+1, 0)
t = 0

dfs = -> v do
  return if d[v] > 0
  t += 1; d[v] = t
  g[v].sort.each do |nv|
    dfs[nv]
  end
  t += 1; f[v] = t
end

1.upto(n) do |v|
  dfs[v]
end

1.upto(n) do |v|
  puts [v, d[v], f[v]].join(" ")
end



Measured memory_bytes: 7260
#include <stdio.h>
#include <stdlib.h>

int comp( const void * a , const void * b ) {
	if(((int *)a)[1] < ((int *)b)[1]) {
		return 1;
	}
	else
	if(((int *)a)[1] == ((int *)b)[1]) {
		return 0;
	}
	return -1;
}

int main()
{
	int NMAX = 100000;
	int n;
	int v_odd[NMAX][2];
	int v_even[NMAX][2];

	for (int i = 0; i < NMAX; i ++) {
		v_odd[i][0] = i+1;
		v_odd[i][1] = 0;
		v_even[i][0] = i+1;
		v_even[i][1] = 0;
	}

	scanf("%d", &n);
	for (int i = 0; i < (n / 2); i ++) {
		int t;
		scanf("%d", &t);
		v_odd[t-1][1] ++;
		scanf("%d", &t);
		v_even[t-1][1] ++;
	}

	qsort( (void*)v_odd, NMAX, sizeof(v_odd[0]), comp );
	qsort( (void*)v_even, NMAX, sizeof(v_even[0]), comp );

	/*
	printf ("-- dump --\n");
	for (int i = 0; i < NMAX; i ++) {
		printf("(%d %d)", v_odd[i][0], v_odd[i][1]);
	}
	printf ("\n");
	for (int i = 0; i < NMAX; i ++) {
		printf("(%d %d)", v_even[i][0], v_even[i][1]);
	}
	printf ("\n");
	*/

	if (v_odd[0][0] == v_even[0][0]) {
		if (v_odd[0][1] == v_even[0][1]) {
			if (v_odd[1][1] > v_even[1][1]) {
				printf("%d", (n/2 - v_odd[1][1]) + (n/2 - v_even[0][1]));
			} else {
				printf("%d", (n/2 - v_odd[0][1]) + (n/2 - v_even[1][1]));
			}
		} else if (v_odd[0][1] > v_even[0][1]) {
			printf("%d", (n/2 - v_odd[0][1]) + (n/2 - v_even[1][1]));
		} else {
			printf("%d", (n/2 - v_odd[1][1]) + (n/2 - v_even[0][1]));
		}
	} else {
		printf("%d", (n/2 - v_odd[0][1]) + (n/2 - v_even[0][1]));
	}
	return 0;
}


Measured memory_bytes: 2352