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

/**
 * 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);
		Task solver = new Task();
		solver.solve(1, in, out);
		out.close();
	}

	static class Task {
		public void solve(int testNumber, InputReader in, PrintWriter out) {
			int N = in.nextInt();
			int K = in.nextInt();
			int ans = 1;
			for(int i = 0; i < N; i++) {
				ans = Math.min(ans * 2, ans + K);
			}
			out.println(ans);
		}
	}

	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: 22612
import sys
import math
from pprint import pprint

A, B, N = map(int, sys.stdin.readline().strip().split())

def func(x):
    # return math.floor(A*x/B) - A*math.floor(x/B)
    return A*x//B - A*(x//B)


right = N
left = 0
while right - left > 5:
    mid_left = right//3+left*2//3
    mid_right = right*2//3+left//3
    # print("mid", mid_left, mid_right)
    #if mid_left == mid_right:
    #    break
    # print("func", func(mid_left), func(mid_right))
    if func(mid_left) <= func(mid_right):
        left = mid_left
    else:
        right = mid_right
    # print("lr", left, right)

ans = -1 * float("inf")
for i in range(left, right+1):
    # print(i, func(i))
    ans = max(ans, func(i))
print(ans)

Measured memory_bytes: 9860
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define inf 1001001001
typedef pair<int,int> P;
#define mod 1000000007


int main(){
    int r,d,x;
    cin >> r >> d >> x;
    rep(i,10){
        x=r*x-d;
        cout << x << endl;
    }
    return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;

class Program
{
    #region library
    static int n = 0;
    static int m = 0;
    static int r = 0;
    static int c = 0;
    static int x = 0;
    static int y = 0;
    static int[] arr;
    static string s = "";
    static string[] ss;
    static string alpha = "abcdefghijklmnopqrstuvwxyz";
    static long sum = 0;
    static long cnt = 0;
    static long max = -1;
    static long min = 2147483647;
    static bool flg = false;
    static bool flg2 = false;
    static char[,] map;
    static int[,] imap;
    static string rl()
    {
        return Console.ReadLine();
    }
    static string[] rls()
    {
        return Console.ReadLine().Split();
    }
    static void wl(object obj = null)
    {
        Console.WriteLine(obj);
    }
    static void w(object obj)
    {
        Console.Write(obj);
    }
    static int Int(string s)
    {
        return int.Parse(s);
    }
    static long Max(long a, long b)
    {
        return Math.Max(a, b);
    }
    static long Min(long a, long b)
    {
        return Math.Min(a, b);
    }
    static long Abs(long a)
    {
        return Math.Abs(a);
    }
    static void yes()
    {
        wl("YES");
    }
    static void no()
    {
        wl("NO");
    }
    static void Sum()
    {
        wl(sum);
    }
    static void Cnt()
    {
        wl(cnt);
    }
    static void setmap(char def = '@')
    {
        if (r == 0 && c == 0)
        {
            ss = rls();
            r = Int(ss[0]);
            c = Int(ss[1]);
        }
        map = new char[r, c];
        for (int i = 0; i < r; i++)
        {
            if (def == '@') s = rl();
            for (int j = 0; j < c; j++)
            {
                map[i, j] = (def == '@') ? s[j] : def;
            }
        }
    }
    static void setimap(int def = -1)
    {
        if (r == 0 && c == 0)
        {
            ss = rls();
            r = Int(ss[0]);
            c = Int(ss[1]);
        }
        imap = new int[r, c];
        for (int i = 0; i < r; i++)
        {
            if (def == -1) s = rl();
            for (int j = 0; j < c; j++)
            {
                imap[i, j] = (def == -1) ? Int(s[j].ToString()) : def;
            }
        }
    }
    #endregion

    static void Main(string[] args)
    {
        ss = rls();
        int a = Int(ss[0]);
        int b = Int(ss[1]);

        wl(Lcm(a, b));
    }

    /* 最大公約数 */
    static long Gcd(long a, long b)
    {
        var v = new[] { a, b };
        while (v[1] != 0) { v = new[] { v[1], v[0] % v[1] }; }
        return v[0];
    }

    /* 最小公倍数(上記Gcdとセットで使うこと） */
    static long Lcm(long a, long b)
    {
        return a / Gcd(a, b) * b;
    }

}



Measured memory_bytes: 13268
import java.util.Arrays;
import java.util.Scanner;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		player player1[] = new player[8];
		player player2[] = new player[8];
		player player3[] = new player[8];
        for(int i=0; i<8; i++)player1[i] = new player(sc.nextInt() , sc.nextDouble());
        for(int i=0; i<8; i++)player2[i] = new player(sc.nextInt() , sc.nextDouble());
        for(int i=0; i<8; i++)player3[i] = new player(sc.nextInt() , sc.nextDouble());
        
        Arrays.sort(player1);
        System.out.println(player1[0] + "\n" + player1[1]);
        player1[0].record = 50;
        player1[1].record = 50;
         
        Arrays.sort(player2);
        System.out.println(player2[0] + "\n" + player2[1]);
        player2[0].record = 50;
        player2[1].record = 50;
         
        Arrays.sort(player3);
        System.out.println(player3[0] + "\n" + player3[1]);
        player3[0].record = 50;
        player3[1].record = 50;
        
        Arrays.sort(player1);
        Arrays.sort(player2);
        Arrays.sort(player3);
        player player4[]= new player[6];
        player4[0] = new player(player1[0].playerNumber,player1[0].record);
        player4[1] = new player(player1[1].playerNumber,player1[1].record);
        player4[2] = new player(player2[0].playerNumber,player2[0].record);
        player4[3] = new player(player2[1].playerNumber,player2[1].record);
        player4[4] = new player(player3[0].playerNumber,player3[0].record);
        player4[5] = new player(player3[1].playerNumber,player3[1].record);
        Arrays.sort(player4);
        System.out.println(player4[0] + "\n" + player4[1]);
    }
}
	class player implements Comparable<player>{
		int playerNumber;
	    double record;
	    player(int playerNumber, double record){
	        this.playerNumber = playerNumber;
	        this.record = record;
	    }
	    @Override
	    public String toString(){
	        return  playerNumber + " " + record;
	    }
	    @Override
	    public int compareTo(player o) {
	    	return new Double(record).compareTo(o.record);
	    }
}

