akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<algorithm>
#include<vector>
#include<map>
#include<set>
#include<cmath>
#include<bitset>
#define REP(i,s,n) for(int i=s;i<n;i++)
#define rep(i,n) REP(i,0,n)
using namespace std;
typedef long long ll;
typedef pair<ll,int> P;
int N;
bool leading[27];
map<char,ll> coefficient;
map<P,int> cntbox;//first -> sum,second -> bit
map<ll,set<int> > cntbex;
int ans;
int S;

ll my_pow(ll a,ll e)
{
  return !e?1:
    (e%2?a*my_pow(a,e-1):my_pow(a*a,e/2));
}

ll getSum(vector<int>& toInt,vector<char>& alpha)
{
  ll sum = 0;
  for(int i=0;i<alpha.size();i++)
    sum += toInt[i]*coefficient[alpha[i]];   
  return sum;
}

void dfs(vector<int>& toInt,vector<char>& alpha,int pos,int used,bool flag)
{

  if(pos >= toInt.size() && !flag)
    {
      ll sum = getSum(toInt,alpha);      
      cntbox[P(sum,used)]++; 
      cntbex[sum].insert(used);
      return;
    }
  else if(pos >= toInt.size() && flag)
    {
      ll sum = getSum(toInt,alpha);
     
      sum = -sum;
 
      set<int> dex = cntbex[sum];
      for(set<int>::iterator it = dex.begin();it != dex.end();it++)
	{
	  int it_bit = (*it);
	  bool ok = true;
	  for(int j=0;j<10;j++)
	    {
	      if(((it_bit >> j) & 1) && ((used >> j) & 1))
		{
		  ok = false;
		  break;
		}
	    }
	  if(ok)
	    ans += cntbox[P(sum,it_bit)]; 	    
	}
      return;
    }

  for(int i=0;i<10;i++)
    {
      if(!i && leading[alpha[pos]-'A'])
	continue;
      if((used>>i) & 1)
	continue;
      toInt[pos] = i;
      dfs(toInt,alpha,pos+1,used|(1<<i),flag);
    }

}

int main()
{
  while(cin >> N,N)
    {//半分全列挙
      ans = 0;
      coefficient.clear();
      cntbox.clear();
      cntbex.clear();
      vector<string> vec(N);
      set<char> al;
      int mex,mex2;
      mex = mex2 = 0;
      rep(i,27)leading[i] = false;
      rep(i,N)
	{
	  cin >> vec[i];
	  if(i != N-1)
	    mex = max(mex,(int)vec[i].size());
	  else
	    mex2 = max(mex2,(int)vec[i].size());
	  if(vec[i].size() != 1)
	    leading[vec[i][0]-'A'] = true;
	  if(i != N-1)
	    rep(j,vec[i].size())
	      coefficient[vec[i][j]] += my_pow(10,vec[i].size()-1-j),al.insert(vec[i][j]);  
	  else
	    rep(j,vec[i].size())
	      coefficient[vec[i][j]] -= my_pow(10,vec[i].size()-1-j),al.insert(vec[i][j]);   
	}

      if(mex2 < mex)
	{
	  cout << 0 << endl;
	  continue;
	}    

      int cn,sz;
      sz = S = al.size();
      cn = 0;
      vector<char> A,B;
      for(set<char>::iterator it = al.begin();it != al.end();it++)
	{
	  if(cn < sz/2)
	    A.push_back((*it));
	  else
	    B.push_back((*it));
	  cn++;
	}
      
      vector<int> toInt(A.size());
      dfs(toInt,A,0,0,false);
      toInt.resize(B.size());
      dfs(toInt,B,0,0,true);
      cout << ans << endl;
    }
  return 0;
}

Measured memory_bytes: 9420
n,m,l = map(int,input().split())
A = [[0 for i in range(m)]for j in range(n)]
B = [[0 for i in range(l)]for j in range(m)]
C = [[0 for i in range(l)]for j in range(n)]
for i in range(n):
    nums = [int(e) for e in input().split()]
    for j in range(m):
        A[i][j] = nums[j]
for i in range(m):
    nums = [int(e) for e in input().split()]
    for j in range(l):
        B[i][j] = nums[j]
for i in range(n):
    for j in range(l):
        for k in range(m):
            C[i][j] = C[i][j] + A[i][k] * B[k][j]
    print(*C[i])


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

int main(){
  int a[3];
  for(int i = 0; i < 3; ++i)
    cin >> a[i];
  sort(a,a+3);
  if((a[0] == a[1]) ^ (a[2] == a[1])) puts("Yes");
  else puts("No");
}


Measured memory_bytes: 256
s = input()
text = 'abcdefghijklmnopqrstuvwxyz'
if len(s) < 26:
  for c in text:
    if c not in s:
      print(s + c)
      break
else:
  cand = {s[-1]}
  for i in range(1, len(s)):
    j = len(s) - i - 1
    if max(cand) > s[j]:
      print(s[:j] + min(c for c in cand if c > s[j]))
      break
    cand.add(s[j])
  else:
    print(-1)

Measured memory_bytes: 9144
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = getInt(sc);
		int[] a = getIntArray(sc);
		int[] b = getIntArray(sc);
		int[] c = getIntArray(sc);

		int preOrder = -1;
		int satisfaction = 0;
		for (int i = 0; i < n; i++) {
			int order = a[i];
			satisfaction += b[order - 1];
			if (order - preOrder == 1) {
				satisfaction += c[order - 2];
			}
			preOrder = order;
		}
		System.out.println(satisfaction);
	}

	/**
	 * *汎用メソッド<br>
	 * 入力した配列に対する順列を取得
	 *
	 * @param numArray
	 * @return
	 */
	private static List<Integer[]> getPermutation(int[] numArray) {
		List<Integer[]> permutation = new ArrayList<>();
		Integer[] ans = new Integer[numArray.length];
		boolean[] used = new boolean[numArray.length];

		return buildPermutaion(permutation, numArray, ans, used, 0);
	}

	/**
	 * *汎用メソッド(内部)<br>
	 * 入力した配列に対する順列を作成
	 *
	 * @param list
	 * @param numArray
	 * @param ans
	 * @param used
	 * @param depth
	 * @return
	 */
	private static List<Integer[]> buildPermutaion(List<Integer[]> list, int[] numArray, Integer[] ans, boolean[] used,
			int depth) {

		// 全部使い切った時=>できた順列を返す
		if (depth == numArray.length) {
			list.add(ans.clone());
			return list;
		}
		// 使い切っていない場合

		for (int i = 0; i < numArray.length; i++) {
			if (used[i]) {
				continue;
			}
			ans[depth] = numArray[i];
			used[i] = true;
			list = buildPermutaion(list, numArray, ans, used, depth + 1);

			used[i] = false;
		}

		return list;
	}

	/**
	 * *汎用メソッド <br>
	 * スキャナーからの入力値をlongで返却
	 *
	 * @return
	 */
	public static long getLong(Scanner sc) {

		return Long.parseLong(sc.next());
	}

	/**
	 * *汎用メソッド <br>
	 * スキャナーからの入力値をintで返却
	 *
	 * @return
	 */
	public static int getInt(Scanner sc) {

		return Integer.parseInt(sc.next());
	}

	/**
	 * *汎用メソッド <br>
	 * スキャナーからの入力値をStringで返却
	 *
	 * @return
	 */
	public static String getString(Scanner sc) {

		return sc.next();
	}

	/**
	 * *汎用メソッド <br>
	 * スキャナーからの入力値をint配列で返却
	 *
	 * @return
	 */
	public static int[] getIntArray(Scanner sc) {
		String line = "";
		// 直前にnext()を実行していると改行コードだけ取ってしまうのでその対策
		while (line.equals("")) {
			line = sc.nextLine();
		}

		String[] strArray = line.split(" ");
		int[] intArray = new int[strArray.length];
		for (int i = 0; i < strArray.length; i++) {
			intArray[i] = Integer.parseInt(strArray[i]);
		}
		return intArray;
	}

}


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

