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

using namespace std;
using ll = long long;

template <typename K,typename V>
using umap = unordered_map<K,V>;
template <typename V>
using uset = unordered_set<V>;
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 REP(i,n) for(int i=0;i<n;i++)
#define REPD(i,n) for(int i=n-1;i>=0;i--)
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define FORD(i,a,b) for(int i=a;i>=b;i--)
#define ALL(v) v.begin(),v.end()

#define INF 1'000'000'000'000 //10^12
#define MOD 1'000'000'007

int main(){

    ll x;

    cin >> x;

    ll count = x/11;

    ll remain = x - x/11 * 11;

    if(remain == 0){
        cout << count*2 << endl;
    }else if(remain <=6){
        cout << count*2 + 1 << endl;
    }else{
        cout << count*2 + 2 << endl;
    }

    return 0;
}


Measured memory_bytes: 3604
D=int(input())
c=list(map(int,(input().split())))
s=[]
t=[]
last=[0]*26
sat=0

for i in range(D):
  s.append(list(map(int,(input().split()))))
  for day in range(26):
    if(last[day]!=0):
      last[day]+=1

  for j in range(26):
    for k in range(26):
      s[i][j]-=c[k]*(1+last[k])

  sat+=max(s[i])+c[s[i].index(max(s[i]))]
  last[s[i].index(max(s[i]))]=1
  ans=s[i].index(max(s[i]))+1

  print(ans)

Measured memory_bytes: 9388
import java.util.Scanner;

class Main {

	public static void main(String[] args) {
		//入力
		Scanner scanner = new Scanner(System.in);
		int N = Integer.parseInt(scanner.next());
		boolean matrics[][] = new boolean[N][N];
		for(int i=0; i<N; i++) {
			for(int j=0; j<N; j++) matrics[i][j] = false;
		}
		for(int i=0; i<N; i++) {
			int index = Integer.parseInt(scanner.next())-1;
			int k = Integer.parseInt(scanner.next());
			for(int j=0; j<k; j++) {
				matrics[index][Integer.parseInt(scanner.next())-1] = true;
			}
		}
		scanner.close();

		//出力
		for(int i=0; i<N; i++) {
			for(int j=0; j<N; j++) {
				String s = matrics[i][j]? "1": "0";
				System.out.print(s);
				if(j==N-1) break;
				System.out.print(" ");
			}
			System.out.println();
		}
	}

}



Measured memory_bytes: 32500
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;

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

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

// Self settings
// clang-format off
#define MAX_N 100000
#define REP(i, N) for (int i = 0; i < (int)(N); ++i)
#define SLN(i,N) (i == N-1 ? "\n" : " ")
ll fact(ll n) { ll res = 1; for(ll i=2;i<=n;++i) res = res * i; return res;}
ll nCr(ll n, ll r) {return (fact(n)/fact(n-r)*fact(r)) ;}
ll gcd(ll a,ll b){if(b==0)return a;return gcd(b,a%b);}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
const ll MOD = 1e9+7;
const ll INF = 1LL << 60;
const int inf = 1000100011;
// clang-format on