Measured memory_bytes: 28460
using System;
using System.Linq;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var value = Console.ReadLine().Trim();
            if (value.Length == 2)
            {
                Console.WriteLine(value);
            }
            else
            {
                var a = value.ToCharArray().Reverse();
                Console.WriteLine(string.Join("", value.ToCharArray().Reverse()));
            }
        }
    }
}

Measured memory_bytes: 13140
#include<bits/stdc++.h>
#define LiangJiaJun main
#define ll long long
using namespace std;
int n;
int a[4][104];
int f[4][104];
int LiangJiaJun(){
    scanf("%d",&n);
    for(int i=1;i<=2;i++)
        for(int j=1;j<=n;j++)scanf("%d",&a[i][j]);
    f[1][0]=0;
    f[2][0]=0;
    for(int i=1;i<=n;i++){
        f[1][i]=f[1][i-1]+a[1][i];
        f[2][i]=f[2][i-1]+a[2][i];
    }
    int ans=0;
    for(int i=1;i<=n;i++){
        ans=max(ans,f[1][i]+f[2][n]-f[2][i-1]);
    }
    cout<<ans<<endl;
    return 0;
}




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

#define fr first
#define sc second
#define pb push_back
#define mp make_pair
#define FOR(i,j,n) for(int i=j;i<n;i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(c) (c).begin(),(c).end()
#define RALL(c) (c).rbegin(),(c).rend()
#define SET(c) memset((c),0,sizeof(c))
#define SORT(c) sort(ALL(c))
#define RSORT(c) sort(RALL(c))
#define COPY(arr,to) copy(ALL(arr),back_inserter(to))
#define BIT(n) ((1 << n) - 1)
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> iP;
typedef pair<iP,int> iiP;
typedef vector<int> vi;
typedef vector<iP> vii;
typedef stringstream ss;

//Right,Under,Left,Top
const int dx[]={1,0,-1,0,-1,1,1,-1};
const int dy[]={0,1,0,-1,-1,1,-1,1}; 
const int INF = 2 << 28;
const double EPS = 1e-9;

string get(){ string s; cin.ignore(); getline(cin,s); cin.ignore(); return s; }
int value(){ int v; cin >> v; return v; }
bool isPrime(int v){ for(int i=2;i*i<=v;i++) if(!(v % i)) return false; return (v >= 2); }
bool isOver(int x,int y,int w,int h){ return (x >= 0 && x < w && y >= 0 && y < h); }
inline int toInt(string s){ int f; ss sss; sss << s; sss >> f; return f; }
template<class T> inline string toStr(T f){ ss sss; sss << f; return sss.str(); }

int main(){
  int cost[128][128];
  int n,m,s,g1,g2;
  while(cin >> n >> m >> s >> g1 >> g2,n||m||s||g1||g2){
    REP(i,n+1){
      REP(j,n+1){
	if(i == j) cost[i][j] = 0;
	else cost[i][j] = INF;
      }
    }
    REP(i,m){
      int t,m,p; cin >> t >> m >> p;
      cost[t][m] = p;
    }
    FOR(i,1,n+1){
      FOR(j,1,n+1){
	FOR(k,1,n+1) cost[j][k] = min(cost[j][k],cost[j][i] + cost[i][k]);
      }
    }
    int ret = INF;
    FOR(i,1,n+1) ret = min(ret,cost[s][i] + cost[i][g1] + cost[i][g2]);
    cout << ret << endl;
  }
}

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

#define lld long long
#define pi pair<int,int>
#define pl pair<lld,lld>
#define mem0(x) memset(x,0,sizeof(x))
#define fillnum(x,n) fill(begin(x),end(x),n)
#define asort(x) sort(x.begin(),x.end())
#define dsort(x,t) sort(x.begin(),x.end(),greater<t>())

int main() {
    int N,K;
    int p[1111];
    cin >> N >> K;
    for (int i = 0; i < N; i++) {
        cin >> p[i];
    }
    sort(p,p+N);
    int ans = 0;
    for (int i = 0; i < K; i++) {
        ans += p[i];
    }
    cout << ans << endl;
}

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

int main() {
  int64_t N, a, b, c;
  cin >> N;
  a = N/3, b = N/5, c = N/15;
  int64_t d = (1+N)*N/2 - (1+a)*a/2*3 - (1+b)*b/2*5 + (1+c)*c/2*15;
  cout << d << endl;
}


Measured memory_bytes: 3624
def matrixChainMultiplication(n):
    m = [[0 for x in range(n + 1)] for y in range(n + 1)]
    for l in range(2, n + 1):
        for i in range(1, n - l + 2):
            j = i + l - 1
            m[i][j] = 99000001
            for k in range(i, j):
                m[i][j] = min(m[i][j], m[i][k] + m[k + 1][j] + p[i - 1] * p[k] * p[j])
    print(m[1][n])


p = []

n = int(input())

for i in range(n):
    listed_input = input().split()
    p.append(int(listed_input[0]))

p.append(int(listed_input[1]))

matrixChainMultiplication(n)

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

if N==1:
    print(0)
    exit()


C=[0]*(N-1)
S=[0]*(N-1)
F=[0]*(N-1)

for i in range(N-1):
    C[i],S[i],F[i]=map(int,input().split())

for i in range(N-1):
    Time=0
    for j in range(i,N-1):
        if j==i:
            Time=S[i]
        else:
            cnt=max(0,(Time+C[j-1]-S[j]-1+F[j])//F[j])
            Time=S[j]+F[j]*cnt
    Time+=C[N-2]
    print(Time)
print(0)





Measured memory_bytes: 3188
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int A = sc.nextInt();
        int B = sc.nextInt();
    
        List<Integer> resultList = new ArrayList<>();
        resultList.addAll(Arrays.asList(A+B, A-B, A*B));
        
        int max = -100;
        for (int i=0; i<resultList.size(); i++) {
            max = Math.max(max, resultList.get(i));
        }
        System.out.println(max);
    
    }
}

Measured memory_bytes: 22996
import java.io.*;
import java.util.*;

public class Main {
  private static InputReader in;
  private static PrintWriter out;
  public static int mod = 1000000007;
  public static long[] fact, invfact, inv;
  static class Point implements Comparable<Point> {
    public int x,y;
    public Point (int x, int y) {
      this.x = x;
      this.y = y;
    }
    