using namespace std;
 
#define rep(i,n) for(int i=0;i<(n);++i)
#define reps(i,n) for(int i=1;i<=(n);++i)
#define all(x) (x).begin(),(x).end()
#define Fixed fixed << setprecision(12)
#define int int64_t
using pii = pair<int,int>;
constexpr int INF  = 0x3f3f3f3f;
constexpr long long LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int mod1 = 1e9+7; 
constexpr int mod2 = 998244353;
 
template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }
 
template <class T> using min_heap = priority_queue<T,vector<T>,greater<T> >;
template <class T> using max_heap = priority_queue<T>;
template <class A, class B> using umap = unordered_map<A,B>;
  
inline int updiv(int a,int b){ return (a + b - 1) / b; }
 
constexpr int dx[] = {1,0,-1,0,1,1,-1,-1};
constexpr int dy[] = {0,-1,0,1,1,-1,-1,1};


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

	int n, h;
	cin >> n >> h;

	vector<int> a(n), b(n);

	rep(i,n){
		cin >> a[i] >> b[i];
	}

	sort(all(a), greater<int>());
	sort(all(b), greater<int>());

	int res = 0;
	
	for(int i = 0; i < n; ++i){
		if(b[i] >= a[0] && h > 0){
			h -= b[i];
			++res;
		}else{
			break;
		}
	}

	if(h > 0){
		res += updiv(h, a[0]);
	}

	cout << res << '\n';

	return 0;
}

Measured memory_bytes: 1792
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <unordered_map>
#include <stack>
#include <queue>
#include <utility>

#include <cassert>
#include <cmath>
#include <cstdio>

using namespace std;

#define fi first
#define se second
#define mkp make_pair
#define pb push_back
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

#define FOR(i,a,b) for(ll i=(a); i < (b); i++)
#define RFOR(i,a,b) for(ll i=(b)-1; i >= (a); i--)
#define rep(i,n) FOR(i,0,(n))
#define rrep(i,n) RFOR(i,0,(n))

int main() {
	ll N, M;
	cin >> N >> M;
	if(N > M) swap(N, M);

	if(M == 1)
		cout << 1 << endl;
	else if(N == 1)
		cout << max(M-2, 0ll) << endl;
	else
		cout << max((N-2) * (M-2), 0ll) << endl;
	return 0;
}


Measured memory_bytes: 256
#include<iostream>

void swap(int *a, int *b){
  int temp=*a;
  *a=*b;
  *b=temp;
}
int main(){
  int a,b,c;
  std::cin>>a>>b>>c;
  swap(&a,&b);
  swap(&a,&c);
  std::cout<<a<<" "<<b<<" "<<c<<std::endl;
}


Measured memory_bytes: 3584
#include<stdio.h>
#include<stdlib.h>
int compare(const void *a,const void *b){
  return *(int*)a-*(int*)b;
}

int main(){
  int a[100001] = {};
  int b[100001] = {};
  int n=0;
  int i=0;
  int maxa=0;
  int maxb=0;
  int seca=0;
  int secb=0;
  int mackya = 0;
  int mackyb = 0;
  int seckya = 0;
  int seckyb = 0;
  int cnt = 0;
  int hozon = 0;
  int test = 0;
  
  scanf("%d",&n);
  
  for(i=0;i<n/2;i++){
    scanf("%d %d",&a[i],&b[i]);
    //printf("%d,%d/",a[i],b[i]);
    if(a[i] == 58492){
      test++;
    }
  }
  //printf("%d#",test);
  qsort(a,n/2,sizeof(int),compare);
  qsort(b,n/2,sizeof(int),compare);
  //
  hozon=a[0];
  cnt = 1;
  
  for(i=1;i<n/2;i++){
    if(a[i] == hozon){
      cnt++;
    }else{
      if(cnt >= maxa){
        seca = maxa;
        maxa = cnt;
        seckya = mackya;
        mackya = hozon;
        //printf("%d/%d#",maxa,mackya);
      }else if(cnt >= seca){
        seca = cnt;
        seckya = hozon;
      }
      cnt = 1;
      hozon = a[i];
    }
  }
  
  if(cnt > maxa){
    seca = maxa;
    maxa = cnt;
    seckya = mackya;
    mackya = hozon;
  }else if(cnt > seca){
    seca = cnt;
    seckya = hozon;
  }    
  //
  
  hozon=b[0];
  cnt = 1;
  
  for(i=1;i<n/2;i++){
    if(b[i] == hozon){
      cnt++;
    }else{
      if(cnt >= maxb){
        secb = maxb;
        maxb = cnt;
        seckyb = mackyb;
        mackyb = hozon;
      }else if(cnt > secb){
        secb = cnt;
        seckyb = hozon;
      }
      cnt = 1;
      hozon = b[i];
    }
  }
  
  if(cnt > maxb){
    secb = maxb;
    maxb = cnt;
    seckyb = mackyb;
    mackyb = hozon;
  }else if(cnt > secb){
    secb = cnt;
    seckyb = hozon;
  } 
  
  if(seckya == 0){
    seckya = mackya;
  }
  if(seckyb == 0){
    seckyb = mackyb;
  }
  
  //printf("%d %d %d %d*%d %d %d %d\n",mackya,seckya,mackyb,seckyb,maxa,seca,maxb,secb);
  if(mackya != mackyb){
    printf("%d",n-maxa-maxb);
  }else{
    if(maxa+secb > maxb+seca){
      printf("%d",n-maxa-secb);
    }else{
      printf("%d",n-maxb-seca);
    }
  }
  
  return 0;
}
      

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