int main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  map<int, int> mp;
  int n;
  REP(i, 3) {
    cin >> n;
    mp[n]++;
  }

  for (auto m : mp) {
    if (m.second == 2) {
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cstring>
#include <string>
#include <cmath>
#define ll long long
#define si scanf("%d",&n)
#define sl scanf("%lld",&n)
#define pi printf("%d",n)
#define pl printf("%d",n)
using namespace std;

int main(){
  int b;
  cin >> b;
  string blue[b];
  for(int i=0;i<b;i++){
    cin >> blue[i];
  }
  int r;
  cin >> r;
  string red[r];
  for(int i=0;i<r;i++){
    cin >> red[i];
  }
  int max = -1;
  for(int i=0;i<b;i++){
    int temp = 0;
    string s = blue[i];
    for(int j=0;j<b;j++){
      if(blue[j]==s)
        temp++;
    }
    for(int k=0;k<r;k++){
      if(red[k]==s)
        temp--;
    }
    if(temp>=max)
      max=temp;
  }
  if(max<=0)
    cout << "0" << endl;
  else
    cout << max << endl;
}


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

int a[10000];
int ans[100][100];

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

	int H, W, N;
	cin >> H >> W >> N;
	for(int i = 0; i < N; i++) {
		cin >> a[i];
	}

	int c = 0;
	for(int i = 0; i < H; i++) {
		if(i % 2 == 0) {
			for(int j = 0; j < W; j++) {
				ans[i][j] = c + 1;
				a[c]--;
				if(a[c] == 0) c++;
			}
		}
		else {
			for(int j = W - 1; j >= 0; j--) {
				ans[i][j] = c + 1;
				a[c]--;
				if(a[c] == 0) c++;
			}
		}
	}

	for(int i = 0; i < H; i++) {
		for(int j = 0; j < W; j++) {
			cout << ans[i][j] << " ";
		}
		cout << endl;
	}
}


Measured memory_bytes: 384
//C
//#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>


#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdalign>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>

//Hang in there!

using namespace std;


int main() {
	int H, W, h, w;
	cin >> H >> W >> h >> w;
	cout << (H - h) * (W - w) << endl;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define fst first
#define snd second
using namespace std;

typedef long long ll;
typedef double db;
typedef long double ldb;

template<class T> inline void checkmin(T &a,const T &b){if(b<a) a=b;}
template<class T> inline void checkmax(T &a,const T &b){if(b>a) a=b;}

const int inf=1e9+10;
const int maxn=1e5+10;

int cnt[maxn],n,q;
ll ans=0;

int main(){
	cin>>n;
	for(int i=0;i<n;i++){
		int x;
		cin>>x;
		cnt[x]++;
	}
	for(int i=0;i<maxn;i++) ans+=ll(ll(cnt[i])*ll(i));
	cin>>q;
	for(int i=0;i<q;i++){
		int a,b;
		cin>>a>>b;
		ans-=ll(ll(cnt[a])*ll(a));
		ans+=ll(ll(cnt[a])*ll(b));
		cnt[b]+=cnt[a];
		cnt[a]=0;
		cout<<ans<<endl;
	}
	return 0;
}


Measured memory_bytes: 3972
A, B, H, M = map(int, input().split())
import math

if M == 0:
    m = 360
else:
    m = 6 * M

h = 30 * H + 0.5 * M

#print(H * 60 * 0.5, m)
c = abs(h - m)
#print(c)
cos = math.cos(math.radians(c))
#print(cos)
C = (A ** 2 + B ** 2 - 2*A*B*cos) ** 0.5

print(C)

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

int main(){
	int N;
  	cin >> N;
  
  	vector<int> W(N);
  	for(int n=0; n<N; n++) cin >> W[n];
  
  	int S1, S2, temp, ans=100000;
  	for(int n=1; n<N; n++){
      	S1 = 0; S2 = 0;
    	for(int n1=0; n1<n; n1++) S1 += W[n1];
      	for(int n2=n; n2<N; n2++) S2 += W[n2];
      	temp = abs(S1 - S2);
      	// cout << S1 << " " << S2 << " " << temp << endl;
      	if(temp < ans) ans = temp;
    } 
  	
	cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#define DEB(x) 
using namespace std;

int n;
int taro[201],hanako[201];
int tarocnt,hanakocnt;

int main(){
	int i,x;
	while(cin >> n){
		if(!n)break;
		for( i = 0; i < 201; i++ ){
			taro[i] = 0;
			hanako[i] = 0;
		}
		tarocnt = 0;
		hanakocnt = 0;

		for( i = 0; i < n; i++ ){
			cin >> x;
			taro[x] = 1;
			tarocnt++;
		}
		for( i = 1; i < 2*n+1; i++ ){
			if( !taro[i] ){
				hanako[i] = 1;
				hanakocnt++;
			}
		}
		
		int ba = 0;
		int ban = 0;
		while( 1 ){
			DEB(
				for( i = 0; i < 2*n+1; i++ ){
					if( taro[i] != 0 ){
						cout << i << " ";
					}
				}
				cout << endl;
				for( i = 0; i < 2*n+1; i++ ){
					if( hanako[i] != 0 ){
						cout << i << " ";
					}
				}
				cout << endl << endl;
			);

			if( !ban ){
				for( i = ba; taro[i] == 0 && i < 2*n+1; i++ );
				if( i == 2*n+1 ){
					ba = 0;
				}
				else{
					tarocnt--;
					taro[i] = 0;
					ba = i;
				}
			}
					
			else{
				for( i = ba; hanako[i] == 0 && i < 2*n+1; i++ );
				if( i == 2*n+1 ){
					ba = 0;
				}
				else{
					hanakocnt--;
					hanako[i] = 0;
					ba = i;
				}
			}
			ban++;
			if(ban==2)ban-=2;
			if( tarocnt == 0 || hanakocnt == 0 )
				break;
		}
		cout << hanakocnt << endl << tarocnt << endl;
	}
	return 0;
}
			

Measured memory_bytes: 1160
N, M = list(map(int, input().split(' ')))
left_list = list()
right_list = list()
for _ in range(M):
    a, b = list(map(int, input().split(' ')))
    left_list.append(a)
    right_list.append(b)
sorted_blocking_section_list = sorted(range(M), key=lambda i: right_list[i])
blocking_bridge = None
blocking_bridge_cnt = 0
for section in sorted_blocking_section_list:
    left_bridge = left_list[section]
    right_bridge = right_list[section] - 1
    if blocking_bridge is None or blocking_bridge < left_bridge:
        blocking_bridge = right_bridge
        blocking_bridge_cnt += 1
print(blocking_bridge_cnt)

Measured memory_bytes: 16672
//include
//------------------------------------------
#include <bits/stdc++.h>
using namespace std;
//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}
//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> P;
typedef long long ll;
//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const long long INF = 1000000007;
//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))
//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
// chmax chmin
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

int main(void){
    int n; cin >> n;
    int a[n]; REP(i,n) cin >> a[i];
    vector<int> b_id;
    for(int i=n; i>0; i-=2){
        b_id.push_back(i-1);
    }
    int init;
    if(n%2) init=2;
    else init=1;
    for(int i=init; i<=n; i+=2){
        b_id.push_back(i-1);
    }

    for(int i : b_id){
        cout << a[i] << " ";
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 3828
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, a, b) for (int i = a; i < b; i++)
using namespace std;

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <tuple>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <stack>
#include <bitset>

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

	int d4 = N / 1000;
	int d3 = N / 100 % 10;
	int d2 = N / 10 % 10;
	int d1 = N % 10;

	if ((d4 == d3 && d3 == d2) || (d3 == d2 && d2 == d1)) {
		cout << "Yes" << endl;	
	}
	else {
		cout << "No" << endl;
	}
}

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

class Procon
{
  public Procon() {}
  static void Main(string[] agrs)
  {
    new Procon().Do();
  }

  Scanner cin;

  public void Do()
  {
    cin = new Scanner();
    int a = cin.nextInt();
    int b = cin.nextInt();
    int c = cin.nextInt();
    int d = cin.nextInt();

    int max = Math.Min(b, d);
    int min = Math.Max(a, c);

    if (max-min > 0) {
      Console.WriteLine(max-min);
    } else {
      Console.WriteLine(0);
    }
    return;
  }
}


class Scanner
{
  string[] s;
  int i;
  int max_i;

  public Scanner()
  {
    s = new string[0];
    max_i = 0;
    i = 0;
  }

  public string nextString()
  {
    if (i >= s.Length) 
    {
      s = Console.ReadLine().Split(' ');
      max_i = s.Length;
      i = 0;
      if (max_i == 0) 
      {
        return "";
      }
      return s[i++];
    } else 
    {
      return s[i++];
    }
  }

  public int nextInt()
  {
    return int.Parse(nextString());
  }


  public long nextLong()
  {
    return long.Parse(nextString());
  }

  public double nextDouble()
  {
    return double.Parse(nextString());
  }

  public string[] arrayString()
  {
    return Console.ReadLine().Split(' ');
  }

  public int[] arrayInt()
  {
    string[] str = Console.ReadLine().Split(' ');
    int[] array = new int[str.Length];
    for (int i=0; i<str.Length; i++) 
    {
      array[i] = int.Parse(str[i]);
    }
    return array;
  }

  public long[] arrayLong()
  {
    string[] str = Console.ReadLine().Split(' ');
    long[] array = new long[str.Length];
    for (int i=0; i<str.Length; i++) 
    {
      array[i] = long.Parse(str[i]);
    }
    return array;
  }

  public double[] arrayDouble()
  {
    string[] str = Console.ReadLine().Split(' ');
    double[] array = new double[str.Length];
    for (int i=0; i<str.Length; i++) 
    {
      array[i] = double.Parse(str[i]);
    }
    return array;
  }
}


Measured memory_bytes: 11092
// C++ 14
#include <iostream>
#include <vector>
#include <list>
#include <algorithm>
#include <queue>
#include <stack>
#include <math.h>

#define ll long long
#define Int int
#define loop(x, start, end) for(Int x = start; x < end; x++)
#define loopdown(x, start, end) for(int x = start; x > end; x--)
#define span(a,x,y) a.begin()+x,a.begin()+y
#define span_all(a) a.begin(),a.end()
#define len(x) (x.size())
#define last(x) (*(x.end()-1))

using namespace std;

Int A, B;

Int solve() {
  return max(0, A - (B * 2));
}

int main() {
  cin >> A >> B;
  cout << solve() << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define llu unsigned long long
#define ld double
#define llu unsigned long long
#define rep(i,x,y)  for(int i=x;i<y;++i)
#define For(i,x,y)  for(int i=x;i<=y;++i)
#define FOr(i,x,y)  for(int i=x;i>=y;--i)
#define pi acos(-1)
#define mk make_pair<ll,ll>
#define pa pair<ll,ll>
#define lf else if
#define max(x,y)    ((x)<(y)?(y):(x))
#define min(x,y)    ((x)<(y)?(x):(y))
#define sqr(x)      ((x)*(x))
#define abs(x)      ((x)>0?(x):-(x))
#define Mul(x,y)    (x=1LL*(x)*(y)%mod)
#define Add(x,y)    (x=(x+(y))%mod)
#define Max(x,y)    ((x)=((x)<(y)?(y):(x)))
#define Min(x,y)    ((x)=((x)>(y)?(y):(x)))
#define E(x)        return writeln(x),0
#define p(x)        printf("~%lld~\n",x)
#define pp(x,y)     printf("~~%lld %lld~~\n",x,y)
#define ppp(x,y,z)  printf("~~~%lld %lld %lld~~~\n",x,y,z)
#define pppp(a,b,c,d)	printf("~~~%d %d %d %d\n",a,b,c,d)
#define f_in(x)     freopen(x".in","r",stdin)
#define f_out(x)    freopen(x".out","w",stdout)
#define open(x)     f_in(x),f_out(x)
#define fi first
#define se second
typedef complex<double> E;
namespace SHENZHEBEI{
#ifdef LOCAL
    struct _{_(){freopen("cf.in","r",stdin);}}_;
#endif
#define NEG 1
    inline char gc(){   return getchar();   }
#if NEG
    inline ll read(){    ll x=0,f=1; char ch=gc();   for (;!isdigit(ch);ch=gc()) if (ch=='-') f=-1;  for (;isdigit(ch);ch=gc())  x=x*10-48+ch;   return x*f; }
    inline void write(ll x){    if (x<0) putchar('-'),x=-x;  if (x>=10)   write(x/10);    putchar(x%10+'0');  }
#else
    inline ll read(){    ll x=0; char ch=gc();   for (;!isdigit(ch);ch=gc());    for (;isdigit(ch);ch=gc())  x=x*10-48+ch;   return x;   }
    inline void write(ll x){    if (x>=10)   write(x/10);    putchar(x%10+'0');  }
#endif
    inline char readchar(){ char ch=gc();   for(;isspace(ch);ch=gc());  return ch;  }
    inline ll readstr(char *s){ char ch=gc();   int cur=0;  for(;isspace(ch);ch=gc());      for(;!isspace(ch);ch=gc())  s[cur++]=ch;    s[cur]='\0';    return cur; }
    inline void writeln(ll x){  write(x);   puts("");   }        
    inline ld getreal(){    static ld lbc;  scanf("%lf",&lbc);  return lbc; }
}using namespace SHENZHEBEI;
ll n,k,ans;
int main(){
	n=read(),k=read();
	For(b,1,n){
		For(divide,0,n){
			ll down=max(1ll,divide*b+k),up=(divide+1)*b-1;
			if (down>n)break;
			Min(up,n);
			if (down<=up)
				ans+=up-down+1;
		}
	}
	write(ans);
}

Measured memory_bytes: 256
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


class BinaryIndexTree:
    def __init__(self, n):
        self.size = n
        self._container = [0] * (n + 1)
        self.depth = n.bit_length()

    def sum(self, i):
        if i == 0:
            return 0
        s = 0
        while i > 0:
            s += self._container[i]
            i -= i & (-i)
        return s

    def add(self, i, x):
        if i == 0:
            return
        while i <= self.size:
            self._container[i] += x
            i += i & (-i)

    def lower_bound(self, x):
        if x == 0:
            return 0

        s = 0
        idx = 0
        for i in range(self.depth, -1, -1):
            k = idx + (1 << i)
            if k <= self.size and s + self._container[k] < x:
                s += self._container[k]
                idx += 1 << i
        return idx + 1

    def __repr__(self):
        return str(self._container)


def main():
    n = int(readline())
    a = list(map(int, readline().split()))
    idx = dict()
    for i, x in enumerate(a, 1):
        idx[x] = i

    bt = BinaryIndexTree(n + 1)
    bt.add(n + 1, 1)
    ans = 0
    for num in range(1, n + 1):
        i = idx[num]
        s = bt.sum(i)
        left = bt.lower_bound(s)
        right = bt.lower_bound(s + 1)
        ans += num * (i - left) * (right - i)
        bt.add(i, 1)

    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 116032
#include <iostream>
#include <algorithm>
#include <functional>
#include <string>
#include <vector>
#include <utility>
#include <climits>
#include <iomanip>
using namespace std;
#define MAXSIZE 100005
#define MAXL 100
#define MOD_CONST 1000000007
typedef long long int lli;

lli comb(lli n, lli r, vector<vector<lli>> &v);

void rewrite_vec(lli n, lli r, vector<vector<lli>> &v, lli after);

int main(){
    lli n, k;
    cin >> n >> k;

    vector<lli> row(n + 1, -1);
    vector<vector<lli>> v(n + 1, row);
    const int num_red = n - k;
    const int num_of_gap = num_red + 1;

    for(int i = 1; i <= k; ++i){
        lli out = (comb(num_of_gap, i, v) % MOD_CONST) * (comb(k - 1, i - 1, v) % MOD_CONST) % MOD_CONST;
        cout << out << endl;
    }

    return 0;
}

lli comb(lli n, lli r, vector<vector<lli>> &v){
    if(n < 0 || r < 0 || n < r){
        return 0;
    }

    if(n == r || r == 0){
        rewrite_vec(n, r, v, 1);
        return 1;
    }else if(r == n - 1 || r == 1){
        rewrite_vec(n, r, v, n);
        return n;
    }else if(v[n][r] >= 0){
        return v[n][r];
    }else{
        lli res = comb(n - 1, r - 1, v) % MOD_CONST + comb(n - 1, r, v) % MOD_CONST;
        rewrite_vec(n, r, v, res);
        return res;
    }
}

void rewrite_vec(lli n, lli r, vector<vector<lli>> &v, lli after){
    if(v[n][r] < 0){
        v[n][r] = after;
    }
}

Measured memory_bytes: 31872
from math import ceil
import sys
def 解():
    iN = int(sys.stdin.readline())
    aData = [[int(_) for _ in sLine.split()] for sLine in sys.stdin.readlines()]
    #def fCeil(a):
    #   return int(-1* ( int(-1*a)))

    for i in range(iN-1):
        Tjb = aData[i][0] + aData[i][1]
        for j in range(i+1,iN-1):
            Cj = aData[j][0]
            Sj = aData[j][1]
            Fj = aData[j][2]
        #   Tjb = max( fCeil(Tjb/Fj),Sj//Fj)*Fj+Cj
            Tjb = max( ceil(Tjb/Fj),Sj//Fj)*Fj+Cj
        print(Tjb)
    print(0)
解()


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

using namespace std;

int main()
{
  int n,k;
  cin>>n>>k;
  int arr[n],count[n];
  for(int i=0;i<n;i++)
  {
    cin>>arr[i];
    count[i] = INT_MAX;
  }
  if(n==1)
    cout<<0<<endl;
  else
  {
    count[0] = 0;
   for(int i=1;i<n;i++)
   {
        for(int j=max(0,i-k);j<i;j++)
        {
            count[i] = min(count[i],count[j]+abs(arr[i]-arr[j]));
        }
    }
  	cout<<count[n-1]<<endl; 
	}
return 0;
}

Measured memory_bytes: 1024
#include<string>
#include<iostream>

using namespace std;
int main(){
    string a;
    bool b = false;
    cin >> a;
    for (int i=0; i<3; i++){
        if(a[i] == '7') b = true;
    }
    if (b) cout << "Yes" << endl;
    else cout  << "No" << endl;
    return 0;
}

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

using namespace std;

int main()
{
    int n;  string s;
    cin >> n >> s;
    int Ans = 0;
    for(int i = 0;i<s.size() - 2;i++)
        if(s[i] == 'A' && s[i + 1] == 'B' && s[i + 2] == 'C') Ans++;
    cout << Ans;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main() {
	int n;
  	cin >> n;
  	int x, y;
  	vector<int> v;
  	for (int i=1; i<=n; ++i) {
    	cin >> x >> y;
      	v.push_back(x-y);
    }
    if (v.end() != search_n(v.begin(), v.end(), 3, 0)) {
    	cout << "Yes";
    }	else {
    	cout << "No";
    }
  	return 0;
}

Measured memory_bytes: 3584
#include <stdio.h>

int main(void)
{
    int A,B,max;

    scanf("%d %d",&A, &B);

    max = A+B;

    if(max < A-B){
        max = A-B;
    } 

    if(max < A*B){
        max = A*B;
    }

    printf("%d\n",max);

    return 0;
}

Measured memory_bytes: 128
N = int(input())
A = [int(a) for a in input().split()]

A.sort()
flag = True
for a in A:
    if a > A[0]+1:
        flag = False

ans = "No"
if flag:
    cnt = A.count(A[0])
    if cnt == N and (A[0] == N-1 or A[0]*2 <= N):
        ans = "Yes"
    elif cnt == A[0] and cnt < N-1:
        ans = "Yes"
    elif cnt < A[0] and N-cnt >= 2*(A[0]-cnt+1):
        ans = "Yes"
        
print(ans)

Measured memory_bytes: 13964
#include <stdio.h>
int main(void)
{

	long long int a, b, r, x, cnt,cnt2,bai, one, two,c,d,tmp;
	
	scanf("%lld%lld%lld%lld", &one, &two, &b, &a);
	c = b;
	d = a;
	x = a * b;
	r = a % b;
	while (r != 0) {
		a = b;
		b = r;
		r = a % b;
	}
	one = one - 1;
	bai = x / b;
	cnt = one / bai ;
	cnt2 = two / bai ;
	tmp=((two / c + two / d) - cnt2) - ((one / c + one / d) - cnt);
	printf("%lld", (two-one)-tmp);
	return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <iterator>
#include <string>
#include <map>
using namespace std;

int main() {
	string st;
	cin >> st;
	int n;
	n=st.length();
	if(st[n-1]=='s'){
		st.insert(n,"es");
	}
	else{
		st.insert(n,"s");
	}
	cout << st;
	return 0;
}

Measured memory_bytes: 3628
#include <cstdio>
#include <cstring>

int main()
{
    int n, m;
    scanf("%d %d", &n, &m);

    int check[100000];
    for (int i = 0; i < 100000; i++)
    {
        check[i] = 0;
    }

    int ans = 0;
    int pen = 0;

    for (int i = 0; i < m; i++)
    {
        int p;
        char s[3];
        scanf("%d %s", &p, s);
        if (check[p - 1] != 1000000)
        {
            if (strcmp(s, "AC") == 0)
            {
                pen += check[p - 1];
                check[p - 1] = 1000000;
                ans++;
            }
            else
            {
                check[p - 1] += 1;
            }
        }
    }

    printf("%d %d\n", ans, pen);

    return 0;
}


Measured memory_bytes: 512
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <string>

using namespace std;

int main() {
	
    string s;
    cin >> s;

    int topping = 0;
    for (int i = 0; i < 3; i++) {
        if (s[i] == 'o') {
            topping++;
        }
    }
    cout << 700 + topping * 100 << endl;

    return 0;
}

Measured memory_bytes: 256
from collections import defaultdict
n,ww = map(int,raw_input().split())
dic = defaultdict(list)
m = 10**20
for i in range(n):
    w,v = map(int,raw_input().split())
    m = min(w,m)
    dic[w].append(v)
mxv = 0
for i in dic:
    dic[i].sort(reverse = True)
for w in range(len(dic[m+3])+1):
    for i in range(len(dic[m+2])+1):
        for j in range(len(dic[m+1])+1):
            for k in range(len(dic[m])+1):
                tw = w*(m+3)+i*(m+2)+j*(m+1)+k*(m)
                if tw > ww:
                    continue
                else:
                    val = sum(dic[m+3][:w])+sum(dic[m+2][:i])+sum(dic[m+1][:j])+sum(dic[m][:k])
                    mxv = max(mxv,val)
print mxv

Measured memory_bytes: 34028
#include <bits/stdc++.h>
using namespace std;
int LOG = 20;
int main(){
  string S;
  cin >> S;
  int N = S.size();
  vector<vector<int>> d(N, vector<int>(LOG));
  for (int i = 0; i < N; i++){
    if (S[i] == 'L'){
      d[i][0] = i - 1;
    } else {
      d[i][0] = i + 1;
    }
  }
  for (int i = 1; i < LOG; i++){
    for (int j = 0; j < N; j++){
      d[j][i] = d[d[j][i - 1]][i - 1];
    }
  }
  vector<int> ans(N, 0);
  for (int i = 0; i < N; i++){
    ans[d[i][LOG - 1]]++;
  }
  for (int i = 0; i < N; i++){
    cout << ans[i];
    if (i < N - 1){
      cout << ' ';
    }
  }
  cout << endl;
}

Measured memory_bytes: 12672
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <math.h>
#include <cmath>
#include <limits.h>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <functional>
#include <stdio.h>
using namespace std;

long long MOD = 1000000007;

int main() {
    
    string S;
    cin >> S;
    
    bool ans = ( S[0] == S[1] && S[1] == S[2] ) || ( S[1] == S[2] && S[2] == S[3] );
    cout << (  ans ? "Yes" : "No" ) << endl;
    
    
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <map>
#include <sstream>
#include <queue>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <iterator>
#include <stack>
#include <list>
using namespace std;
typedef long long int lli;
typedef pair<int,int> P;
#define F first
#define S second
const int INF=1000000000;

int main(){
	int n;
	while(cin>>n&&n){
		int a,b;
		a=b=0;
		for(int i=0; i<n; ++i){
			int t1,t2;
			cin >> t1 >> t2;
			if(t1>t2) a+=t1+t2;
			else if(t1<t2) b+=t1+t2;
			else{
				a+=t1;
				b+=t2;
			}
		}
		cout << a << " " << b << endl;
	}
	return 0;
}

Measured memory_bytes: 1160
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long N = sc.nextLong();

		sc.close();
		long count = 0;

		label: for (int a = 1; a < N; a++) {
			for (int b = 1; b < N; b++) {
				if (a * b < N) {
					count++;
				} else {
					continue label;
				}

			}
		}

		System.out.print(count);
	}

}

Measured memory_bytes: 35668
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()

int main() {
  string s; cin >> s;
  LL n = s.size();
  vector<LL> a;
  for (int i = 1; i < n; i ++) {
    if (s[i - 1] == 'R' && s[i] == 'L') {
      a.push_back(i - 1);
    }
  }

  int x, d;
  vector<LL> ans(n, 0);
  for (int i = 0; i < n; i ++) {
    if (s[i] == 'R') {
      x = lower_bound(a.begin(), a.end(), i) - a.begin();
      d = a[x];
      if ((d - i) % 2 == 0) ans[d] ++;
      else ans[d + 1] ++;
    } else if (s[i] == 'L') {
      x = lower_bound(a.begin(), a.end(), i) - a.begin() - 1;
      if (x < 0) x = 0;
      d = a[x];
      if ((i - d + 1) % 2 == 0) ans[d + 1] ++;
      else ans[d] ++;
    }
  }

  for (int i = 0; i < n; i ++) {
    if (i) cout << " ";
    cout << ans[i];
  }
}

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

int main() {
  long A, B, C, K;
  cin >> A >> B >> C >> K;
  if (A >= K) return cout << K << "\n", 0;
  if (A + B >= K) return cout << A << "\n", 0;
  cout << A + (K - A - B) * -1 << "\n";
}

Measured memory_bytes: 3672
#include<stdio.h>
#include<string.h>

int main(){
	char S[5];

	scanf("%s",S);
	if(strncmp(&S[0],&S[1],1)==0){
		printf("Bad");
	}else if(strncmp(&S[1],&S[2],1)==0){
		printf("Bad");
	}else if(strncmp(&S[2],&S[3],1)==0){
		printf("Bad");
	}else{
		printf("Good");
	}

	return 0;

}

Measured memory_bytes: 128
#define rep(i, a, b) for (int i = a; i < b; ++i)
#define repr(i,a,b) for (int i = a; i > b; --i)
#define mm(lamb, tttt) memset(lamb, tttt, sizeof lamb)
 
#define null NULL
#define eps 0.000000001
#define mod 1000000007
#define PI 3.14159265358979323846
#define pb push_back
#define pf push_front
#define mp make_pair
#define fi first
#define se second
#define ALL(V) V.begin(), V.end()
#define sz(V) (int)V.size()
#define _ <<" "<<
 
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long int ll;
typedef vector <int> vi;
typedef vector<vi> vvi;
typedef pair <int, int> ii;
typedef pair<int, pair<int,int> > iii;
typedef vector<ii> vii;

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
 	
 
	//freopen ("test.txt","r",stdin);
	int a,b;
	cin>>a>>b;
	cout<<max(a+b , max(a-b , a*b));
	
} 

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main(){
    char s,d;
    cin >> s >> d;
    if(s == 'H' && d == 'D'){
        cout << "D" << endl;
    }
    else if(s == 'D' && d == 'H'){
        cout << "D" << endl;
    }
    else cout << "H" << endl;

}

Measured memory_bytes: 3600
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define rep(i,n) for(ll i=0;i<(n);i++)
struct UnionFind{
    vector<ll> par;
    UnionFind(ll n) : par(n, -1) { }
    void init(ll n) { par.assign(n, -1); }
    
    ll root(ll x) {
        if (par[x] < 0) return x;
        else return par[x] = root(par[x]);
    }
    
    bool issame(ll x, ll y) {
        return root(x) == root(y);
    }
    
    bool merge(ll x, ll y) {
        x = root(x); y = root(y);
        if (x == y) return false;
        if (par[x] > par[y]) swap(x, y);
        par[x] += par[y];
        par[y] = x;
        return true;
    }
    
    ll size(ll x) {
        return -par[root(x)];
    }
};

int main(){
  ll n,m;cin>>n>>m;
  vector<ll> p(n),x(m),y(m);
  rep(i,n){
    ll tmp;cin>>tmp;tmp--;
    p[tmp]=i;
  }
  rep(i,m) cin>>x[i]>>y[i],x[i]--,y[i]--;
  UnionFind uf(n);
  rep(i,m) uf.merge(x[i],y[i]);
  ll ans=0;
  rep(i,n) if(uf.issame(i,p[i])) ans++;
  cout<<ans<<endl;
}

Measured memory_bytes: 3328
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define inf 10e17
#define rep(i,n) for(long long i=0; i<n; i++)
#define repr(i,n,m) for(long long i=m; i<n; i++)
#define mod 1000000007
#define sorti(x) sort(x.begin(), x.end())
#define sortd(x) sort(x.begin(), x.end(), std::greater<long long>())
#define debug(x) std::cerr << (x) << std::endl;
#define roll(x) for (auto&& itr : x) { cerr << (itr) << " "; }

template <class T> inline void chmax(T &ans, T t) { if (t > ans) ans = t;}
template <class T> inline void chmin(T &ans, T t) { if (t < ans) ans = t;}

#define int long long

signed main() {
  int n, k;
  cin >> n >> k;
  vector<int> a(n);
  repr(i, n, 0) cin >> a[i];

  int ans = numeric_limits<int>::max();
  for (int i = 0; i < (1 << n); ++i) {
    vector<bool> bits(n);
    for (int j = 0; j < n; ++j) {
      bits[j] = (i >> j) & 1;
    }

    auto cnt = count(bits.begin(), bits.end(), 1);
    if (cnt < k) continue;

    int pre_max = 0;
    int temp = 0;
    for (int j = 0; j < n; ++j) {
      // 見えるようにする。
      if (bits[j] && a[j] - pre_max <= 0) {
        temp += pre_max - a[j] + 1;
        pre_max = pre_max + 1;
      } else if (bits[j] && a[j] - pre_max > 0) {
        pre_max = a[j];
      } else if (!bits[j] && a[j] - pre_max > 0) {
        pre_max = a[j];
      }
    }

    chmin(ans, temp);
  }

  cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ii pair<int,int>

int n;
vector<ii> v;
int main(){
	cin>>n;
	
	for (int x=0;x<n;x++){
		v.push_back(ii(-1,x));
		cin>>v.back().first;
	}
	
	sort(v.begin(),v.end());
	
	int ans=0;
	for (int x=0;x<n;x+=2){
		if (v[x].second&1) ans++;
	}
	
	cout<<ans;
}

Measured memory_bytes: 1400
import java.util.*;

class Main {
    public static void main(String[] args) {
        new Solver().run();
    }
}

class Solver {

    private void genPermutation(List<List<Integer>> perm, List<Integer> cand, List<Integer> cur) {
        if (cand.size() == 0) {
            perm.add(cur);
            return;
        } else {
            for (int i = 0; i < cand.size(); i++) {
                List<Integer> nc = new ArrayList<Integer>(cand);
                List<Integer> cc = new ArrayList<Integer>(cur);

                int v = nc.remove(i);
                cc.add(v);
                genPermutation(perm, nc, cc);
            }
        }
    }

    private long calc(long N) {
        if (N == 1) return 1;
        else return N*calc(N - 1);
    }

    public void run() {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] x = new int[N];
        int[] y = new int[N];
        for (int i = 0; i < N; i++) {
            x[i] = sc.nextInt();
            y[i] = sc.nextInt();
        }

        List<Integer> cand = new ArrayList<Integer>();
        for (int i = 1; i <= N; i++) {
            cand.add(i);
        }

        List<List<Integer>> perm = new ArrayList<List<Integer>>();
        genPermutation(perm, cand, new ArrayList<Integer>());

        double sum = 0;
        for (List<Integer> list : perm) {

            for (int i = 0; i < N - 1; i++) {
                int src = list.get(i) - 1;
                int dst = list.get(i + 1) - 1;

                long v1 = x[dst] - x[src];
                long v2 = y[dst] - y[src];

                sum += Math.sqrt(v1 * v1 + v2 * v2);
            }

        }

        long pe = calc(N);

        System.out.println(sum/pe);

        return;
    }

}

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

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
using ll = long long;
string char_to_string(char val) {
    return string(1, val);
}

int main(){
    int H, W; cin >> H >> W;
    vector<string> a(H); REP(i, H) cin >> a[i];

    for(int i = 0; i < H + 2; ++i) {
        if(i == 0 || i == H + 1) {
            for(int k = 0; k < W + 2; ++k) {
                cout << "#";
            }
            cout << endl;
        } else {
            cout << "#" << a[i - 1] << "#" << endl;
        }
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) for(int i = 0; i < (b); i++)
#define all(a) (a).begin(), (a).end()
#define show(x)  cerr << #x << " = " << (x) << endl;
//const int INF = 1e8;
using namespace std;

string toBinary(long long k){
	string res;
	while(k > 0){
		res += '0' + k % 2;
		k /= 2;
	}
	while(res.size() < 30) res += '0';
	reverse(all(res));
	return res;
}

long long ans = 0;
vector<pair<string,long long>> v;
string str;

void dfs(int i, vector<bool> s){

	if(i == 30){
		long long cnt = 0;
		rep(j,v.size()){
			if(s[j]) cnt += v[j].second;
		}
		ans = max(ans, cnt);
		return;
	}

	if(str[i] == '1'){
		long long cnt = 0;
		rep(j,v.size()){ //ここが0のとき
			if(v[j].first[i] == '0' && s[j]){
				cnt += v[j].second;
			}
		}
		ans = max(ans, cnt);
		dfs(i + 1, s);
	}else{
		rep(j,v.size()){
			//show((*it).first[i])
			if(v[j].first[i] == '1'){
				s[j] = false;
			}
		}
		dfs(i + 1, s);
	}
}

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

	long long n, k;
	cin >> n >> k;

	v = vector<pair<string,long long>>(n);
	rep(i,n){
		long long x;
		cin >> x >> v[i].second;
		v[i].first = toBinary(x);
	}
	//sort(all(v));

	str = toBinary(k);
	vector<bool> s(n,1);
	dfs(0, s);
	cout << ans << endl;

}


Measured memory_bytes: 9984
import sys
input=sys.stdin.readline
x,y,z,k=map(int,input().split())
a=[int(i) for i in input().split()]
b=[int(i) for i in input().split()]
c=[int(i) for i in input().split()]
a.sort()
b.sort()
c.sort()
ab=[a[i]+b[j] for j in range(y) for i in range(x)]
ab.sort(reverse=True)
ab=ab[:k]
l=len(ab)
abc=[ab[i]+c[j] for j in range(z) for i in range(l)]
abc.sort(reverse=True)
for i in range(k):
    print(abc[i])


Measured memory_bytes: 160824
import math, string, itertools, fractions, heapq, collections, re,  array, bisect, sys, random, time, copy, functools
sys.setrecursionlimit(10**7)
inf = 10 ** 20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def _I(): return int(sys.stdin.readline())
def _F(): return float(sys.stdin.readline())
def pf(s): return print(s, flush=True)

N,M=LI()
AB=[LI() for i in range(M)]
ans=0
L = list(itertools.permutations(range(2,N+1)))
#print(L)
for l in L:
	for lidx in range(len(l)):
		if lidx == 0:
			if [1,l[lidx]] not in AB:
				break
			continue
		
		if [l[lidx-1],l[lidx]] not in AB and [l[lidx],l[lidx-1]] not in AB:
			break
	else:
		ans+=1
print(ans)
	
		
	
	


Measured memory_bytes: 68200
#include <bits/stdc++.h>
#define ll long long
#define For(i,a,b) for (int i=a;i<=b;i++)
#define fi first
#define se second
#define pb push_back
#define Ford(i,a,b) for (int i=a;i>=b;i--)
#define inf 1000000007
#define maxn 100007
#define task "A"
#define reset(x) memset(x,0,sizeof(x))
#define dscan(x) scanf("%d", &x)
#define lldscan(x) scanf("%lld", &x)
#define cscan(x) scanf("%c", &x)
#define sscan(x) scanf("%s", &x)
using namespace std;

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/

typedef pair<int,int> ii;
int n;
ll h[maxn];

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/

void open() {
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    //freopen(task".inp","r",stdin);
    //freopen(task".out","w",stdout);
}

void read() {
    cin >> n;
    For(i,1,n) cin >> h[i];
}

void solve() {
    bool ans=true;
    For(i,2,n) {
        if (h[i-1]>h[i]) {ans=false; break;}
        if (h[i]>h[i-1]) h[i]--;
    }
    if (ans) cout << "Yes"; else cout << "No";
}

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/

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

Measured memory_bytes: 1024
import java.util.Scanner;

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


Measured memory_bytes: 26384
import java.util.*;class Main{public static void main(String[]z){int i,j,n=1001,r=0;char[]c;int[][]a=new int[n][n];for(Scanner s=new Scanner(System.in);(n=s.nextInt())>0;System.out.println(r),r=0)for(i=0;i++<n;)for(c=s.next().toCharArray(),j=0;j++<n;)r=Math.max(r,a[i][j]=c[j-1]>45?Math.min(a[i-1][j-1],Math.min(a[i-1][j],a[i][j-1]))+1:0);}}

Measured memory_bytes: 16000
#include <iostream>
#include <string>
#include <vector>
#include <climits>
#include <set>
#include <algorithm>
#include <unordered_map>
#include <queue>
#include <iomanip>
#include <map>
#include <utility>
#include <numeric>
#include <chrono>
#include <ctime>
#include <bitset>
#include <iterator>
#include <cmath>
#include <stack>

#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define debug(x) cerr << #x << ": " << x << ", "
#define debugln(x) cerr << #x << ": " << x << '\n'

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

using namespace std;
using ll = long long;
using P = pair<ll, ll>;

constexpr ll mod = 1e9 + 7;
const double PI = acos(-1.0);

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

  int n; cin >> n;
  int ma = 0;
  int ans = 0;
  rep(i, n) {
    int a, b; cin >> a >> b;
    if (a > ma) {
      ans = a+b;
      ma = a;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new	 Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int h = sc.nextInt();
		System.out.println((a+b)*h/2);
		sc.close();
      }
}

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

struct cust {
	int m;
	int l;
	int k;
};
 
struct query {
	int type;
	int time;
	int id;
};
class Compare {
public:
	bool operator()(const query&l,const query&r) {
		return l.time==r.time?l.type==r.type?l.id>r.id:l.type>r.type:l.time > r.time;
	}
};

bool check(const int T, const vector<cust>&cus, const int n) {
	int waitnum = n;
	priority_queue<query,vector<query>,Compare>que;
	set<int>waits;
	for (int i = 0; i < cus.size(); ++i) {
		que.push(query{ 0,0,i });
	}
	while (!que.empty()) {
		query q(que.top());
		que.pop();
		//call start
		 if (q.type == 0) {
			const int cid = q.id;
			if (waitnum) {
				waitnum--;
				const int nexttime = q.time + cus[cid].m;
				if (nexttime <= T) {
					que.push(query{ 1,nexttime,0 });
				}else {
					return false;
				}
			}
			else {
				waits.emplace(cid);
				const int nexttime = q.time + cus[cid].l;
				que.push(query{ 2,nexttime,cid });
			}
		//call end
		}else if (q.type == 1) {
			auto it = waits.begin();
			if (it == waits.end()) {
				waitnum++;
			}
			else {
				const int cid = *it;
				const int nexttime = q.time + cus[cid].m;
				if (nexttime <= T) {
					waits.erase(it);
					que.push(query{ 1,nexttime,0 });
				}
				else {
					return false;
				}
			}
		//give up call
		}else if (q.type == 2) {
			const int cid = q.id;
			auto it = waits.find(cid);
			if (it!=waits.end()) {
				waits.erase(it);
				const int nexttime = q.time + cus[cid].k;
				if (nexttime <= T-cus[cid].m) {
					que.push(query{ 0,nexttime,cid });
				}
				else {
					return false;
				}
			}
		}
	}
	return true;
}

int main() {
	while (1) {
		int N, T; cin >> N >> T;
		if (!N)break;
		vector<cust>cus;
		int totalm = 0;
		for (int i = 0; i < N; ++i) {
			int m, l, k; cin >> m >> l >> k;
			totalm += m;
			cus.push_back(cust{ m,l,k });
		}
		int amin = (totalm-1) / T + 1;
		for (int n = amin; n <= N; ++n) {
			if (check(T, cus, n)) {
				cout << n << endl;
				break;
			}
		}
	}
	
	return 0;
}

Measured memory_bytes: 3060
import java.util.*;
import java.lang.*;


public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        long l[] = new long[87];
        l[0] = 2;
        l[1] = 1;
        for (int i = 2; i <= 86; i++) {
            l[i] = l[i - 1] + l[i - 2];
        }
        System.out.println(l[n]);
    }
}

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

#define rep(i,n) for(int i = 0; i < n; i++)
#define REP(i,n) for(int i = 1; i < n; i++)
#define sz(x) int(x.size())
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define YesorNo(a) printf(a ? "Yes\n" : "No\n")
#define endl "\n"
using ll = long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
using vi = vector<int>;
using vii = vector<vi>;
using vl = vector<ll>;
using vll = vector<vl>;
using vs = vector<string>;
const int dx[] = {0,1,0,-1,1,1,-1,-1};
const int dy[] = {1,0,-1,0,1,-1,-1,1};
const int inf = (1<<30)-1;
const ll infll = (1LL<<62)-1;
ll ceil(const ll a, const ll b){return ((a)+(b)-1)/b;}

const ll mod = 1e9+7;

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

  ll n, m;
  cin >> n >> m;
  vi d(n+1);
  rep(i,m) {
    int a;
    cin >> a;
    d[a] = 1;
  }
  vl dp(n+1);
  dp[0] = 1;
  dp[1] = !d[1];
  for(int i = 2; i <= n; i++) {
    if(d[i]) continue;
    dp[i] = (dp[i-1] + dp[i-2]) % mod;
  }
  cout << dp[n] << endl;
}

Measured memory_bytes: 1408
#include <iostream>
#include <stack>
#include <math.h>
#include <vector>
#include <string>
#include <algorithm>
#include <map>

#define rep(i,n) for(int i=0; i < n; i++)
using ll =  long long;
using namespace std;
#define pi 3.14159265358979

int main()
{
	int n, minNum = 1010101, ans = 0;
	cin >> n;

	rep(i, n)
	{
		int x;
		cin >> x;
		if (x <= minNum) ans++;		// 入力値より前の値以下であれば条件を満たす
		minNum = min(x, minNum);	// その時点での最大値更新
	}
	cout << ans << endl;
}

Measured memory_bytes: 3620
#include <bitset>
#include <cmath>
#include <iostream>

using std::cin;
using std::cout;
using std::endl;

int main() {
  std::string ABCD;
  cin >> ABCD;

  std::bitset<3> bit(0);
  int expected = 7;

  int max = std::pow(4, 2);
  for (int i = 0; i < max; i++) {
    bit = i;
    int value = ABCD.at(0) - '0';

    for (int j = 0; j <= 2; j++) {
      int tmp = ABCD.at(j + 1) - '0';
      if (bit[j] == 0) {
        value += tmp;
      } else {
        value -= tmp;
      }
    }

    if (value == expected) {
      break;
    }
  }

  for (int i = 0; i <= 2; i++) {
    cout << ABCD.at(i);
    if (bit[i] == 0) {
      cout << '+';
    } else {
      cout << '-';
    }
  }
  cout << ABCD.at(3) << "=" << expected << endl;
}


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

#define _USE_MATH_DEFINES
#include<cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <deque>
#include <algorithm>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <iterator>
#include<iomanip>
#include<unordered_set>
#include<bitset>
#include<complex>

using namespace std;

#define rep(i,a,b) for(int i=(a), i##_len=(b);i<i##_len;i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)

#define int ll
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair

//typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<double, double> pdd;
typedef vector< vector<int> > mat;

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

const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD =  (int)1e9 + 7;
const double EPS = 1e-9;

map<int, int> vmap;

void func(int n)
{
	int t = n;
	for (int i = 2; i <= (int)sqrt(n); i += (i == 2 ? 1 : 2))
	{
		while (t%i == 0)
		{
			vmap[i]++;
			t /= i;
		}
	}
	if (t != 1)
	{
		vmap[t]++;
	}
}

signed main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	int N;
	cin >> N;
	rep(i, 1, N + 1)
	{
		func(i);
	}

	int ans = 1;
	for (auto p : vmap)
	{
		ans *= (p.second+1);
		ans %= MOD;
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256