    public int compareTo(Point other) {
      return (x+y) - (other.x+other.y);
    }
  }
  
  public static long comb(int n, int k) {
    if (n < 0 || k < 0 || k > n) return 0;
    return fact[n] * invfact[k] % mod * invfact[n-k] % mod;
  }

  public static void main(String[] args) throws IOException {
    in = new InputReader(System.in);
    out = new PrintWriter(System.out, true);
    
    int h = in.nextInt(), w = in.nextInt(), n = in.nextInt();
    fact = new long[h+w+1];
    invfact = new long[h+w+1];
    inv = new long[h+w+1];
    inv[0] = inv[1] = 1;
    for (int i = 2; i < inv.length; i++) {
      inv[i] = (mod - mod/i) * inv[mod % i] % mod;
    }
    fact[0] = 1; invfact[0] = 1;
    for (int i = 1; i < fact.length; i++) {
      fact[i] = fact[i-1] * i % mod;
      invfact[i] = invfact[i-1] * inv[i] % mod;
    }
    Point[] p = new Point[n+1];
    for (int i = 0; i < n; i++) {
      p[i] = new Point(in.nextInt()-1, in.nextInt()-1);
    }
    p[n] = new Point(h-1, w-1);
    Arrays.sort(p);
    
    long[] dp = new long[n+1];
    for (int i = 0; i <= n; i++) {
      dp[i] = comb(p[i].x+p[i].y,p[i].x);
      for (int j = 0; j < i; j++) {
        long cc = comb(p[i].x+p[i].y-p[j].x-p[j].y,p[i].x-p[j].x) * dp[j] % mod;
        dp[i] = (dp[i] + mod - cc) % mod;
      }
    }
    
    out.println(dp[n]);
    out.close();
    System.exit(0);
  }

  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: 29268
#include <iostream>

int main()
{
  int N;
  std::cin >> N;
  int d[N];
  int b[110] = {0};
  for ( int i = 0; i < N; i++ ) {
    std::cin >> d[i];
    b[d[i]]++;
  }
  int ans = 0;
  for ( int i = 0; i < 101; i++ ) {
    if ( b[i] != 0 ) ans++;
  }
  std::cout << ans << std::endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#pragma GCC optimize("O3")

#define fi first
#define se second
#define ep emplace
#define eb emplace_back
#define mp make_pair
#define pi pair<int,int>
#define vi vector<int>
#define vpi vector<pair<int,int>>
#define vll vector<ll>
#define vpll vector<pair<ll,ll>>
#define endl '\n'

#define si(v) int((v).size())
#define all(v) (v).begin(), (v).end()
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i) 
#define rep2(i, n, m) for (ll i = n; i <= (ll)(m); ++i)
#define rep3(i, n, m) for (ll i = n; i >= (ll)(m); --i)

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

using ll = long long;
using ld = long double;
using namespace std;

constexpr ll MOD = 1000000007;

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

  int n; cin >> n;
  vi a(n);
  rep(i, n) cin >> a[i];

  sort(all(a),greater<int>());
  int alice = 0, bob = 0;

  rep(i, n) {
    if (i % 2 == 0) alice += a[i];
    else bob += a[i];
  }

  cout << alice - bob << endl;

  return (0);
}


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

using namespace std;

int main() {

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

		if (i % 10 == (i % 100 - i % 10) / 10 && i % 10 == (i - i % 100) / 100) {
			cout << i << endl;
			return 0;
		}
	}

}

Measured memory_bytes: 256
#include <iostream>

using std::cin;

struct Circle {
    double x;
    double y;
    double r;
};

double pow2(double x);

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

    while (data_num--) {
        Circle a, b;
        cin >> a.x >> a.y >> a.r >> b.x >> b.y >> b.r;

        double dist = pow2(a.x - b.x) + pow2(a.y - b.y);

        int ans;
        if (dist > pow2(a.r + b.r)) {
            ans = 0;
        } else if (dist >= pow2(a.r - b.r)) {
            ans = 1;
        } else {
            ans = (a.r > b.r)? 2: (-2);
        }

        std::cout << ans << std::endl;
    }

    return 0;
}

double pow2(double x)
{
    return (x * x);
}

Measured memory_bytes: 1236
#ifdef LOCAL
#define _GLIBCXX_DEBUG
#endif
#include<bits/stdc++.h>
using namespace std;
#define rep(i,s,t) for(ll i = (ll)(s); i < (ll)(t); i++)
#define rrep(i,s,t) for(ll i = (ll)(s-1);(ll)(t) <= i; i--)
#define all(x) (x).begin(), (x).end()
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> Pll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vvl> vvvl;
constexpr ll INF = numeric_limits<ll>::max()/4;
constexpr ll n_max = 2e5+10;
#define int ll

template <typename A, typename B>
string to_string(pair<A, B> p);
string to_string(const string &s) {return '"' + s + '"';}
string to_string(const char *c) {return to_string((string) c);}
string to_string(bool b) {return (b ? "true" : "false");}
template <size_t N>
string to_string(bitset<N> v){
    string res = "";
    for(size_t i = 0; i < N; i++) res += static_cast<char>('0' + v[i]);
    return res;
}
template <typename A>
string to_string(A v) {
    bool first = true;
    string res = "{";
    for(const auto &x : v) {
        if(!first) res += ", ";
        first = false;
        res += to_string(x);
    }
    res += "}";
    return res;
}
template <typename A, typename B>
string to_string(pair<A, B> p){return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";}

void debug_out() {cerr << endl;}
template<typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
    cerr << " " << to_string(H);
    debug_out(T...);
}

#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

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

signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    ll n; cin >> n;
    vector<ll> a(n);
    for(int i = 0; i < n; i++) cin >> a[i];
    deque<ll> b;
    rep(i,0,n){
        if(i & 1)b.emplace_front(a[i]);
        else b.emplace_back(a[i]);
    }
    if(n & 1)reverse(all(b));
    for(auto &t : b)cout << t << " ";
    cout << "\n";
}

Measured memory_bytes: 6316
#include <iostream>

using namespace std;