SList = []
TList = []
for i in range(0, N):
    S, T = input().split()
    SList.append(S)
    TList.append(int(T))

X = input()

INDEX = SList.index(X)

result = 0
for i in range(INDEX + 1, N):
    result += TList[i]

print(result)

Measured memory_bytes: 3064
import java.util.*;
import java.io.*;
class Main{

    public static void main(String []args) throws Exception {
        //BufferedReader inp = new BufferedReader(new InputStreamReader(System.in));
        Scanner sc = new Scanner(System.in);
        String [] str = sc.nextLine().split(" ");
        int a = Integer.parseInt(str[0]);
        int b = Integer.parseInt(str[1]);
        int c = Integer.parseInt(str[2]);
        int temp = b;
        b = a;
        a = temp;
        temp = c;
        c= a;
        a = temp;
        System.out.println(a + " " + b + " " + c);
        
    }
}

Measured memory_bytes: 21716
#include <stdio.h>
int main (void)
{
	int a,b,c;
	scanf("%d",&a);
	scanf("%d",&b);
	scanf("%d",&c);
	if(a<b&&b<c)
	{
		printf("Yes\n");
	}
	else
	{
		printf("No\n");
	}
	return 0;
}

Measured memory_bytes: 580
package main

import (
    "fmt"
    "math"
    "strconv"
)

func main() {
    var a, b string
    fmt.Scan(&a, &b)
    c, _ := strconv.Atoi(a + b)
    s := math.Sqrt(float64(c))
    if s == math.Trunc(s) {
        fmt.Printf("Yes")
    } else {
        fmt.Printf("No")
    }

}


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

#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define repr(i,a,b) for(int i=(int)(a-1);i>=b;i--)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout << #x" = " << x << endl
#define maxch(x,y) x=max(x,y)
#define minch(x,y) x=min(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt(x) bitset<32>(x).count()

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

#define INF INT_MAX/3