int main()
{
    int n,co=0;
    cin >> n;
    int p[n];
    for(int i=0;i<n;i++)
        cin >> p[i];
    for(int i=0;i<n;i++)
        if(p[i]!=i+1)
            co++;
    if(co==0||co==2)
        cout << "YES" << endl;
    else
        cout << "NO" << endl;
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  int n, sum=0,m=0;
  string s; 
  cin >> n >> s;
  
  for(int i=0; i<n; i++){
  	if(s[i]=='I') sum++;
    else sum--;
  	m = max(m, sum);
  }
	cout << m << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007
#define _USE_MATH_DEFINES
#include <math.h>
int main() {
	ll n,k;
	cin>>n>>k;
	ll u[200010]={},d[200010]={};
	u[0]=0;
	d[0]=n;
	for(ll i=1;i<=n;i++){
		u[i]+=i+u[i-1];
		d[i]+=n-i+d[i-1];
	}
	ll sum=0;
	for(ll i=k-1;i<=n;i++){
	//	cout << u[i]<<" "<<d[i]<<endl; 
		sum+=d[i]-u[i]+1;
		sum%=inf;
	}
	cout <<sum;
	// your code goes here
	return 0;
}

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

void insert(int);
void delete(int);
void deleteFirst(void);
void deleteLast(void);


struct node{
  int x;
  struct node *next;
  struct node *prev;
};
typedef struct node* Pnode;

Pnode head;
Pnode tail;
struct node *nod;
int main(){
  int x,i,n;
  head=malloc(sizeof(struct node));
  tail=malloc(sizeof(struct node));
  char cmd[20];
  head->next=tail;
  head->prev=NULL;
  tail->prev=head;
  tail->next=NULL;
  scanf("%d",&n);
  //ここまで初期設定
  for(i=0;i<n;i++){
    scanf("%s",cmd);
    if(strcmp(cmd,"insert")==0)scanf("%d",&x),insert(x);
    if(strcmp(cmd,"delete")==0)scanf("%d",&x),delete(x);
    if(strcmp(cmd,"deleteFirst")==0)delete(head->next->x);//delete(fast number)とdeleteFirstは同じ意味である。
    if(strcmp(cmd,"deleteLast")==0)deleteLast();
  }
  for(nod=head->next;nod->next!=NULL;nod=nod->next){
    if(nod->next->next==NULL)printf("%d",nod->x);
    else printf("%d ",nod->x);
  }

  printf("\n");
  return 0;
}
void insert(int x){
  Pnode newnode;
  newnode=malloc(sizeof(struct node));
  newnode->next=head->next;
  newnode->prev=head;
  head->next=newnode;
  newnode->next->prev=newnode;
  newnode->x=x;
}
void delete(int x){
  for(nod=head;nod->next!=NULL;nod=nod->next){
    if(nod->next->x==x)break;
  }
  if(nod->next!=NULL){
  nod->next->next->prev=nod;
  nod->next=nod->next->next;
  }
}
void deleteFirst(){
  
}
void deleteLast(){
  tail=tail->prev;
  tail->next=NULL;
  //tailを一つ下げる
}



Measured memory_bytes: 36120
import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int count = 0;
		for(int i = a; i <= b; i ++) {
			int tt = i /10000;
			int fi = i %10;
			int th = i /1000 %10;
			int te = i /10 % 10;
			if(tt == fi && th == te) {
				count++;
			}
		}
		System.out.println(count);
		sc.close();
	}
}


Measured memory_bytes: 21972
#include <bits/stdc++.h>
using namespace std;
typedef long long int lld;
typedef vector<int> vi;
typedef pair<int,int> pi;
#define F first
#define S second
#define MOD 1000000007
#define PB push_back
#define MP make_pair
#define rep(i,a,b) for (int i = a; i < b; i++)
static lld r,j,a,m,b,l,x,y,n,s,q,i,z,p,k,c,d,t;string s1,s2,s3;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin>>t;
    lld a[100001]={0};
    for(i=2;i<=100000;i++)
    {
    	if(a[i]==0)
    	{
    		for(j=2*i;j<=100000;j=j+i)
    			a[j]=1;
    	}
    }vi v;
    for(i=3;i<=100000;i=i+2)
    {
    	if(a[i]==0&&a[(i+1)/2]==0)
    		v.PB(i);
    }/*
    for(auto x:v)

    	cout<<x<<" ";*/
    	      
    rep(j,0,t)
    {
      cin>>x>>y;k=0;
      i=lower_bound(v.begin(), v.end(),x)-v.begin();
      while(v[i]>=x&&v[i]<=y)
      {
      	k++;i++;
      }
      cout<<k<<endl;
    }
}

Measured memory_bytes: 1408
#include <cstdio>
using namespace std;
int k, x;
int main() {
	scanf("%d%d", &k, &x);
	for (int i = x - k + 1; i <= x + k - 1; i++)
		if (i >= -1000000 && i <= 1000000)
			printf("%d ", i);
	printf("\n");
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;

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

void solve(long long N){
    vector<pair<ll, ll>> res;
    for(int i=2; i<=N/i; i++){
        ll b = 0;
        while(N % i == 0){
            N /= i;
            b++;
        }
        res.emplace_back(i,b);
    }
    if(N != 1) res.emplace_back(N,1);

    ll ans = 0;
    for(auto s : res){
        ll p = s.second;
        ll b = 1;
        while (b <= p){
            p -= b;
            b++;
            ans++;
        }
    }
    cout << ans << endl;
}


int main(){
    long long N;
    scanf("%lld",&N);
    solve(N);
    return 0;
}


Measured memory_bytes: 19708
#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
#define lli long long int   //used int to avoid mle
#define ulli unsigned long long int 
#define ld long double
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define loop(i,a,b) for(lli i=a;i<b;i++)
#define initialize(array,size,value) for(lli i=0;i<size;i++) array[i]=value
#define couta(array,size) for(lli i=0;i<size;i++) cout<<array[i]<<" "
#define vl vector<lli>
#define vp vector< pair <lli,lli> >
#define sl set<lli>
#define spl set<pll>
#define msl multiset <lli>
#define msp multiset <pll>
#define pll pair<lli, lli>
#define mll map<lli, lli>              //for( map<lli, lli>::iterator i=temp.begin();i!=temp.end();i++)cout<<i->fi<<" "<<i->se<<endl;
#define mvl map<lli, vl>
#define umll unordered_map<lli, lli>
#define vt vector<pair<lli, pll >  >
#define vf vector<pair<pll,pll > >
#define qu queue<lli>
#define pq priority_queue<lli>
#define dq deque <lli>
#define ptr vector<lli>::iterator
#define bs(array,x) binary_search(array.begin(),array.end(),x)
#define lb(array,x) lower_bound(array.begin(),array.end(),x)
#define ub(array,x) upper_bound(array.begin(),array.end(),x)
#define nobw(array,i,j) upper_bound(array.begin(), array.end(), j)-lower_bound(array.begin(), array.end(), i) //number of numbers between i & j
#define vc clear()
#define endl '\n'
#define sp system("pause");
#define INF 9223372036854775807
#define MINF -9223372036854775808
#define start_routine() int begtime = clock();
#define end_routine() int endtime = clock(); cerr << endl << "Time elapsed: " << (endtime - begtime)*1000/CLOCKS_PER_SEC << " ms"; return 0
lli mod=1000000007;
//string s=bitset<32>(n).to_string();
int main()
{
 	ios::sync_with_stdio(0);
    cin.tie(0);
   
        lli n;
        cin>>n;
        string s,t;
        cin>>s>>t;
        string an="";
        for(lli i=0;i<n;i++){
        	an+=s[i];
        	an+=t[i];
        }
        cout<<an;
  
}

Measured memory_bytes: 256
n = int(input())
w = []
for i in range(n):
    tmp = input()
    w.append(tmp)

ans = True
for i in range(1, n):
    if w[i][0] != w[i-1][len(w[i-1])-1]:
        ans = False
        break
    else:
        for j in range(0, i):
            if w[j] == w[i]:
                ans = False
                break

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

Measured memory_bytes: 9180
#include<bits/stdc++.h>
#define LL long long
using namespace std;
LL n,a,b;
int main(){
    // freopen("test.in","r",stdin);
    cin>>n>>a>>b;if(a>b)swap(a,b);
    if((a+b)&1)
        printf("%lld\n",min(a+(b-a-1)/2,n-b+1+(b-a-1)/2));
    else printf("%lld\n",(b-a)/2);
    return 0;
}

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

int main(){
  int L, R, d;
  cin >> L >> R >> d;
  
  if (L==R || d==1)
  	cout << R/d - L/d + 1 << endl;
  else 
    cout << R/d - L/d << endl;
}

Measured memory_bytes: 3592
#include<iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <math.h>
#include <iomanip>
#include <set>

#define rep(i,n)  for (int i = 0; i < (int)(n); i++)
#define INF 9999999999
#define PI 3.14159265359
using namespace std;

int main()
{
	string s,t;
	cin >>s>>t;
	int i,ans=0;
	rep(i,s.size()){
		if (s[i]!=t[i]) ans++;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3580
import java.io.*;
import java.util.*;

class Main {
  public static void main (String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    ArrayList<String> list = new ArrayList<String>();
    int highs = 0;
    for(int i = 0; i < n; i++) {
      int rating = sc.nextInt();
      String color = "";
      if(rating <= 399)
        color = "gray";
      else if(rating <= 799)
        color = "brown";
      else if(rating <= 1199)
        color = "green";
      else if(rating <= 1599)
        color = "cyan";
      else if(rating <= 1999)
        color = "blue";
      else if(rating <= 2399)
        color = "yellow";
      else if(rating <= 2799)
        color = "orange";
      else if(rating <= 3199)
        color = "red";
      else {
        highs++;
      }
      if(color.length() > 0) {
        if(!list.contains(color))
          list.add(color);
      }
    }
    int min = -1;
    if(list.size() == 0)
      min = 1;
    else
      min = list.size();
    int max = list.size() + highs;
    System.out.println(min + " " + max);
  }
}


Measured memory_bytes: 21716
def kiriage(n):
    while n %10  !=0:
        n+=1
    return n

def myfinal(A):
    r= 10
    r2 = 0
    for i in range(5):
        if A[i] % 10 < r and A[i] % 10 != 0:
            r = A[i] %10
            r2= i
    return r2

A = []
for i in range(5):
    A.append(int(input()))

f = myfinal(A)
ans = A[f]
for i in range(0,5):
    if i != f:
        ans += kiriage(A[i])
print(ans)

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

using namespace std;

int main()
{
  //freopen("test.inp","r",stdin);
    int n, W,T = 0,i,j;
    cin >> n >> W;
    int  w[n+1], v[n+1];
    for (i = 1; i <= n; i++)
    {
        cin >> w[i] >> v[i];
        T += v[i];
    }
    long long int f[T];
    f[0] = 0;
    for (i = 1; i <= T; i++)
    {
        f[i] = 1000000000;
    }
    for (i = 1; i <= n; i++)
    {
        for ( j = T; j >= v[i]; j--)
        {
            f[j] = min((w[i] + f[j-v[i]]), f[j]);
        }
    }
   for (i = T; i >= v[1] ; i--)
   {
       if ( f[i] <= W)
       {
           cout << i;
           return 0;
       }
   }
}


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

int64_t f(int64_t n){
  if(n==1){return 1;}
  int64_t s =f(n-1);
  return s*5 +1;}
int main() {

	int64_t N,cnt=0,j=1,s;
  
	cin>>N;
	if(N%2==0){
  for(int i=25;i>0; i--)
  {j=1;
   for(int k=i; k>0; k--) j*=5;
    while(N>=j*2) {N-=j*2;cnt+=f(i);}}}
  
  
	cout<<cnt<<endl;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<iostream>

int main()
{
    unsigned long long int K, A, B;
    scanf("%llu %llu %llu", &K, &A, &B);
    
  unsigned long long int biscuet = 1;
  if(B <= A + 2){
      std::cout << 1 + K << std::endl;
      return 0;
  }
  
  for(unsigned long long int k = 1; k <= K; k++){
      if(biscuet >= A and k <= K - 1){
          biscuet = biscuet - A + B;
          k++;
      }else{
          biscuet++;
      }
  }
  std::cout << biscuet << std::endl;
  return 0;
}


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

typedef long long ll;

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

	vector<vector<int> > D(C+1, vector<int>(C+1));
	for (int i = 1; i <= C; i++) {
		for (int j = 1; j <= C; j++) {
			cin >> D[i][j];
		}
	}

	vector<vector<int> > c(N+1, vector<int>(N+1));
	map<int, map<int,int> > m;
	for (int i = 1; i <= N; i++) {
		for (int j = 1; j <= N; j++) {
			cin >> c[i][j];
			m[(i+j)%3][c[i][j]]++;
		}
	}

	int mi=1e9;
	for (int i = 1; i <= C; i++) {
		for (int j = 1; j <= C; j++) {
			for (int k = 1; k <= C; k++) {
				if(i==j || j==k || i==k) continue;
				int sum=0;
				for (auto itr = m.begin(); itr != m.end(); itr++) {
					//cout << itr->first << endl;
					for (auto it = itr->second.begin(); it != itr->second.end(); it++) {
						//cout << it->first << " " << it->second << endl;
						if (itr->first == 0) {
							sum += D[it->first][i]*it->second;
						}
						else if (itr->first == 1) {
							sum += D[it->first][j] * it->second;
						}
						else {
							sum += D[it->first][k] * it->second;
						}
					}
				}
				//cout << i <<" "<< j <<" "<< k <<" "<< sum <<" "<< mi << endl;
				mi = min(mi, sum);
			}
		}
	}

	cout << mi << endl;

}

Measured memory_bytes: 1280
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
#define rep(i, begin, n) for (int i = begin; i < n; i++)
#define repe(i, begin, n) for (int i = begin; i <= n; i++)
#define repr(i, begin, n) for (int i = begin; i > begin - n; i--)
#define repre(i, begin, end) for (int i = begin; i >= end; i--)

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 = 1000000007;
const int MOD = 1000000007;
const long long INF = 1000000000000000007;

// -------------------------------------------------------
int N;
int A[200];

int main() {
  cin >> N;
  rep(i, 0, N) { cin >> A[i]; }
  int ans = 0;
  rep(i, 0, N - 1) {
    rep(j, i + 1, N) { chmax(ans, abs(A[i] - A[j])); }
  }
  cout << ans;
}


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

typedef long lint;
typedef long long llint;
typedef pair<int, int> pint;
typedef pair<long long, long long> pllint;

// static const int MAX = 1e6;
// static const int NIL = -1;
// static const ll INF = 1<<21;
// static const ll MOD = 1e9 + 7;

bool compPair(const pint& arg1, const pint& arg2) { return arg1.first > arg2.first; }
template<class T> void chmax(T& a, T b) { if (a < b) { a = b; } }
template<class T> void chmin(T& a, T b) { if (a > b) { a = b; } }

int main(void) {
    int x;
    cin >> x;

    int  a = 2, ans = 1;
    while(a<=x) {
        for(int ia=a*a;ia<=x;ia*=a) {
            ans = max(ans, ia);
        }
        a++;
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
let z()=List.map int_of_string(Str.split(Str.regexp" ")(read_line()))open Array;;match z()with[r;c]->(let a=make_matrix(r+1)(c+1)0in for i=0to r-1do let x=of_list(z())in for j=0to c-1do a.(i).(j)<-x.(j);a.(i).(c)<-a.(i).(c)+x.(j)done done;for i=0to c-1do for j=0to r-1do a.(r).(i)<-a.(r).(i)+a.(j).(i)done;a.(r).(c)<-a.(r).(c)+a.(r).(i)done;for i=0to r do for j=0to c do Printf.printf(if j=0then"%d"else" %d")a.(i).(j)done;print_newline()done)|_->()

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

#define count_ones __builtin_popcountl
#define all(a) a.begin(), a.end()
#define gcd(a, b) __gcd(a, b)
#define lca(a, b) a / __gcd(a, b) * b
typedef long long ll;
typedef long long ld;
using namespace std;

int main() {
    ios::sync_with_stdio(false);

    ll n;
    cin >> n;

    vector<ll> dividers;
    for (ll i = 1; i * i <= n; i++) {
        if (n % i == 0) {
            dividers.push_back(i);
            if (n / i != i) {
                dividers.push_back(n / i);
            }
        }
    }

    ll min_sum = 1e12 + 1;

    for (ll i = 0; i < dividers.size(); i++) {
        ll steps = dividers[i] + n / dividers[i];
        if (min_sum > steps) {
            min_sum = steps;
        }
    }
    cout << min_sum - 2;


    return 0;
}

Measured memory_bytes: 384
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int k = scan.nextInt();
		int[] p = new int[n];

		for (int i = 0; i < n; i++) {
			p[i] = scan.nextInt();
		}

		Arrays.sort(p);

		int sum = 0;
		for (int i = 0; i < k; i++) {
			sum += p[i];
		}

		System.out.println(sum);
	}

}


Measured memory_bytes: 38956
x = int(input())
def isPrime(n):
	if n == 2 or n == 3:return True
	i = 2
	while i*i <= n:
		if n%i == 0:return False
		i += 1
	return True

for i in range(x,2*x):
	if isPrime(i):print(i);exit()
exit()


Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define ALL(a)  (a).begin(),(a).end()
#define SUM(a)  accumulate((a).begin(),(a).end(),0)
#define SORT(a) sort(ALL(a))
#define REV(a) reverse(ALL(a))
#define dump(x)  cerr << #x << " = " << (x) << endl;
typedef long long ll;
const int INTINF = 1<<29;
const ll LLINF = 1LL<<61;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;
const int DX[8]={ 0, 1, 0,-1, 1, 1,-1,-1};
const int DY[8]={ 1, 0,-1, 0, 1,-1, 1,-1};

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll n;
  cin >> n;
  ll n2 = n;
  int ans = 0;
  while(n){
    if (n<10){
      ans += (n-1);
    }else{
      ans += 9;
    }
    n /= 10;
  }
  int ans2 = 0;
  while(n2){
    ans2 += (n2%10);
    n2 /= 10;
  }
  cout << max(ans,ans2) << endl;

}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#ifdef _DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

//#define int long long
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9) + 7;
template<class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return true; } return false; }