int main(){
    cin.sync_with_stdio(false);
    string s, t, ans;
    cin >> s >> t;
    bool ok = false;
    repr(i, s.size() - t.size() + 1, 0) {
        ans = s;
        bool f = true;
        rep(j, t.size()) {
            if (s[i + j] != '?' && s[i + j] != t[j]) f = false;
            ans[i + j] = t[j];
        }
        if (f) {
            ok = true;
            break;
        }
    }
    if (ok) {
        rep(i, ans.size()) if (ans[i] == '?') ans[i] = 'a';
        cout << ans << endl;
    } else {
        cout << "UNRESTORABLE" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
//#include <bits/stdc++.h>
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <string>
#include <vector>
#include <map>
#include <queue>

using namespace std;

typedef long long ll;
typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<n;++i)
#define mod (ll)(1e9+7)
#define FIX(a) ((a)%mod+mod)%mod
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define fi first
#define se second
#define pb push_back
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    priority_queue<pair<int,int>, vector<pair<int,int> >, greater<pair<int,int> > > pq;
    int n,m;
    cin >> n >> m;
    REP(i,m){
        int a,b;
        cin >> a >> b;
        pq.push(make_pair(b,a));
    }
    int ans = 1;
    int rm = pq.top().fi-1;
    pq.pop();
    while(pq.size()>0){
        pair<int,int> pi = pq.top();
        if(pi.se<=rm){
            //
        }else{
            ans++;
            rm = pi.fi-1;
        }
        pq.pop();
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1400
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for( int i = 0 ; i < n ; i++ )
typedef long long ll ;
int main() {
 
  ll N ;
  cin >> N ;
  ll ans = N + 1 - 2 ;
  for( ll i = 2 ; i*i <= N ; i++ ){
    if( N%i == 0 ) {
      //cout << N/i << " " << i << endl;
      ans = min(ans,N/i + i - 2 ) ;
    }
  }
  cout << ans << endl;
}

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

void Main()
{
    long n, m, k;
    cin >> n >> m >> k;
    vector<long> sa(n+1), sb(m+1);
    int yonda = 0, yonda_a = 0, yonda_max = 0;
    for (int i = 0; i < n; i++)
    {
        int a;
        cin >> a;
        sa[i+1] = sa[i] + a;
        if(sa[i+1] <= k)
        {
            yonda_a = i+1;
        }
    }
    yonda = yonda_a;
    yonda_max = yonda;
    for (int i = 0; i < m; i++)
    {
        int b;
        cin >> b;
        sb[i+1] = sb[i] + b;
        while(yonda_a > 0 && sa[yonda_a] + sb[i+1] > k)
        {
            yonda_a--;
        }
        if(sa[yonda_a] + sb[i+1] <= k)
        {
            yonda = yonda_a + i+1;
        }
        if(yonda_max < yonda)
        {
            yonda_max = yonda;
        }
    }
    
    cout << yonda_max << endl;
}

int main(int argc, char **argv)
{
    Main();
    return 0;
}


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

int main(){
  string s;
  cin >>s;
  int cnt = 0;
  rep(i, s.size()){
    if(s[i]=='o') cnt++;
  }
  if(15-s.size()+cnt >= 8) cout << "YES" << endl;
  else cout << "NO" << endl;
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#define ll long long
#define rep(i,n) for(ll i=0;i<(n);i++)
#define max(p,q) ((p)>(q)?(p):(q))
#define min(p,q) ((p)<(q)?(p):(q))
#define chmax(a,b) ((a)=(a)>(b)?(a):(b))
#define chmin(a,b) ((a)=(a)<(b)?(a):(b))
#define abs(p) ((p)>=(0)?(p):(-(p)))
#define MOD 1000000007
ll powll(ll a,ll b){ll r=1;rep(i,b){r*=a;}return r;}
#define swap(a,b) do{ll w=(a);(a)=(b);(b)=w;}while(0)
#define swapd(a,b) do{double w=(a);(a)=(b);(b)=w}while(0)
#define in(a) scanf("%lld", &(a))
#define in2(a,b) scanf("%lld %lld",&(a),&(b))
#define in3(a,b,c) scanf("%lld %lld %lld",&(a),&(b),&(c))
#define ind(a) scanf("%lf", &(a))
#define ins(a) scanf("%s", (a))
#define inc(a) scanf("%c", &(a))
#define put(a) printf("%lld\n", (a))
#define putd(a) printf("%.15f\n", (a))
//      puts(a) printf("%s\n", a) 文字はこっち
//your code here!
int cmp(const void *a, const void *b){
    ll A=*(ll *)a, B=*(ll *)b;
    if(A==B)return 0;
    else return A>B ? -1:1;
}
int main(void){
    ll N, K, l[55], ans=0;
    in2(N, K);
    rep(i, N) in(l[i]);
    qsort(l, N, sizeof(ll), cmp);//降順ソート
    rep(i, K) ans += l[i];
    put(ans);
    return 0;
}


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

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

  vector<string> A(N);
  for (int i = 0; i < N; i++) {
    cin >> A.at(i);
  }



    map<string,int> mp;
    for (string x :A) {

        if(mp.count(x)){
            mp[x] ++;
        }
        else mp[x] =1;
    }

  int max_cnt = 0; 
   
    
        for (string x : A) {
        if (max_cnt < mp[x]) {
        max_cnt = mp[x];
        
        
        }
    }
    vector<string> v(N);
    v.at(0) = "";
    int i=1;
    for(auto p:mp){

        auto key =p.first;
        auto value = p.second;
        if(value == max_cnt)        cout<< key << endl;
    }
     



     






}

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

#define MOD (1.0e9 + 7)

using namespace std;

int main(void)
{
    string in;
    string out;

    cin>>in;

    for(int i = 0;i < in.size();i++)
    {
	if(i % 2 == 0)
	    out += in[i];
    }

    cout<<out<<endl;

    return 0;
}



Measured memory_bytes: 512
#include <iostream>
#include <cstdio>
#include <fstream>
#include <algorithm>
#include <cmath>
#include <deque>
#include <vector>
#include <queue>
#include <string>
#include <cstring>
#include <map>
#include <stack>
#include <set>
#define INF 0x3f3f3f3f
const int MOD=1e9+7;
const double eps=1e-8;
typedef long long ll;
//orz yht
using namespace std;
int a,b;
int main(){
//	freopen(".in","r",stdin);
//	freopen(".out","w",stdout);
    cin>>a>>b;
    if(a>=1 && a<=9 && b>=1 && b<=9)
    cout<<a*b;
    else
    cout<<-1;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <sstream>
#include <algorithm>
#include <math.h>
#include <map>
#include <iomanip>
#include <vector>
#include <queue>
#include <set>

#define PI 3.14159265359

#define INF 99999999;

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

typedef long long ll;

using namespace std;



/*
class TheKingsArmyDiv2
{
public:
	int getNumber(vector <string> state)
	{

	}
};
*/




int main()
{
	int n;
	
	cin >> n;
	pair<int, int> av[n];
	
	REP(n)
	{
		cin >> av[i].first >> av[i].second;
	}
	
	int max_num = -1;
	int ind;
	REP(n)
	{
		if (av[i].second > max_num)
		{
			max_num = av[i].second;
			ind = av[i].first;
		} else if (av[i].second == max_num && ind > av[i].first) {
			max_num = av[i].second;
			ind = av[i].first;
		}
	}
	
	cout << ind << " " << max_num << endl;
	
	return 0;
}

Measured memory_bytes: 1164
#include <cstdio>
#include <iostream>
#include <cstring>
#include <vector>

using namespace std;


typedef long long ll;

const int N = 101;

char s[N];

int main()
{
    //freopen("input.txt", "r", stdin);


    int k;
    scanf("%s %d", s, &k);
    int n = strlen(s);

    vector<int> vec;
    int cnt = 1;
    for (int i = 1; i < n; ++i)
    {
        if (s[i] != s[i - 1])
        {
            vec.push_back(cnt);
            cnt = 1;
        }
        else
            ++cnt;
    }
    vec.push_back(cnt);

    if (s[0] != s[n - 1])
    {
        int ans = 0;
        for (int x : vec)
            ans += x / 2;
        printf("%lld", k * 1LL * ans);
    }
    else
    {
        if ((vec).size() == 1)
            printf("%lld", (n * 1LL * k) / 2);
        else
        {
            ll ans1 = 0;
            for (int i = 1; i < (int)vec.size() - 1; ++i)
                ans1 += vec[i] / 2;
            ans1 *= k;
            ll ans2 = vec[0] / 2 + vec.back() / 2 + ((vec[0] + vec.back()) / 2) * 1LL * (k - 1);
            printf("%lld", ans1 + ans2);
        }
    }
}


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

using namespace std;

int main() {
    int a[3], k;
    cin >> a[0] >> a[1] >> a[2] >> k;
    sort(a, a + 3);
    int ans = 0;
    for(int i = 0; i < k; i++) a[2] *= 2;
    for(int i = 0; i < 3; i++) ans += a[i];
    cout << ans << endl;
    return 0;
}


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

int main(void){

    char str[6];

    char ans[6]="coffee";

    //入力部分
    for(int i=0;i<7;i++){
        scanf("%c",&str[i]);
    }

    //計算部分

    //出力部分
    if(str[2]==str[3]&&str[4]==str[5]){
        printf("Yes\n");
    }else{
        printf("No\n");
    }
}

Measured memory_bytes: 128
#![allow(unused, non_snake_case, dead_code, non_upper_case_globals)]
use {
    proconio::{marker::*, *},
    std::{cmp::*, collections::*, mem::*},
};

#[fastout]
fn main() {
    input! {
        n:usize,p:usize,
        s:Chars,
    }
    let mut s = s;
    if p == 2 || p == 5 {
        let mut ans = 0i64;
        for (i, &c) in s.iter().enumerate() {
            if char_conv(c, '0') % p == 0 {
                ans += (i + 1) as i64;
            }
        }
        println!("{}", ans);
        return;
    }
    s.reverse();
    let mut cs = vec![0usize; n + 1];
    let mut tens = 1usize;
    for (i, &c) in s.iter().enumerate() {
        let now = char_conv(c, '0');
        cs[i + 1] = (now * tens + cs[i]) % p;
        tens = (tens * 10) % p;
    }
    let mut ls = vec![0; p + 3];
    for &x in &cs {
        ls[x] += 1;
    }
    let mut ans = 0i64;
    for &cnt in ls.iter() {
        ans += cnt * (cnt - 1) / 2;
    }
    println!("{}", ans);
}
pub fn char_conv(c: char, base: char) -> usize {
    return (c as u8 - base as u8) as usize;
}
static MX: usize = 1010101;
static MOD: i64 = 1000000007;
static INF: i64 = std::i64::MAX >> 1;


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

int main(){
  int N,D,norm,sum=0;
  cin >> N >> D;
  int X[N][D];
  
  for(int i=0;i<N;i++){
    for(int k=0;k<D;k++){
      cin >> X[i][k];
    }
  }
  for(int i=0;i<N;i++){
    for(int j=i+1;j<N;j++){
      norm = 0;
      for(int k=0;k<D;k++){
        norm += (X[i][k]-X[j][k])*(X[i][k]-X[j][k]);
      }
      bool sq = false;
      for(int l=0;l<=norm;l++){
        if(norm == l*l){
          sq=true;
        }
      }
      if(sq){
        sum++;
      }
    }
  }
  cout << sum << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(void){
	int x,y; cin>>x>>y;
	int ans;
	ans=max(300000-100000*(x-1),0)+max(300000-100000*(y-1),0);
	if(x==1&&y==1){
		ans+=400000;
	}
	cout<<ans<<endl;
	    
}


Measured memory_bytes: 256
s = input()
t = input()

max_match = 0
for i in range(len(s) - len(t) + 1):
    match = 0
    for j in range(len(t)):
        if t[j] == s[j + i]:
            match += 1
    if match > max_match:
        max_match = match

print(len(t) - max_match)

Measured memory_bytes: 9076
import java.util.Scanner;

public class Main {

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

        int[] A = new int[N];
        for(int i=0;i<N;i++) {
            A[i] = sc.nextInt();
        }
        
        int ans = 1;
        
        for(int i=0;i<N;i++) {
            if(A[i]%2 == 0) {
                if(A[i]%3 == 0 || A[i]%5 == 0) {
                    ans *= 1;
                } else {
                    ans *= 0;
                }
            }
        }
        if(ans == 0) {
            System.out.println("DENIED");
        } else {
            System.out.println("APPROVED");
        }

        sc.close();
    }
}


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

int main(){
    string s, ans, strn;
    int n;
    cin >> s;
    n= (int) s.size() - 2;
    strn = to_string(n);
    ans = s[0] + strn + s[s.size()-1];

    cout << ans << endl;
    
    return 0;
}

Measured memory_bytes: 256
import java.util.*;class Main{public static void main(String[]r){Scanner s=new Scanner(System.in);int i=0,n=s.nextInt(),m=s.nextInt(),b=999999999;int[]a=new int[n];for(;i<n;)a[i++]=s.nextInt();Arrays.sort(a);for(i=0;i+m-1<n;i++)b=Math.min(b,a[i+m-1]-a[i]);System.out.print(b);}}

Measured memory_bytes: 50264
using System;
using System.Collections.Generic;
using System.Linq;
using E = System.Linq.Enumerable;

static class Expression
{
    class ExpUnit
    {
        internal int Item1;
        internal Func<string> Item2;
        internal ExpUnit(int item1, Func<string> item2)
        {
            this.Item1 = item1;
            this.Item2 = item2;
        }
    }

    static void Main()
    {
        var op = new[] { '+', '-', '*', };
        var opOrders = 
            from o1 in E.Range( 0, 3 )
            from o2 in E.Range( 0, 3 )
            from o3 in E.Range( 0, 3 )
            select new[] { op[0], op[o1], op[o2], op[o3], };
        var numOrders =
            from i1 in E.Range( 0, 4 )
            from i2 in E.Range( 0, 4 )
            where i2 != i1
            from i3 in E.Range( 0, 4 )
            where i3 != i2 && i3 != i1
            from i4 in E.Range( 0, 4 )
            where i4 != i3 && i4 != i2 && i4 != i1
            select new[] { i1, i2, i3, i4, };
        var initExp = new ExpUnit( 0, null );        

        var indata = Console.In.ReadToEnd()
            .Split( 
                new[] { '\r', '\n' },
                StringSplitOptions.RemoveEmptyEntries )
            .TakeWhile( x => x[0] != '0' )
            .Select( x => Array.ConvertAll( x.Split( ' ' ), int.Parse ) );
        var q =
            from a in indata
            let qexp =
                from norder in numOrders
                let nums = norder.Select( x => a[x] )
                from ops in opOrders
                let e = TryCalc( nums, ops, initExp )
                where e != string.Empty
                select e
            let exp = qexp.FirstOrDefault()
            select exp != null ? exp : "0";
        foreach ( var e in q )
            Console.WriteLine( e );
    }

    static string TryCalc
    (IEnumerable<int> nums, IEnumerable<char> ops, ExpUnit acc)
    {
        var num = nums.FirstOrDefault();
        if ( num == 0 )
            return acc.Item1 == 10 ? acc.Item2() : string.Empty;

        var op = ops.First();
        var unit = MakeExp( acc, op, num.AsExp() );
        var exp = TryCalc( nums.Skip( 1 ), ops.Skip( 1 ), unit );
        if ( exp != string.Empty || nums.Count() != 2 )
            return exp;

        var unit2 = MakeExp( num.AsExp(), op, nums.Last().AsExp() );
        unit = MakeExp( acc, ops.Last(), unit2 );
        return TryCalc( E.Empty<int>(), E.Empty<char>(), unit );
    }

    static ExpUnit AsExp(this int n)
    {
        return new ExpUnit( n, () => n.ToString() );
    }

    static ExpUnit MakeExp(ExpUnit acc, char o, ExpUnit sub)
    {
        var v = acc.Item1;
        var n = sub.Item1;
        switch ( o )
        {
            case '+': v += n; break;
            case '-': v -= n; break;
            case '*': v *= n; break;
        }

        Func<string> e = () => "(" + acc.Item2() + o + sub.Item2() + ")";
        if ( acc.Item2 == null )
            e = () => sub.Item2();

        return new ExpUnit( v, e );
    }
}

Measured memory_bytes: 20880
#define _USE_MATH_DEFINES
#define INF 0x3f3f3f3f
#include <cstdio>
#include <iostream>
#include <sstream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>
#include <list>
#include <cctype>
#include <utility>
 
using namespace std;
 
typedef long long ll;
typedef pair <int,int> P;
typedef pair <int,P > PP;
 
static const int tx[] = {0,1,0,-1};
static const int ty[] = {-1,0,1,0};
 
static const double EPS = 1e-8;

ll compute_euler_phi(int n){

  ll res = n;
  for(int i=2;i*i<=n;i++){
    if(n % i == 0){
      res = res / i * (i - 1);
      while(n % i == 0){
        n /= i;
      }
    }
  }

  if(n != 1) res = res / n * (n - 1);
  return res;
}

ll dp[1000005];

int main(){
  int total_queries;

  memset(dp,0,sizeof(dp));
  for(int i=0;i<=1000000;i++){
    dp[i+1] = dp[i] + compute_euler_phi(i+1);
  }
  while(~scanf("%d",&total_queries)){
    for(int query_idx=0;query_idx<total_queries;query_idx++){
      int n;
      scanf("%d",&n);
      printf("%lld\n",dp[n] + 1);
    }
  }
}

Measured memory_bytes: 9008
import java.util.*;

import static java.lang.System.*;

class Main {
    public static Scanner sc = new Scanner(in);
    public static Random rand=new Random();

    class Cake{
    	int d,w;

    	public Cake(int w,int d){
    		this.d=d;this.w=w;
    	}
    	public int getS(){
    		return d*w;
    	}

    	public String toString(){
    		return ""+getS();
    	}
    }
    public void run() {
        while(true){
            int n=sc.nextInt(),w=sc.nextInt(),d=sc.nextInt();
            if(n==0 && w==0 && d==0)return;
            ArrayList<Cake> list=new ArrayList<Cake>();
            list.add(new Cake(w,d));

            for(int q=0;q<n;q++){
            	int p=sc.nextInt();
            	Cake c=list.get(p-1);
            	int s=sc.nextInt();
            	Cake c1=null,c2=null;
            	s%=(c.w+c.d);
            	if(s<c.w){
            		c1=new Cake(s,c.d);
            		c2=new Cake(c.w-s,c.d);
            	}else{
                	s-=c.w;
            		c1=new Cake(c.w,s);
            		c2=new Cake(c.w,c.d-s);
            	}
            	list.remove(p-1);

            	if(c1.getS()<c2.getS()){
        			list.add(c1);list.add(c2);
        		}else{
        			list.add(c2);list.add(c1);
        		}
            }
            Collections.sort(list,new Comparator<Cake>(){
            	@Override
            	public int compare(Cake o1, Cake o2) {
            		return o1.getS()-o2.getS();
            	}
			});

            for(int i=0;i<list.size();i++){
            	if(i>0)pr(" ");
            	pr(list.get(i).getS());
            }
            ln();
        }
    }
    public static void main(String[] args) {
        new Main().run();
    }

	//output lib
	public static void ln(){
		out.println();
	}
	public static void pr(Object... obj){
		out.print(str(obj));
	}
	public static void ln(Object... obj){
		for(Object o:obj){
			pr(o);ln();
		}
	}
	public static String str(Object obj){
		return obj.toString();
	}
	public static <E> String str(E[] obj){
		StringBuilder sb=new StringBuilder();
		for(int i=0;i<obj.length;i++){
			sb.append(i==0?"":" ").append(obj[i]);
		}
		return sb.toString();
	}
	public static <E> String str(List<E> obj){
		StringBuilder sb=new StringBuilder();
		for(int i=0;i<obj.size();i++){
			sb.append(i==0?"":" ").append(obj.get(i));
		}
		return sb.toString();
	}
}

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

int main() {
	string s;
	cin >> s;
	int m = stoi(s.substr(5, 2));
	int d = stoi(s.substr(8, 2));
	if (m <= 4)cout << "Heisei" << endl;
	else cout << "TBD" << 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 k = sc.nextInt();
		int x = sc.nextInt();
		
		System.out.println(x <= 500 * k ? "Yes" : "No");
		sc.close();
	}
	
}

Measured memory_bytes: 35748
import Control.Monad
import Control.Applicative
import Data.List
import Data.Array
strToInteger s = (read :: String -> Integer) s

main = do
    [x,y] <- (map strToInteger . words) <$> getLine
    print $ 1 +  (solve x y)

solve :: Integer -> Integer -> Integer
solve x y = if (2 * x) <= y
            then 1 + (solve (2*x) y)
            else 0


Measured memory_bytes: 508
#include <bits/stdc++.h>
using namespace std;
#define int long long
const int mod = 1e9 + 7;

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    
    int testCases = 1;
   // cin >> testCases;
  
    while(testCases--)
    {
        int n;
        //cin >> n;
        int i,j;
        
        string s;
        cin >> s;
        int sum = 0;
        for(char ch : s)
        {
            sum += ch - '0';
        }
        
        if(sum % 9)
            cout << "No";
        else
            cout << "Yes";
        cout << '\n';
    }
}

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

using namespace std;

int main() {
    int n, m, c, a[20][20], b[20];
    cin >> n >> m >> c;
    for(int i=0; i<m; i++) {
        cin >> b[i];
    }
    for(int i=0; i<n; i++) {
        for(int j=0; j<m; j++) {
            cin >> a[i][j];
        }
    }
    int cnt=0;
    for(int i=0; i<n; i++) {
        int sum=c;
        for(int j=0; j<m; j++) sum+=a[i][j]*b[j];
        if(sum>0) cnt++;
    }
    cout << cnt;
    return 0;
}


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

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

int x;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> x;
  for (ll i = -120; i <= 120; ++i) {
    for (ll j = -120; j <= 120; ++j) {
      if (i * i * i *i * i - j * j * j * j * j == x) {
        cout << i << ' ' << j << endl;
        return 0;
      }
    }
  }
  
  return 0;
}