template<class T, class ...Tail>
void tiedSort(vector<T> &a, vector<Tail>&... tail) {
	int n = a.size();
	using S = tuple<T, Tail...>;
	vector<S> s(n);
	for (int i = 0; i < n; i++)
		s[i] = make_tuple(a[i], tail[i]...);
	sort(s.begin(), s.end());
	for (int i = 0; i < n; i++)
		tie(a[i], tail[i]...) = s[i];
}

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N, M, s, t; cin >> N >> M >> s >> t; s--, t--;
	vector<int> d(N); rep(i, 0, N) {
		cin >> d[i];
	}
	vector<vector<int>> g(N);
	vector<int> a(M), b(M); rep(i, 0, M) {
		cin >> a[i] >> b[i];
		a[i]--, b[i]--;
		g[a[i]].push_back(b[i]);
	}
	using State = tuple<int, int, int>;
	priority_queue<State> pq;
	vector<int> dist(N, INF);
	rep(i, 0, s + 1)dist[i] = 0;

	rep(i, 0, M) {
		if (a[i] <= s)
			pq.emplace(-d[b[i]], a[i], b[i]);
	}
	dump(g);
	dump(pq);
	while (pq.size()) {
		dump(dist);
		int c, ca, cb; tie(c, ca, cb) = pq.top(); pq.pop();
		c *= -1;
		dump(c, ca, cb);
		rrep(i, 0, cb + 1) {
			if (dist[i] != INF)
				break;
			dist[i] = c;
			rep(j, 0, g[i].size()) {
				pq.emplace(-(d[g[i][j]] + c), i, g[i][j]);
			}
		}
	}
	dump(dist);
	cout << dist[t] << endl;
	return 0;
}