Measured memory_bytes: 3628
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef long double db;
typedef vector <ll> vll;
typedef pair <ll, ll> pll;
#define pb push_back
#define mp make_pair
#define MAX 1000000
#define mod 1000000007
#define all(_) _.begin(), _.end()
#define F first
#define S second
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>

int main()
{
    ios_base :: sync_with_stdio(false);
    cin.tie(NULL), cout.tie(NULL);
    ll n, i, k;
    db ans = 0;
    cin >> n >> k;
    for(i = 1; i <= n; i++)
    {
        ll p = ceil(log2((db)k / (db)i));
        if(k <= i)
            p = 0;
        ans += (db)1 / (db)(1ll << p);
    }
    ans /= n;
    cout << fixed << setprecision(12) << ans << endl;
    return 0;
}

Measured memory_bytes: 640
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

	Scanner sca = new Scanner(System.in);
	int n = sca.nextInt();
	int m = sca.nextInt();
	int[] si = new int[m];
	int[] ci = new int[m];
	for(int i = 0; i < m; i++) {
		si[i] = sca.nextInt();
		ci[i] = sca.nextInt();
	}
	int[] ans = new int[n];
	for(int i = 0; i < n; i++) {
		ans[i] = -2;
	}

	for(int i = 0; i < m; i++) {
		if(si[i] == 1 && ci[i] == 0 && n != 1) {
			ans[0] = -1;
			break;
		}
		else if(ans[si[i] - 1] != ci[i] && ans[si[i] - 1] > -1) {
			ans[0] = -1;
			break;
		}
		else {
			ans[si[i] - 1] = ci[i];
		}
	}

	for(int i = 0; i < n; i++) {
		if(ans[0] == -1) {
			break;
		}
		else if(ans[i] == -2) {
			if(i == 0) {
				ans[i] = 1;
			}
			else {
				ans[i] = 0;
			}
		}
	}
	int ten = 1;
	int ans_sin = 0;
	for(int i = n-1; i >= 0; i--) {
		if(ans[0] == -1) {
			ans_sin = -1;
			break;
		}
		if(m == 0 && n == 1) {
			ans_sin = 0;
			break;
		}
		ans_sin += ans[i]*ten;
		ten = ten * 10;
	}
	System.out.println(ans_sin);

	// 後始末
	sca.close();
	}
}

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

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

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using ul = unsigned long;

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

ll GCD(ll a, ll b) { return b ? GCD(b, a%b) : a; }
ll LCM(ll a, ll b) { return a / GCD(a, b)* b; }

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

inline bool inside(int y, int x, int H, int W) {
    return (y >= 0 && x >= 0 && y < H && x < W);
}

const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  int n,m; cin>>n>>m;
  vector<vi> s(200005);
  rep(i,m){
    int a,b; cin>>a>>b;
    s[a].push_back(b);
    s[b].push_back(a);
  }
  rep(i,s[1].size()){
    rep(j,s[s[1][i]].size()){
      if(s[s[1][i]][j]==n){
        cout<<"POSSIBLE"<<endl;
        return 0;
      }
    }
  }
  cout<<"IMPOSSIBLE"<<endl;
}

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

int main(){
  int n,ans=0;
  cin>>n;
  if(n<10){
    ans = n;
	}
  else if(n>=10 && n <100){
    ans = 9;
	}
  else if(n>=100 && n<1000){
    ans = 9 + (n - 100 + 1);
	}
  else if(n>=1000 && n<10000){
    ans = 9 + 900;
	}
  else if(n>=10000 && n<100000){
    ans = 9 + 900 + (n-10000+1);
	}
  else if(n>=100000){
    ans = 9 + 900 + 90000;
	}
  cout<<ans<<endl;
}



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