Measured memory_bytes: 9836
#include<bits/stdc++.h>
using namespace std;
int main(){
    long long int n , m , si , ci , i;
    cin >> n >> m;
    long long int arr[n] , hash[n];
    for(i = 0 ; i < n ; i++){
        arr[i] = 0;
        hash[i] = 0;
    }
    if(n != 1)
        arr[0] = 1;
    bool flag = true;
    for(i = 0 ; i < m ; i++){
        cin >> si >> ci;
        si = si - 1;
        if(hash[si] == 1 and arr[si] != ci){
            flag = false;
        }
        else{
            hash[si] = 1;
            arr[si] = ci;
        }
    }
    if(n == 1 and flag){
        cout  << arr[0] ;
    }
    else if(flag and arr[0] != 0){
        for(i = 0 ; i < n ; i++){
            cout << arr[i];
        }
    }
    else{
        cout << -1 ;
    }
    return 0;
}

Measured memory_bytes: 256
# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <bitset>
# include <complex>
# include <numeric>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
constexpr long long MOD = 1000000000 + 7;
constexpr int INF = 2000000000;
constexpr int HINF = INF / 2;
constexpr double DINF = 100000000000000000.0;
constexpr long long LINF = 9223372036854775807;
constexpr long long HLINF = 4500000000000000000;
const double PI = acos(-1);

int main() {
	double v;
	while (cin >> v) {
		cout << ceil((4.9*(v / 9.8)*(v / 9.8) + 5) / 5) << endl;
	}
}

Measured memory_bytes: 3232
import java.io.*;
import java.util.*;

public class Main{

  public static void main(String[] args) {
    InputReader in = new InputReader(System.in);
    PrintWriter w = new PrintWriter(System.out);
    long  n=in.nextLong();
    long x= (n)/11;
    x+=x;
    if (n%11>0 && n%11<=6)
      x++;
    else if (n%11>6)
      x=x+2;
    w.println(x);
    w.close();
    }

  static class InputReader {

    private final InputStream stream;
    private final byte[] buf = new byte[8192];
    private int curChar, snumChars;
    private SpaceCharFilter filter;

    public InputReader(InputStream stream) {
      this.stream = stream;
    }

    public int snext() {
      if (snumChars == -1)
      throw new InputMismatchException();
      if (curChar >= snumChars) {
        curChar = 0;
        try {
          snumChars = stream.read(buf);
        } catch (IOException e) {
          throw new InputMismatchException();
        }
        if (snumChars <= 0)
        return -1;
      }
      return buf[curChar++];
    }

    public int nextInt() {
      int c = snext();
      while (isSpaceChar(c)) {
        c = snext();
      }
      int sgn = 1;
      if (c == '-') {
        sgn = -1;
        c = snext();
      }
      int res = 0;
      do {
        if (c < '0' || c > '9')
        throw new InputMismatchException();
        res *= 10;
        res += c - '0';
        c = snext();
      } while (!isSpaceChar(c));
      return res * sgn;
    }

    public long nextLong() {
      int c = snext();
      while (isSpaceChar(c)) {
        c = snext();
      }
      int sgn = 1;
      if (c == '-') {
        sgn = -1;
        c = snext();
      }
      long res = 0;
      do {
        if (c < '0' || c > '9')
        throw new InputMismatchException();
        res *= 10;
        res += c - '0';
        c = snext();
      } while (!isSpaceChar(c));
      return res * sgn;
    }

    public int[] nextIntArray(int n) {
      int a[] = new int[n];
      for (int i = 0; i < n; i++) {
        a[i] = nextInt();
      }
      return a;
    }

    public String readString() {
      int c = snext();
      while (isSpaceChar(c)) {
        c = snext();
      }
      StringBuilder res = new StringBuilder();
      do {
        res.appendCodePoint(c);
        c = snext();
      } while (!isSpaceChar(c));
      return res.toString();
    }

    public String nextLine() {
      int c = snext();
      while (isSpaceChar(c))
      c = snext();
      StringBuilder res = new StringBuilder();
      do {
        res.appendCodePoint(c);
        c = snext();
      } while (!isEndOfLine(c));
      return res.toString();
    }

    public boolean isSpaceChar(int c) {
      if (filter != null)
      return filter.isSpaceChar(c);
      return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
    }

    private boolean isEndOfLine(int c) {
      return c == '\n' || c == '\r' || c == -1;
    }

    public interface SpaceCharFilter {
      public boolean isSpaceChar(int ch);
    }
  }
}


Measured memory_bytes: 22996
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#define INF 1000000000;
#define dis first
#define mati second.first
#define sta  second.second
using namespace std;
typedef pair <int ,pair <int,int> > P;
vector <P> mp[102];
int c,n,m,start,goal;