int main() {
   int h, w;
   std::cin >> h >> w;
   std::vector<string> v(h);
   for (size_t i = 0; i < h; i++) {
      std::cin >> v.at(i);
   }
   int flag = 0;
   for (size_t i = 1; i < h - 1; i++) {
      for (size_t j = 1; j < w - 1; j++) {
         if(v[i][j] == '#' && v[i-1][j] =='.' && v[i][j-1] =='.' && v[i+1][j] =='.' && v[i][j+1] =='.'){
            flag = 1;
         }
      }
   }
   if (flag == 0) {
      std::cout << "Yes" << '\n';
   }else{
      std::cout << "No" << '\n';
   }

}


Measured memory_bytes: 256
package main
import (
  "fmt"
)

func main() {
  var n int
  fmt.Scanf("%d", &n)
  var sum int
  for i:=1;i<=n;i++ {
    if !(i%3==0 || i%5==0) {
      sum+=i
    }
  }
  fmt.Println(sum)
}

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

using namespace std;

using ll = long long;

int main() {
#ifdef BZ
    freopen("input.txt", "r", stdin);
#endif
    ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
    int n;
    cin >> n;
    string s;
    cin >> s;
    string t;
    cin >> t;
    int ans = n + n;
    for (int i = 1; i <= n; i++) {
        if (s.substr(s.size() - i) == t.substr(0, i)) {
            ans = min(ans, n + n - i);
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main() {

    int a, b, c;
    cin >> a >> b >> c;
    int div = 0;

    for (int i = a; i <= b; i++) {
        if (c % i == 0)
            div++;
    }
    cout << div << endl;
    return 0;
}

Measured memory_bytes: 3100
import java.util.Scanner;
//Scannerクラスをimport
class Main{
    public static void main(String[] args){
      Scanner sc = new Scanner(System.in);
      //Scannerクラスのインスタンスを作成
        int A = sc.nextInt();
        //りんご
        int P = sc.nextInt();
        //りんごの欠片
        System.out.println((3 * A + P) / 2 );
        //計算(頭の中ではわかっているけど、言葉では表せない処理)
    }
}

Measured memory_bytes: 21716
#include <cstdio>
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
using namespace std;

int main() {
    string S_in;
    cin >> S_in;
    string first, latter;
    int len_S = S_in.size();
    if (len_S % 2 == 0) {
        first = S_in.substr(0, len_S / 2);
        latter = S_in.substr(len_S / 2);
    } else {
        first = S_in.substr(0, len_S / 2 + 1);
        latter = S_in.substr(len_S / 2);
    }
    reverse(latter.begin(), latter.end());
    int len_half = first.size();
    int len_unmatch = 0;
    for (int i = 0; i < len_half; i++) {
        len_unmatch += (first[i] != latter[i]);
    }

    cout << len_unmatch << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
string S; int dp[100001][9][9][2];
int main() {
	while (true) {
		for (int i = 0; i < 100001; i++) {
			for (int j = 0; j < 162; j++) {
				dp[i][(j / 2) / 9][(j / 2) % 9][j % 2] = 1000000000;
			}
		}
		cin >> S; if (S == "#")break;
		dp[0][0][2][0] = 0; dp[0][0][2][1] = 0;
		for (int i = 0; i < S.size(); i++) {
			int V = S[i] - '1';
			for (int j = 0; j < 9; j++) {
				for (int k = 0; k < 9; k++) {
					if ((j % 3) <= (V % 3)) {
						dp[i + 1][j][V][1] = min(dp[i + 1][j][V][1], dp[i][j][k][0]);
						dp[i + 1][j][V][1] = min(dp[i + 1][j][V][1], dp[i][j][k][1] + 1);
					}
					if ((V % 3) <= (k % 3)) {
						dp[i + 1][V][k][0] = min(dp[i + 1][V][k][0], dp[i][j][k][1]);
						dp[i + 1][V][k][0] = min(dp[i + 1][V][k][0], dp[i][j][k][0] + 1);
					}
				}
			}
		}
		int minx = 1000000000;
		for (int i = 0; i < 162; i++) {
			minx = min(minx, dp[S.size()][i / 18][(i / 2) % 9][i % 2]);
		}
		cout << minx << endl;
	}
	return 0;
}

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

int main() {
  string s, t;
  cin >> s >> t;
  
  bool flag = true;
  vector<string> x;
  for(int i = 0; i < s.size() - t.size() + 1; i++){
    for(int j = i; j < i + t.size(); j++){
      if(s.at(j) != '?' && s.at(j) != t.at(j - i)) break;
      if(j == i + t.size() - 1){
        string u = "";
        u = s;
        u.replace(i, t.size(), t);
        for(int k = 0; k < u.size(); k++){
          if(u.at(k) == '?') u.at(k) = 'a';
        }
        x.push_back(u);
      }
    }
  }
  
  if(s.size() < t.size() || x.size() == 0) flag = false;
  
  sort(x.begin(), x.end());
  
  if(flag) cout << x.at(0) << endl;
  else cout << "UNRESTORABLE" << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define Yes cout<<"Yes"<<endl;
#define No cout<<"No"<<endl;
#define ll long long int
using namespace std;
int main()
{
    ll tc;

    ll a,b,c,n,x,y,z,cnt=0,sum=0;
        string str;
        cin>>n;
        if(n>=1 && n<=1000)cout<<1000-n;
        else if(n>1000 &&n<=2000)cout<<2000-n;
         else if(n>2000&&n<=3000)cout<<3000-n;
          else if(n>3000&&n<=4000)cout<<4000-n;
          else if(n>4000&&n<=5000)cout<<5000-n;
           else if(n>5000&&n<=6000)cout<<6000-n;
            else if(n>6000&&n<=7000)cout<<7000-n;
            else if(n>7000&&n<=8000)cout<<8000-n;
            else if(n>8000&&n<=9000)cout<<9000-n;
            else if(n>9000&&n<=10000)cout<<10000-n;


}




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

using namespace std;

#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define fin(ans) cout << (ans) << endl;
#define blank(ans) cout << (ans) << " ";
#define mp(p, q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()

typedef long long ll;
typedef long long lli;
typedef unsigned long long ull;
typedef long double ld;
typedef string str;

typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<ld> vd;
typedef vector<str> vs;
typedef vector<ll> vll;
typedef vector<pair<ll, ll>> vpll;
typedef vector<pair<ll, str>> vpls;
typedef vector<tuple<str, ll, ll>> vtsl;
typedef vector<vector<ll>> vvll;
typedef vector<vector<char>> vvc;
typedef vector<vector<str>> vvs;

const ld PI = acos(-1.0);
const ll MAX = 9000000000000000000;
const ll MIN = -9000000000000000000;
const ld DMAX = 4500;
const ld DMIN = -4500;
const ll MOD = 1000000007;

//実行部
void Main()
{
  ll a, b; cin >> a >> b;
  if(a * b % 2 == 0) fin("No")
  else fin("Yes")
}

//前処理
int main()
{
  //ios::sync_with_stdio(false);
  //cin.tie(0);
  cout << fixed << setprecision(20); //高精度少数表示
  Main();
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const double pi=3.141592653589793;
typedef unsigned long long ull;
typedef long double ldouble;
const ll INF=1e18;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); 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; }

// union by size + path having
class UnionFind {
public:

    //素集合の要素の親（木構造の根）を配列*3で保持している．初期状態では頂点間の辺は存在せず，孤立した状態のため，自分自身を根として初期化している（par: parent の略）．
    vector <ll> par;

    // 各集合（木）の大きさ．根をたどるとその木の大きさが返されるように実装されている．この配列を用意しておくとある頂点の連結成分の大きさを簡単に求められる
    vector <ll> siz;

    // Constructor
    UnionFind(ll sz_): par(sz_), siz(sz_, 1LL) {
        for (ll i = 0; i < sz_; ++i) par[i] = i; // 初期では親は自分自身
    }
    void init(ll sz_) {
        par.resize(sz_);
        siz.assign(sz_, 1LL);  // resize だとなぜか初期化されなかった
        for (ll i = 0; i < sz_; ++i) par[i] = i; // 初期では親は自分自身
    }

    // Member Function
    // Find
    ll root(ll x) { // 根の検索
        while (par[x] != x) {
            x = par[x] = par[par[x]]; // x の親の親を x の親とする
        }
        return x;
    }

    // Union(Unite, Merge)
    bool merge(ll x, ll y) {
        x = root(x);
        y = root(y);
        if (x == y) return false;
        // merge technique（データ構造をマージするテク．小を大にくっつける）
        if (siz[x] < siz[y]) swap(x, y);
        siz[x] += siz[y];
        par[y] = x;
        return true;
    }

    bool issame(ll x, ll y) { // 連結判定
        return root(x) == root(y);
    }

    ll size(ll x) { // 素集合のサイズ
        return siz[root(x)];
    }
};

const int MAX_V = 100005;
const int MAX_E = 200005;

struct edge {ll u, v, cost;};

bool comp(const edge& e1, const edge& e2) {
    return e1.cost < e2.cost;
}

vector<edge> es(MAX_E);
ll V, E;

ll kruskal() {
    sort(es.begin(), es.begin() + E, comp);
    UnionFind uf(V);
    ll res = 0;
    rep(i, E){
        edge e = es[i];
        if(!uf.issame(e.u, e.v)) {
            uf.merge(e.u, e.v);
            res += e.cost;
        }
    }
    return res;
}


// ------------------------------------------------------------
// クラスカル法 O(|E|log|V|) 連結成分に属しているかどうかをUnionFindで検索
// MAX_V MAX_E　を設定し直すこと
// ------------------------------------------------------------



int main(){
    int N;
    cin >> N;
    V = N;
    E = 2*N-2;
    ll a, b;
    vector<pair<ll,ll> > x(N) ,y(N);
    rep(i, N) {
        cin >> a >> b;
        x[i] = make_pair(a, i);
        y[i] = make_pair(b, i);
    }
    sort(x.begin(), x.end());
    sort(y.begin(), y.end());
    rep(i, N-1){
        es.at(i) = (edge){x[i].second, x[i+1].second, (x[i+1].first - x[i].first)};
    }
    rep2(i, N-1, 2*N-2){
        int j = i - N + 1;
        es.at(i) = (edge){y[j].second, y[j+1].second, (y[j+1].first - y[j].first)};
    }
    cout << kruskal() << endl;
}

Measured memory_bytes: 12728