int bit_count(int a) {
  a = (a & 0x55555555)+((a & 0xAAAAAAAA) >> 1 );
  a = (a & 0x33333333)+((a & 0xCCCCCCCC) >> 2 );
  a = (a & 0x0F0F0F0F)+((a & 0xF0F0F0F0) >> 4 );
  a = (a & 0x00FF00FF)+((a & 0xFF00FF00) >> 8 );
  a = (a & 0x0000FFFF)+((a & 0xFFFF0000) >> 16);
  return a;
}
int dijkstra() {
  int flg[12][102] = {},dis[12][102];
  for(int j=0;j<=c;j++)
    for(int i=0;i<=n;i++) dis[j][i] = -INF;

  for(int j=1;j<=c;j++)flg[j][start] = 1;

  priority_queue <P> Q;
  P t;
  t.dis = 0, t.mati = start, t.sta = 0;
  Q.push(t);

  while(!Q.empty()) {
    t = Q.top(),Q.pop();
    if(flg[t.sta][t.mati] == 1) continue;
    flg[t.sta][t.mati] = 1;
    for(int i=0;i<mp[t.mati].size();i++){
      int ndis = mp[t.mati][i].dis;
      int nmati = mp[t.mati][i].mati;
      int nsta = t.sta+1;
      P tt;
      if(dis[t.sta][nmati] < t.dis-ndis && flg[t.sta][nmati] == 0) {
	tt.dis = t.dis-ndis,tt.mati = nmati,tt.sta = t.sta;
	dis[t.sta][nmati] = t.dis-ndis;
	Q.push(tt);
      }
      if(nsta<= c&&dis[nsta][nmati]<t.dis-ndis/2 && flg[nsta][nmati]==0){
	tt.dis = t.dis - ndis/2 , tt.mati = nmati, tt.sta = nsta;
	dis[nsta][nmati] = t.dis-ndis/2;
	Q.push(tt);
      }
    }
  }

  int ans = -INF;
  for(int j=0;j<=c;j++)ans = max(ans,dis[j][goal]);
   
  return -ans;
}


int main() {

  while(1) {
    cin >> c >> n >> m >> start >> goal;
    if(c==0&&n==0&&m==0&&start==0&&goal==0) break;

    for(int i=0;i<=n;i++) mp[i].clear();
    for(int i=0;i<m;i++) {
      int a,b,f;
      cin >> a >> b >> f;
      P t;
      t.dis = f,  t.mati = b , t.sta = 0;
      mp[a].push_back(t);
      t.mati = a;
      mp[b].push_back(t);
    }

    cout << dijkstra() << endl;
  }

  return 0;
}

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

#define all(s) s.begin(), s.end()
#define vi vector<int>
#define pb push_back
#define ii pair<int, int>
#define x first
#define y second

int main() {
    ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    int n;
    cin >> n;
    bool flag = 1;
    for (int i = 1; i <= n; i++) {
        int u;
        cin >> u;
        if (u % 2 == 0) {
            if (u % 3 && u % 5) flag = 0;
        }
    }
    cout << (flag ? "APPROVED" : "DENIED");
    return 0;
}

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

int main() {
	int n,l=0,r=0;
	string s,ans;
	cin >> n >> s;
	ans=s;
	while (s.find("()")<n){
		s=s.substr(0,s.find("()"))+s.substr(s.find("()")+2,s.length()-1);
	}
	
	for (int i=0;i<s.length();i++){
		if ((s[i]==')')&&(s[i-1]!='(')){
			ans='('+ans;
		}else if ((s[i]=='(')&&(s[i+1]!=')')){
			ans=ans+')';
		}
	}
	cout << ans;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>

using namespace std;

typedef long long ll;

const ll N_MAX = 1e+12;

ll calc_pow(ll n, int p){
    ll ans = 1;
    for(int i = 0; i < p; i++){
        if(log10(ans) + log10(n) >= 12) return -1;
        ans *= n;
    }
    return ans;
}

int main(){
    ll N, A;
    cin >> N >> A;
    ll ans = 10e+15;
    if(N == 1){
        cout << 1 << endl;
        return 0;
    }
    for(int i = 1; i <= 40; i++){
        ll l = 1;
        ll r = N;
        while(r-l > 1){
            //cout << l << ' ' << r << endl;
            ll c = (l+r)/2;
            if(calc_pow(c, i) >= N || calc_pow(c, i) == -1) r = c;
            else l = c;
        }
        ll n = calc_pow(r-1, i);
        ll tmp = A*(i-1)+(r-1)*i;
        for(int j = 0; j < i; j++){
            n /= (r-1);
            n *= r;
            tmp++;
            if(n >= N) break;
        }
        ans = min(ans, tmp);
        //cout << r << ' ' << ans << endl;
    }
    cout << ans << endl;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define fr(i,n) for(int i=0;i<n;i++)
#define pb push_back
typedef long long ll;
typedef long double la;
using namespace std;

int main(){
    string s;
    int count_a=0;
    int count_b=0;
    cin >> s;
    fr(i,s.size()){
        if(s[i] == 'A'){
            count_a++;
        }
        if(s[i] == 'B'){
            count_b++;
        }
    }
    if(count_a == 3 || count_b == 3){
        cout << "No" << endl;
    }else{
        cout << "Yes" << endl;
    }
}

Measured memory_bytes: 256
#include<stdio.h>

int main(void)
{
    char a;
    scanf("%c",&a);
    if(a=='A'){
        puts("T");
    }else if(a=='T'){
        puts("A");
    }else if(a=='C'){
        puts("G");
    }else if(a=='G'){
        puts("C");
    }
    return 0;
}

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

namespace abc153
{
    class Program
    {
        static void Main(string[] args)
        {
            var h = Console.ReadLine().Split().Select(s => int.Parse(s)).ToArray();
            var a = Console.ReadLine().Split().Select(s => int.Parse(s)).ToArray();
            var ans = a.Sum() >= h[0] ? "Yes" : "No";
            Console.WriteLine(ans);
        }
    }
}


Measured memory_bytes: 20064
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

int main() {
  int n, m;
  cin >> n >> m;
  priority_queue<double> q;
  for (int i = 0; i < n; i++) {
    int e;
    cin >> e;
    q.push(e);
  }
  for (int i = 0; i < m; i++) {
    auto e = q.top();
    q.pop();
    q.push(e / 2);
  }
  ll r = 0;
  while (!q.empty()) {
    r += int(q.top());
    q.pop();
  }
  cout << r << endl;
}


Measured memory_bytes: 1400